Hello
I'm trying to deploy Traefik v2.x (latest 2.1.6) with Consul to handle the ssl certs and config storage, but is not working completely.
I'm having weird issues and hard troubleshooting.
with v1.7, I could use simply port 80 and point traefik to traefik.mydomain and consul.mydomain, done, all secure with https
now with 2.1.6, it's not working anymore.
I'm forced to use port 8080 like traefik.mydomain:8080 and only http
when I try consul.mydomain, it just return error 404 from traefik
In v1.7, my auth protection was also working just fine. With 2.x, it just ignores it and the dashboards are reachable without having to login anywhere.
I have tried so many config examples, all of them handle things differently which makes it hard to understand which is the right concept or not.
Is there anybody can lend me helping hand to get my basics covered so I can start enjoying my this again?
This is my docker-compose file
version: '3.3'
services:
traefik:
image: traefik:2.1.6
ports:
- 80:80
- 443:443
deploy:
labels:
- "traefik.enable=true"
- "traefik.http.routers.traefik_dashboard.rule=Host(`traefik.${DOMAIN}`) && (PathPrefix(`/api`) || PathPrefix(`/dashboard`))"
- "traefik.http.routers.api.service=api@internal"
- "traefik.http.routers.api.middlewares=auth"
- "traefik.http.middlewares.auth.basicauth.users=${USERNAME}:${HASHED_PASSWORD}"
replicas: ${TRAEFIK_REPLICAS:-1}
placement:
constraints:
- node.role == manager
preferences:
- spread: node.id
command:
- --log.level=DEBUG
- --entrypoints.web.address=:80
- --api=true
- --api.dashboard=true
- --providers.docker=true
- --providers.docker.exposedbydefault=false
- --providers.docker.swarmMode=true
- --providers.docker.network=traefik-public
- '--providers.docker.defaultRule=Host(`traefik.${DOMAIN}`)'
- --accesslog=true
- --accessLog.filePath=/var/log/access.log
- --accessLog.format=json
- --accesslog.bufferingsize=100
- --accessLog.fields.names.ClientHost=redact
- --accessLog.fields.names.BackendAddr=keep
- --accessLog.fields.names.BackendName=keep
- --accessLog.fields.names.FrontendName=keep
- --ping
- --metrics=true
- --tracing=true
- --tracing.jaeger=true
- --tracing.jaeger.samplingServerURL=http://localhost:5778/sampling
- --tracing.jaeger.samplingType=const
- --tracing.jaeger.samplingParam=1.0
- --tracing.jaeger.localAgentHostPort=127.0.0.1:6831
- --tracing.jaeger.propagation=jaeger
- --tracing.jaeger.traceContextHeaderName=uber-trace-id
- --tracing.jaeger.collector.endpoint=http://127.0.0.1:14268/api/traces?format=jaeger.thrift
volumes:
- /var/run/docker.sock:/var/run/docker.sock
networks:
- traefik-public
# Consul Leader configuration
consul-leader:
image: consul
command: agent -server -client=0.0.0.0 -bootstrap -ui
volumes:
- consul-data-leader:/consul/data
environment:
- CONSUL_BIND_INTERFACE=eth0
- 'CONSUL_LOCAL_CONFIG={"leave_on_terminate": true}'
networks:
- traefik-public
deploy:
labels:
- "traefik.enable=true"
- "traefik.http.routers.consul-leader.rule=Host(`consul.${DOMAIN}`)"
- "traefik.http.services.consul-leader.loadbalancer.server.port=8500"
# configuration for consul replica
consul-replica:
image: consul
command: agent -server -client=0.0.0.0 -retry-join="consul-leader"
volumes:
- consul-data-replica:/consul/data
environment:
- CONSUL_BIND_INTERFACE=eth0
- 'CONSUL_LOCAL_CONFIG={"leave_on_terminate": true}'
networks:
- traefik-public
deploy:
replicas: ${CONSUL_REPLICAS:-3}
placement:
preferences:
- spread: node.id
volumes:
consul-data-leader:
consul-data-replica:
networks:
traefik-public:
external: true
Thanks!