Compare commits

1 Commits

Author SHA1 Message Date
8c6c01b916 Setup env (#24)
All checks were successful
Remote Deployment Pipeline / Prepare Context (push) Successful in 3s
Remote Deployment Pipeline / Deploy (Staging) (push) Successful in 51s
Remote Deployment Pipeline / Deploy (Dev/Preview) (push) Has been skipped
Remote Deployment Pipeline / Cleanup Preview (push) Has been skipped
Remote Deployment Pipeline / Deploy (Production) (push) Successful in 1m1s
Reviewed-on: #24
Co-authored-by: kovagoadi <kovagoadi@gmail.com>
Co-committed-by: kovagoadi <kovagoadi@gmail.com>
2025-12-20 15:12:51 +01:00
6 changed files with 23 additions and 68 deletions

View File

@@ -4,4 +4,6 @@ ENV=dev
NETWORK_NAME=proxy NETWORK_NAME=proxy
CERTBOT_CA_RESOLVER=https://acme-staging-v02.api.letsencrypt.org/directory CERTBOT_CA_RESOLVER=https://acme-staging-v02.api.letsencrypt.org/directory
DOMAIN=dev.kovagoadi.hu DOMAIN=dev.kovagoadi.hu
TRAEFIK_LEGACY_OPT="--providers.file.filename=/etc/traefik/forward-to-legacy-nginx.yaml" ACME_BYPASS=false
TRAEFIK_LEGACY_OPT=
# TRAEFIK_LEGACY_OPT="--providers.file.filename=/etc/traefik/forward-to-legacy-nginx.yaml"

View File

@@ -1,56 +0,0 @@
# ./traefik/forward-to-legacy-nginx.yaml
# static configuration (traefik.yml)
# entryPoints:
# web:
# address: ":80" # or :898 in your case
# allowACMEByPass: true # <--- WITHOUT THIS, TRAEFIK ALWAYS WINS
# https:
# address: ":443"
# certificatesResolvers:
# letsencrypt:
# acme:
# email: "kovagoadi@gmail.com"
# storage: "acme.json"
# httpChallenge:
# entryPoint: web
tcp:
routers:
# Router for LEGACY HTTPS (Passthrough)
nginx-legacy-router-secure:
# DO NOT use "*". List the domains that Nginx manages itself.
# If you use "*", Traefik's own HTTPS domains will not work.
rule: "HostSNI(`excali.kovagoadi.hu`) || HostSNI(`another-legacy.hu`)"
service: nginx-legacy-service-secure
tls:
passthrough: true
priority: 1
entryPoints:
- "https"
services:
nginx-legacy-service-secure:
loadBalancer:
servers:
- address: "webserver:443"
http:
routers:
# 1. TRAEFIK-MANAGED ACME HANDLER (Removed manual router)
# 2. THE HTTP CATCH-ALL (Sends other ACME and HTTP to Nginx)
nginx-legacy-router:
rule: "HostRegexp(`^.+$`)"
service: nginx-legacy-service
entryPoints:
- "web"
priority: 1
services:
nginx-legacy-service:
loadBalancer:
servers:
- url: "http://webserver:80"

View File

@@ -1,12 +1,11 @@
services: services:
traefik3: traefik:
image: "traefik:v3.6@sha256:67622638cd88dbfcfba40159bc652ecf0aea0e032f8a3c7e3134ae7c037b9910" image: "traefik:v3.6@sha256:67622638cd88dbfcfba40159bc652ecf0aea0e032f8a3c7e3134ae7c037b9910"
restart: unless-stopped restart: unless-stopped
security_opt: security_opt:
- no-new-privileges:true - no-new-privileges:true
networks: networks:
- proxy - proxy
- legacy-nginx
command: command:
- "--providers.docker=true" - "--providers.docker=true"
- "--providers.docker.exposedbydefault=false" - "--providers.docker.exposedbydefault=false"
@@ -14,11 +13,12 @@ services:
- "--providers.docker.constraints=Label(`env`, `${ENV}`)" - "--providers.docker.constraints=Label(`env`, `${ENV}`)"
- "--entryPoints.web.address=:80" - "--entryPoints.web.address=:80"
- "--entryPoints.https.address=:443" - "--entryPoints.https.address=:443"
- "--entryPoints.web.allowACMEByPass=true" - "--entryPoints.web.allowACMEByPass=${ACME_BYPASS}"
- "--certificatesresolvers.letsencrypt.acme.httpchallenge=true" - "--certificatesresolvers.letsencrypt.acme.httpchallenge=true"
- "--certificatesresolvers.letsencrypt.acme.httpchallenge.entrypoint=web" - "--certificatesresolvers.letsencrypt.acme.httpchallenge.entrypoint=web"
- "--certificatesresolvers.letsencrypt.acme.email=kovagoadi@gmail.com" - "--certificatesresolvers.letsencrypt.acme.email=kovagoadi@gmail.com"
- "--certificatesresolvers.letsencrypt.acme.storage=/letsencrypt/acme.json" - "--certificatesresolvers.letsencrypt.acme.storage=/letsencrypt/acme.json"
- "--certificatesResolvers.letsencrypt.acme.caServer=${CERTBOT_CA_RESOLVER}"
- "${TRAEFIK_LEGACY_OPT:-}" - "${TRAEFIK_LEGACY_OPT:-}"
- "--providers.file.watch=true" - "--providers.file.watch=true"
ports: ports:
@@ -38,16 +38,15 @@ services:
labels: labels:
- "env=${ENV}" - "env=${ENV}"
- "traefik.enable=true" - "traefik.enable=true"
- "traefik.http.routers.whoami.priority=10000" - "traefik.http.routers.whoami.priority=100"
- "traefik.http.routers.whoami.rule=Host(`test-whoami.${DOMAIN}`)" - "traefik.http.routers.whoami.rule=Host(`test-whoami.${DOMAIN}`)"
- "traefik.http.routers.https.priority=100"
- "traefik.http.routers.https.rule=Host(`test-whoami.${DOMAIN}`)" - "traefik.http.routers.https.rule=Host(`test-whoami.${DOMAIN}`)"
- "traefik.http.routers.whoami.entrypoints=web" - "traefik.http.routers.whoami.entrypoints=web"
- traefik.http.routers.https.entrypoints=https - traefik.http.routers.https.entrypoints=https
- traefik.http.routers.https.tls=true - traefik.http.routers.https.tls=true
- traefik.http.routers.https.tls.certresolver=letsencrypt
networks: networks:
proxy: proxy:
legacy-nginx:
name: proxy
external: true
volumes: volumes:
letsencrypt: letsencrypt:

View File

@@ -4,4 +4,5 @@ ENV=prod
NETWORK_NAME=proxy NETWORK_NAME=proxy
CERTBOT_CA_RESOLVER=https://acme-v02.api.letsencrypt.org/directory CERTBOT_CA_RESOLVER=https://acme-v02.api.letsencrypt.org/directory
DOMAIN=kovagoadi.hu DOMAIN=kovagoadi.hu
ACME_BYPASS=true
TRAEFIK_LEGACY_OPT="--providers.file.filename=/etc/traefik/forward-to-legacy-nginx.yaml" TRAEFIK_LEGACY_OPT="--providers.file.filename=/etc/traefik/forward-to-legacy-nginx.yaml"

View File

@@ -9,7 +9,7 @@ tcp:
# Passthrough must be true for SSL to reach Nginx encrypted # Passthrough must be true for SSL to reach Nginx encrypted
tls: tls:
passthrough: true passthrough: true
priority: 1 priority: 10
entryPoints: entryPoints:
- "https" - "https"
@@ -23,12 +23,20 @@ tcp:
http: http:
routers: routers:
# Router for HTTP # 1. TRAEFIK-MANAGED ACME HANDLER (Removed manual router)
traefik-acme-handler:
rule: "Host(`test-whoami.kovagoadi.hu`) && PathPrefix(`/.well-known/acme-challenge/`)"
entryPoints:
- "web"
service: "acme-http@internal" # This is the internal service name
priority: 1000 # High priority to ensure it wins
# 2. THE HTTP CATCH-ALL (Sends other ACME and HTTP to Nginx)
nginx-legacy-router: nginx-legacy-router:
rule: "HostRegexp(`^.+$`)" rule: "HostRegexp(`^.+$`)"
service: nginx-legacy-service service: nginx-legacy-service
# Low priority ensures specific containers are handled first # Low priority ensures specific containers are handled first, but before the default acme-handler
priority: 1 priority: 90
entryPoints: entryPoints:
- "web" - "web"

View File

@@ -4,4 +4,5 @@ ENV=staging
NETWORK_NAME=proxy NETWORK_NAME=proxy
CERTBOT_CA_RESOLVER=https://acme-staging-v02.api.letsencrypt.org/directory CERTBOT_CA_RESOLVER=https://acme-staging-v02.api.letsencrypt.org/directory
DOMAIN=staging.kovagoadi.hu DOMAIN=staging.kovagoadi.hu
ACME_BYPASS=false
TRAEFIK_LEGACY_OPT= TRAEFIK_LEGACY_OPT=