Hello there,
I'm pretty new on Traefik and I'm following suggested configurations from documentation nor Traefik Labs. My aim is to deploy Traefik on Swarm as a reverse proxy using stacks.
Currently, I've a whoami subdomain working, but not a new subdomain I'ld set online. Moreover, I lost access to the Traefik dashboard...
Here is my Traefik configuration:
version: '3.8'
services:
# Traefik
traefik:
image: "traefik:v2.4"
container_name: "traefik"
# environment:
# - "constraint:node==wpg1ihqm8eifunr0okeav9908"
deploy:
mode: replicated
replicas: 1
placement:
constraints:
- node.hostname == clu010001
command:
- "--providers.docker=true"
- "--providers.docker.exposedbydefault=false"
- "--providers.docker.swarmMode=true"
- "--providers.docker.endpoint=unix:///var/run/docker.sock"
- "--entrypoints.websecure.address=:443"
- "--entrypoints.web.address=:80"
- "--entrypoints.web.http.redirections.entryPoint.to=websecure"
- "--entrypoints.web.http.redirections.entryPoint.scheme=https"
- "--entrypoints.web.http.redirections.entrypoint.permanent=true"
- "--certificatesresolvers.letsencrypt.acme.tlschallenge=true"
- "--certificatesresolvers.letsencrypt.acme.email=x"
- "--certificatesresolvers.letsencrypt.acme.storage=/letsencrypt/acme.json"
- "--api.dashboard=true"
ports:
- "80:80"
- "443:443"
volumes:
- "./traefik:/letsencrypt"
- "/var/run/docker.sock:/var/run/docker.sock:ro"
labels:
- "traefik.enable=true"
- "traefik.http.routers.dashboard.rule=Host(`traefik.x.dev`)"
- "traefik.http.routers.dashboard.service=api@internal"
- "traefik.http.routers.dashboard.entrypoints=websecure"
- "traefik.http.routers.dashboard.tls.certresolver=letsencrypt"
- "traefik.http.services.dashboard.loadbalancer.server.port=8080"
# - "traefik.http.routers.dashboard.middlewares=auth"
# - "traefik.http.middlewares.auth.basicauth.users=admin:x"
# - "traefik.docker.lbswarm=true"
# Whoami
whoami:
image: "traefik/whoami"
container_name: "simple-service"
deploy:
labels:
- "traefik.enable=true"
- "traefik.http.routers.whoami.rule=Host(`whoami.x.dev`)"
- "traefik.http.routers.whoami.entrypoints=websecure"
- "traefik.http.routers.whoami.tls.certresolver=letsencrypt"
- "traefik.http.services.whoami.loadbalancer.server.port=80"
The constraint I've is data on clu010001 is replicated, and on the other nodes on my Swarm cluster, it isn't. My traffic comes on clu010001 as well, which is why Traefik is constraint on it (for certificates + traffic).
Finally, I've this configuration for the new application I'm trying to host.
version: '3.3'
services:
fireflyiii:
depends_on:
- fireflyiiidb
image: jc5x/firefly-iii:latest
volumes:
- firefly_iii_upload:/var/www/html/storage/upload
env_file: .env_firefly-iii
deploy:
labels:
- "traefik.enable=true"
- "traefik.http.routers.firefly-iii.rule=Host(`compta.x.dev`)"
- "traefik.http.routers.firefly-iii.entrypoints=websecure"
- "traefik.http.routers.firefly-iii.tls.certresolver=letsencrypt"
- "traefik.http.services.firefly-iii.loadbalancer.server.port=8080"
fireflyiiidb:
image: yobasystems/alpine-mariadb:latest
environment:
- MYSQL_RANDOM_ROOT_PASSWORD=yes
- MYSQL_USER=x
- MYSQL_PASSWORD=x
- MYSQL_DATABASE=x
deploy:
placement:
constraints:
- node.hostname == clu010001
volumes:
- firefly_iii_db:/var/lib/mysql
volumes:
firefly_iii_upload:
firefly_iii_db:
The Traefik logs in info isn't very expressive about traffic issues...
time="2021-03-11T10:36:17Z" level=info msg="Configuration loaded from flags."
And dashboard supposed be accessible at traefik.x.dev/dashboard**/** retrieve a 404 not found
error. The application I'm trying to host is also unavailable, but with a Gateway Timeout
...
Since Traefik was working until the deployment of my new app, I think there may be a conflict between them, but I don't see it.
Moreover, if you've a configuration to access directly at Traefik's dashboard from traefik.x.dev, without setting /dashboard/, I'll take it too
Thanks !