chore(traefik): migrate compose overrides to v3 traefik

This commit is contained in:
Rocket-Quack 2026-01-16 12:52:20 +01:00
parent bc254c2b4c
commit 8afa5d60f5
7 changed files with 140 additions and 133 deletions

View file

@ -14,7 +14,8 @@ services:
- traefik.http.services.${ROUTER?ROUTER not set}.loadbalancer.server.port=2016 - traefik.http.services.${ROUTER?ROUTER not set}.loadbalancer.server.port=2016
- traefik.http.routers.${ROUTER}.service=${ROUTER} - traefik.http.routers.${ROUTER}.service=${ROUTER}
- traefik.http.routers.${ROUTER}.entrypoints=http - traefik.http.routers.${ROUTER}.entrypoints=http
- traefik.http.routers.${ROUTER}.rule=Host(${SITES?SITES not set}) - traefik.http.routers.${ROUTER}.ruleSyntax=v3
- traefik.http.routers.${ROUTER}.rule=${SITES_RULE?SITES_RULE not set}
- traefik.http.middlewares.${ROUTER}.headers.customrequestheaders.Host=${BASE_SITE?BASE_SITE not set} - traefik.http.middlewares.${ROUTER}.headers.customrequestheaders.Host=${BASE_SITE?BASE_SITE not set}
- traefik.http.routers.${ROUTER}.middlewares=${ROUTER} - traefik.http.routers.${ROUTER}.middlewares=${ROUTER}
networks: networks:

View file

@ -1,32 +1,33 @@
services: services:
frontend: frontend:
labels: labels:
- traefik.enable=true - traefik.enable=true
- traefik.http.services.frontend.loadbalancer.server.port=8080 - traefik.http.services.frontend.loadbalancer.server.port=8080
- traefik.http.routers.frontend-http.entrypoints=websecure - traefik.http.routers.frontend-http.entrypoints=websecure
- traefik.http.routers.frontend-http.tls.certresolver=main-resolver - traefik.http.routers.frontend-http.tls.certresolver=main-resolver
- traefik.http.routers.frontend-http.rule=Host(${SITES:?List of sites not set}) - traefik.http.routers.frontend-http.ruleSyntax=v3
- traefik.http.routers.frontend-http.rule=${SITES_RULE:?SITES_RULE not set}
proxy:
image: traefik:v2.11 proxy:
restart: unless-stopped image: traefik:v3.6
command: restart: unless-stopped
- --providers.docker=true command:
- --providers.docker.exposedbydefault=false - --providers.docker=true
- --entrypoints.web.address=:80 - --providers.docker.exposedbydefault=false
- --entrypoints.web.http.redirections.entrypoint.to=websecure - --entrypoints.web.address=:80
- --entrypoints.web.http.redirections.entrypoint.scheme=https - --entrypoints.web.http.redirections.entrypoint.to=websecure
- --entrypoints.websecure.address=:443 - --entrypoints.web.http.redirections.entrypoint.scheme=https
- --certificatesResolvers.main-resolver.acme.httpChallenge=true - --entrypoints.websecure.address=:443
- --certificatesResolvers.main-resolver.acme.httpChallenge.entrypoint=web - --certificatesResolvers.main-resolver.acme.httpChallenge=true
- --certificatesResolvers.main-resolver.acme.email=${LETSENCRYPT_EMAIL:?No Let's Encrypt email set} - --certificatesResolvers.main-resolver.acme.httpChallenge.entrypoint=web
- --certificatesResolvers.main-resolver.acme.storage=/letsencrypt/acme.json - --certificatesResolvers.main-resolver.acme.email=${LETSENCRYPT_EMAIL:?No Let's Encrypt email set}
ports: - --certificatesResolvers.main-resolver.acme.storage=/letsencrypt/acme.json
- ${HTTP_PUBLISH_PORT:-80}:80 ports:
- ${HTTPS_PUBLISH_PORT:-443}:443 - ${HTTP_PUBLISH_PORT:-80}:80
volumes: - ${HTTPS_PUBLISH_PORT:-443}:443
- cert-data:/letsencrypt volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro - cert-data:/letsencrypt
- /var/run/docker.sock:/var/run/docker.sock:ro
volumes:
cert-data: volumes:
cert-data:

View file

@ -4,8 +4,9 @@ services:
# ${ROUTER}-http to use the middleware to redirect to https # ${ROUTER}-http to use the middleware to redirect to https
- traefik.http.routers.${ROUTER}-http.middlewares=https-redirect - traefik.http.routers.${ROUTER}-http.middlewares=https-redirect
# ${ROUTER}-https the actual router using HTTPS # ${ROUTER}-https the actual router using HTTPS
# Uses the environment variable SITES # Uses the environment variable SITES_RULE
- traefik.http.routers.${ROUTER}-https.rule=Host(${SITES?SITES not set}) - traefik.http.routers.${ROUTER}-https.ruleSyntax=v3
- traefik.http.routers.${ROUTER}-https.rule=${SITES_RULE?SITES_RULE not set}
- traefik.http.routers.${ROUTER}-https.entrypoints=https - traefik.http.routers.${ROUTER}-https.entrypoints=https
- traefik.http.routers.${ROUTER}-https.tls=true - traefik.http.routers.${ROUTER}-https.tls=true
# Use the service ${ROUTER} with the frontend # Use the service ${ROUTER} with the frontend

View file

@ -9,7 +9,8 @@ services:
- traefik.http.services.${ROUTER?ROUTER not set}.loadbalancer.server.port=8080 - traefik.http.services.${ROUTER?ROUTER not set}.loadbalancer.server.port=8080
- traefik.http.routers.${ROUTER}-http.service=${ROUTER} - traefik.http.routers.${ROUTER}-http.service=${ROUTER}
- traefik.http.routers.${ROUTER}-http.entrypoints=http - traefik.http.routers.${ROUTER}-http.entrypoints=http
- traefik.http.routers.${ROUTER}-http.rule=Host(${SITES?SITES not set}) - traefik.http.routers.${ROUTER}-http.ruleSyntax=v3
- traefik.http.routers.${ROUTER}-http.rule=${SITES_RULE?SITES_RULE not set}
configurator: configurator:
networks: networks:
- bench-network - bench-network

View file

@ -1,19 +1,20 @@
services: services:
frontend: frontend:
labels: labels:
- traefik.enable=true - traefik.enable=true
- traefik.http.services.frontend.loadbalancer.server.port=8080 - traefik.http.services.frontend.loadbalancer.server.port=8080
- traefik.http.routers.frontend-http.entrypoints=web - traefik.http.routers.frontend-http.entrypoints=web
- traefik.http.routers.frontend-http.rule=HostRegexp(`{any:.+}`) - traefik.http.routers.frontend-http.ruleSyntax=v3
- traefik.http.routers.frontend-http.rule=HostRegexp(`^.+$`)
proxy:
image: traefik:v2.11 proxy:
command: image: traefik:v3.6
- --providers.docker command:
- --providers.docker.exposedbydefault=false - --providers.docker
- --entrypoints.web.address=:80 - --providers.docker.exposedbydefault=false
ports: - --entrypoints.web.address=:80
- ${HTTP_PUBLISH_PORT:-80}:80 ports:
volumes: - ${HTTP_PUBLISH_PORT:-80}:80
- /var/run/docker.sock:/var/run/docker.sock:ro volumes:
userns_mode: host - /var/run/docker.sock:/var/run/docker.sock:ro
userns_mode: host

View file

@ -1,48 +1,49 @@
services: services:
traefik: traefik:
labels: labels:
# https-redirect middleware to redirect HTTP to HTTPS # https-redirect middleware to redirect HTTP to HTTPS
# It can be reused by other stacks in other Docker Compose files # It can be reused by other stacks in other Docker Compose files
- traefik.http.middlewares.https-redirect.redirectscheme.scheme=https - traefik.http.middlewares.https-redirect.redirectscheme.scheme=https
- traefik.http.middlewares.https-redirect.redirectscheme.permanent=true - traefik.http.middlewares.https-redirect.redirectscheme.permanent=true
# traefik-http to use the middleware to redirect to https # traefik-http to use the middleware to redirect to https
- traefik.http.routers.traefik-public-http.middlewares=https-redirect - traefik.http.routers.traefik-public-http.middlewares=https-redirect
# traefik-https the actual router using HTTPS # traefik-https the actual router using HTTPS
# Uses the environment variable DOMAIN # Uses the environment variable DOMAIN
- traefik.http.routers.traefik-public-https.ruleSyntax=v3
- traefik.http.routers.traefik-public-https.rule=Host(`${TRAEFIK_DOMAIN}`) - traefik.http.routers.traefik-public-https.rule=Host(`${TRAEFIK_DOMAIN}`)
- traefik.http.routers.traefik-public-https.entrypoints=https - traefik.http.routers.traefik-public-https.entrypoints=https
- traefik.http.routers.traefik-public-https.tls=true - traefik.http.routers.traefik-public-https.tls=true
# Use the special Traefik service api@internal with the web UI/Dashboard # Use the special Traefik service api@internal with the web UI/Dashboard
- traefik.http.routers.traefik-public-https.service=api@internal - traefik.http.routers.traefik-public-https.service=api@internal
# Use the "le" (Let's Encrypt) resolver created below # Use the "le" (Let's Encrypt) resolver created below
- traefik.http.routers.traefik-public-https.tls.certresolver=le - traefik.http.routers.traefik-public-https.tls.certresolver=le
# Enable HTTP Basic auth, using the middleware created above # Enable HTTP Basic auth, using the middleware created above
- traefik.http.routers.traefik-public-https.middlewares=admin-auth - traefik.http.routers.traefik-public-https.middlewares=admin-auth
command: command:
# Enable Docker in Traefik, so that it reads labels from Docker services # Enable Docker in Traefik, so that it reads labels from Docker services
- --providers.docker=true - --providers.docker=true
# Do not expose all Docker services, only the ones explicitly exposed # Do not expose all Docker services, only the ones explicitly exposed
- --providers.docker.exposedbydefault=false - --providers.docker.exposedbydefault=false
# Create an entrypoint http listening on port 80 # Create an entrypoint http listening on port 80
- --entrypoints.http.address=:80 - --entrypoints.http.address=:80
# Create an entrypoint https listening on port 443 # Create an entrypoint https listening on port 443
- --entrypoints.https.address=:443 - --entrypoints.https.address=:443
# Create the certificate resolver le for Let's Encrypt, uses the environment variable EMAIL # Create the certificate resolver le for Let's Encrypt, uses the environment variable EMAIL
- --certificatesresolvers.le.acme.email=${EMAIL:?No EMAIL set} - --certificatesresolvers.le.acme.email=${EMAIL:?No EMAIL set}
# Store the Let's Encrypt certificates in the mounted volume # Store the Let's Encrypt certificates in the mounted volume
- --certificatesresolvers.le.acme.storage=/certificates/acme.json - --certificatesresolvers.le.acme.storage=/certificates/acme.json
# Use the TLS Challenge for Let's Encrypt # Use the TLS Challenge for Let's Encrypt
- --certificatesresolvers.le.acme.tlschallenge=true - --certificatesresolvers.le.acme.tlschallenge=true
# Enable the access log, with HTTP requests # Enable the access log, with HTTP requests
- --accesslog - --accesslog
# Enable the Traefik log, for configurations and errors # Enable the Traefik log, for configurations and errors
- --log - --log
# Enable the Dashboard and API # Enable the Dashboard and API
- --api - --api
ports: ports:
- ${HTTPS_PUBLISH_PORT:-443}:443 - ${HTTPS_PUBLISH_PORT:-443}:443
volumes: volumes:
- cert-data:/certificates - cert-data:/certificates
volumes: volumes:
cert-data: cert-data:

View file

@ -1,45 +1,46 @@
services: services:
traefik: traefik:
image: "traefik:v2.11" image: "traefik:v3.6"
restart: unless-stopped restart: unless-stopped
labels: labels:
# Enable Traefik for this service, to make it available in the public network # Enable Traefik for this service, to make it available in the public network
- traefik.enable=true - traefik.enable=true
# Use the traefik-public network (declared below) # Use the traefik-public network (declared below)
- traefik.docker.network=traefik-public - traefik.docker.network=traefik-public
# admin-auth middleware with HTTP Basic auth # admin-auth middleware with HTTP Basic auth
# Using the environment variables USERNAME and HASHED_PASSWORD # Using the environment variables USERNAME and HASHED_PASSWORD
- traefik.http.middlewares.admin-auth.basicauth.users=admin:${HASHED_PASSWORD:?No HASHED_PASSWORD set} - traefik.http.middlewares.admin-auth.basicauth.users=admin:${HASHED_PASSWORD:?No HASHED_PASSWORD set}
# Uses the environment variable TRAEFIK_DOMAIN # Uses the environment variable TRAEFIK_DOMAIN
- traefik.http.routers.traefik-public-http.ruleSyntax=v3
- traefik.http.routers.traefik-public-http.rule=Host(`${TRAEFIK_DOMAIN:?No TRAEFIK_DOMAIN set}`) - traefik.http.routers.traefik-public-http.rule=Host(`${TRAEFIK_DOMAIN:?No TRAEFIK_DOMAIN set}`)
- traefik.http.routers.traefik-public-http.entrypoints=http - traefik.http.routers.traefik-public-http.entrypoints=http
# Use the special Traefik service api@internal with the web UI/Dashboard # Use the special Traefik service api@internal with the web UI/Dashboard
- traefik.http.routers.traefik-public-http.service=api@internal - traefik.http.routers.traefik-public-http.service=api@internal
# Enable HTTP Basic auth, using the middleware created above # Enable HTTP Basic auth, using the middleware created above
- traefik.http.routers.traefik-public-http.middlewares=admin-auth - traefik.http.routers.traefik-public-http.middlewares=admin-auth
# Define the port inside of the Docker service to use # Define the port inside of the Docker service to use
- traefik.http.services.traefik-public.loadbalancer.server.port=8080 - traefik.http.services.traefik-public.loadbalancer.server.port=8080
command: command:
# Enable Docker in Traefik, so that it reads labels from Docker services # Enable Docker in Traefik, so that it reads labels from Docker services
- --providers.docker=true - --providers.docker=true
# Do not expose all Docker services, only the ones explicitly exposed # Do not expose all Docker services, only the ones explicitly exposed
- --providers.docker.exposedbydefault=false - --providers.docker.exposedbydefault=false
# Create an entrypoint http listening on port 80 # Create an entrypoint http listening on port 80
- --entrypoints.http.address=:80 - --entrypoints.http.address=:80
# Enable the access log, with HTTP requests # Enable the access log, with HTTP requests
- --accesslog - --accesslog
# Enable the Traefik log, for configurations and errors # Enable the Traefik log, for configurations and errors
- --log - --log
# Enable the Dashboard and API # Enable the Dashboard and API
- --api - --api
ports: ports:
- ${HTTP_PUBLISH_PORT:-80}:80 - ${HTTP_PUBLISH_PORT:-80}:80
volumes: volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro - /var/run/docker.sock:/var/run/docker.sock:ro
networks: networks:
- traefik-public - traefik-public
networks: networks:
traefik-public: traefik-public:
name: traefik-public name: traefik-public
external: false external: false