English
Hello,
sorry for my english
i reinstall my server, i cant get a letsencrypt certificate with traefik. I am new to docker and traefik. I have docker-compose which allows me to create a my traefik container and carry the certificates that create well. I want to put my portfolio with another docker-compose it creates the containers well and they appear on the traefik dashboard but the certificates do not create problem, I cannot access them.
i will need help its been several days since i am looking into it but i can't find the error.
I had managed to get it working before my but the certificate did not renew automatically so I decided to reinstall the server to start from scratch to have something cleaner.
French
Bonjour,
j'ai réinstaller mon serveur, je n'arrive pas avoir un certificat letsencrypt avec traefik. Je suis novice avec docker et traefik. J'ai docker-compose qui me permet de créer un mon container traefik et portainer les certificats ce créer bien. je veux mettre mon portfolio avec un autre docker-compose il crée bien les containers et ils apparaissent bien sur le dashboard traefik mais problème les certificats ne créer pas ,je ne peut pas y accédé.
j'aurai besoin d'aide sa fait plusieurs jours que je penche dessus mais je trouve pas l'erreur.
J'avais réussi a faire focntionner avant mes mais certificat ne se renouveler pas automatiquement donc j'ai décidé de réinstaller le serveur pour repartir de zéro pour avoir quelque chose de plus propre.
docker-compose traefik on my serveur
version: "3.7"
services:
traefik:
image: "traefik:latest"
container_name: Traefik
restart: always
command:
- --entrypoints.web.address=:80
- --entrypoints.websecure.address=:443
- --providers.docker
- --api
# - --certificatesresolvers.leresolver.acme.caserver=https://acme-staging-v02.api.letsencrypt.org/directory
- --certificatesresolvers.leresolver.acme.email=monadress@gmail.com
- --certificatesresolvers.leresolver.acme.storage=/acme/acme.json
- --certificatesresolvers.leresolver.acme.tlschallenge=true
ports:
- "80:80"
- "443:443"
networks:
- web
volumes:
- "/var/run/docker.sock:/var/run/docker.sock:ro"
- "./acme:/acme"
labels:
# Dashboard
- "traefik.http.routers.traefik.rule=Host(`traefik.mondomain.fr`)"
- "traefik.http.routers.traefik.service=api@internal"
- "traefik.http.routers.traefik.tls.certresolver=leresolver"
- "traefik.http.routers.traefik.entrypoints=websecure"
- "traefik.http.routers.traefik.middlewares=authtraefik"
- "traefik.http.middlewares.authtraefik.basicauth.users=root:$$apr1$$vbK0603Q$$vxo7ZpHC1kNQeWc6Tdfiy." # user/password
# global redirect to https
- "traefik.http.routers.http-catchall.rule=hostregexp(`{host:.+}`)"
- "traefik.http.routers.http-catchall.entrypoints=web"
- "traefik.http.routers.http-catchall.middlewares=redirect-to-https"
# middleware redirect
- "traefik.http.middlewares.redirect-to-https.redirectscheme.scheme=https"
portainer:
image: portainer/portainer-ce:latest
container_name: Portainer
networks:
- web
# ports:
# - "9000:9000" # The HTTP port
labels:
- "traefik.http.routers.portainer.rule=Host(`portainer.mondomain.fr`)"
- "traefik.http.routers.portainer.entrypoints=websecure"
- "traefik.http.routers.portainer.tls=true"
- "traefik.http.routers.portainer.tls.certresolver=leresolver"
- "traefik.http.services.portainer.loadbalancer.server.port=9000"
volumes:
- "/var/run/docker.sock:/var/run/docker.sock"
restart: always
networks:
web:
external: true
English
The docker-compose works and the certificates are created well
French
Le docker-compose fonctionne et les certificat ce créer bien
docker-compose portfolio
version: "3.7"
services:
mysql:
image: mysql
volumes:
- "./.portfolio/db:/var/lib/mysql"
- ./portfolio.sql:/docker-entrypoint-initdb.d/portfolio.sql
command: --default-authentication-plugin=mysql_native_password
restart: always
environment:
MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD}
MYSQL_DATABASE: ${MYSQL_DB_NAME}
MYSQL_USER: ${MYSQL_USERNAME}
MYSQL_PASSWORD: ${MYSQL_ROOT_PASSWORD}
phpmyadmin:
depends_on:
- mysql
image: phpmyadmin/phpmyadmin
restart: always
environment:
PMA_HOST: mysql
MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD}
networks:
- default
- web
labels:
- "traefik.http.routers.portfolio_phpmyadmin.rule=Host(`php-portfolio.mondomain.fr`)"
- "traefik.http.routers.portfolio_phpmyadmin.entrypoints=websecure"
- "traefik.http.routers.portfolio_phpmyadmin.tls=true"
- "traefik.http.routers.portfolio_phpmyadmin.tls.certresolver=leresolver"
- "traefik.http.services.portfolio_phpmyadmin.loadbalancer.server.port=80"
- "traefik.docker.network=web"
# - "traefik.enable=true"
backend:
build: ./back/
networks:
- default
- web
volumes:
- ./back/public/:/usr/src/app/public
- ./back/route/:/usr/src/app/route
- ./back/server.js:/usr/src/app/server.js
depends_on:
- mysql
environment:
DB_HOST: mysql
DB_USER: ${MYSQL_USERNAME}
DB_PASS: ${MYSQL_PASSWORD}
DB_DATABASE: ${MYSQL_DB_NAME}
API_PORT: ${API_PORT}
DELTA_TOKEN_EXPIRATION: ${DELTA_TOKEN_EXPIRATION}
labels:
- "traefik.http.routers.backend_portfolio.rule=Host(`portfolio.mondomain.fr`) && (PathPrefix(`/api`) || PathPrefix(`/uploads`))"
- "traefik.http.middlewares.backend_portfolio_stripprefix.stripprefix.prefixes=/api"
- "traefik.http.routers.backend_portfolio.middlewares=backend_portfolio_stripprefix"
- "traefik.http.routers.backend_portfolio.entrypoints=websecure"
- "traefik.http.routers.backend_portfolio.tls=true"
- "traefik.http.routers.backend_portfolio.tls.certresolver=leresolver"
- "traefik.http.services.backend_portfolio.loadbalancer.server.port=80"
- "traefik.docker.network=web"
# - "traefik.enable=true"
frontend:
build: ./front/
tty: true
networks:
- web
labels:
- "traefik.http.routers.frontend_portfolio.rule=Host(`portfolio.mondomain.fr`)"
- "traefik.http.routers.frontend_portfolio.entrypoints=websecure"
- "traefik.http.routers.frontend_portfolio.tls=true"
- "traefik.http.routers.frontend_portfolio.tls.certresolver=leresolver"
- "traefik.http.services.frontend_portfolio.loadbalancer.server.port=80"
- "traefik.docker.network=web"
# - "traefik.enable=true"
networks:
web:
external: true
default:
English
I get this error in my portainer logs
French
j'obtiens cette erreur dans mes logs de portainer
time="2021-06-10T07:49:22Z" level=error msg="service \"mysql-portfolio\" error: impossible de trouver l'adresse IP pour le conteneur \"/portfolio_mysql_1\": le serveur est ignoré" providerName=conteneur docker=mysql-portfolio-c9b3dc069d55c4bf087a2517a4d6c3a92c911b9b348a1336faabe0de79c64cfe
time="2021-06-10T07:49:15Z" level=error msg="Impossible d'obtenir le certificat ACME pour les domaines \"mondomain.fr\": impossible de générer un certificat pour les domaines [portfolio.mondomain.fr] : erreur : un ou plusieurs domaines ont eu un problème :\n[portfolio.mondomain.fr] [portfolio.mondomain.fr] acme : erreur de présentation du jeton : timeout 2021-06-10 07 : 49:11.86846917 +0000 UTC m=+48490.568036278\n" providerName=leresolver.acme routerName=backend_portfolio@docker rule="Host(`portfolio.mondomain.fr`) && (PathPrefix(`/api`) || PathPrefix (`/uploads`))"
Thank you