Hey,
I am attempting to route Wordpress traffic through a load balanced Traefik.
I have a 4 node swarm, 1 manager and 3 workers. The manager has a NFS shared volume which is mounted in the same spot on all 3 workers.
Here is the relevant docker compose (kept it super simple for my test run):
version: '3.9'
services:
wordpress:
depends_on:
- db
- traefik
image: wordpress:latest
environment:
WORDPRESS_DB_HOST: db:3306
WORDPRESS_DB_USER:
WORDPRESS_DB_PASSWORD:
WORDPRESS_DB_NAME: wordpress
volumes:
- /mnt/nfsshare/wordpress:/var/www/html
deploy:
replicas: 1
placement:
constraints: [node.role != manager]
labels:
- traefik.enable=true
- traefik.http.routers.tattooedbrogrammer.rule=Host(`mywebsite.com`)
- traefik.http.routers.tattooedbrogrammer.entrypoints=websecure
- traefik.http.routers.tattooedbrogrammer.tls=true
- traefik.http.routers.tattooedbrogrammer.tls.certresolver=myresolver
- traefik.http.services.tattooedbrogrammer-svc.loadbalancer.server.port=80
db:
image: mariadb:latest
environment:
MYSQL_DATABASE: wordpress
MYSQL_USER:
MYSQL_ROOT_PASSWORD:
MYSQL_PASSWORD:
volumes:
- db_data:/var/lib/mysql
deploy:
replicas: 1
placement:
constraints: [node.role == manager]
traefik:
image: traefik:latest
ports:
- "80:80"
- "443:443"
- "8080:8080"
volumes:
- "/mnt/nfsshare/traefik/traefik.yml:/etc/traefik/traefik.yml"
- "/mnt/nfsshare/letsencrypt:/letsencrypt"
- "/var/run/docker.sock:/var/run/docker.sock"
volumes:
db_data: {}
and in /mnt/nfsshare/traefik/traefik.yml I have the following config:
## traefik.yml
# Docker configuration backend
providers:
docker:
watch: true
endpoint: "unix:///var/run/docker.sock"
exposedByDefault: false
swarmMode: true
# network: traefik-public"
#swarmModeRefreshSeconds: 5
logLevel: DEBUG
## Static configuration
entryPoints:
http:
address: ":80"
web:
redirections:
entryPoint:
to: websecure
scheme: https
websecure:
address: ":443"
tls: {}
certificatesResolvers:
myresolver:
acme:
email: admin@example.com
storage: /letsencrypt/acme.json
entryPoint: "https"
tlsChallenge: {}
# API and dashboard configuration
api:
insecure: true
Once deployed to the cluster, I get 1/1 replicated traefik and 1/1 replicated Wordpress service.
However the wordpress instance is not accessible via the web, and when I visit the dashboard on 8080, the router for tattooedbrogrammer does not exist.
I can confirm the yaml file on the worker node is correct through the nfs4 share:
What have I done wrong?