Hello, I am new to Traefik. I want to configure the Docker swarm.
And I don't have good results when deploying Traefik. I tried several times restarting the docker leave cluster, docker init join, repeatedly and I only get a 502 error. I pass my test files in case anyone finds any error and can give me a hand. Thank you
#docker stack deploy -c st-traefikv2.yml proxy-traefik
##########
networks:
traefik-public:
external: true
volumes:
portainerdata:
traefik-certificates:
traefik-logs:
version: '3.7'
services:
pr-traefik:
image: traefik:v2.2
command:
- "--providers.docker.swarmMode=true"
- "--providers.docker=true"
- "--providers.docker.exposedbydefault=false"
- "--api.insecure=false"
- "--entryPoints.web.address=:80"
- "--entryPoints.websecure.address=:443"
#TSL
- "--certificatesresolvers.le.acme.tlschallenge=true"
- "--certificatesResolvers.le.acme.email=myemail@email.com"
- "--certificatesResolvers.le.acme.storage=/letsencrypt/acme.json"
#Logs
- --api=true
# - --api.insecure=true
# - --serversTransport.insecureSkipVerify=true
- --log=true
- --log.level=WARN
- --accessLog=true
- --accessLog.filePath=/logs/traefik.log
- --accessLog.bufferingSize=100 # Configuring a buffer of 100 lines
- --accessLog.filters.statusCodes=400-499
ports:
- 80:80
- 443:443
networks:
- traefik-public
volumes:
- traefik-certificates:/letsencrypt
- traefik-logs:/logs
- "/var/run/docker.sock:/var/run/docker.sock:ro"
deploy:
placement:
constraints:
- node.role == manager
#####################
docker stack deploy -c st-whoami.yml test-traefik-whoami
##########
version: '3.3'
networks:
traefik-public:
external: true
services:
whoami:
image: containous/whoami
deploy:
labels:
- traefik.enable=true
- traefik.http.routers.whoami.rule=Host(`mydomain.org`)
- traefik.http.services.whoami-service.loadbalancer.server.port=80
networks:
- traefik-public
#######################
Failed to load resource: the server responded with a status of 502 (Bad Gateway)