Testing whether folder works #26

Open
kovagoadi wants to merge 28 commits from add-route-to-staging-dev into main
6 changed files with 118 additions and 6 deletions

View File

@@ -5,5 +5,5 @@ 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
ACME_BYPASS=false ACME_BYPASS=false
TRAEFIK_LEGACY_OPT= # TRAEFIK_LEGACY_OPT=
# TRAEFIK_LEGACY_OPT="--providers.file.filename=/etc/traefik/forward-to-legacy-nginx.yaml" TRAEFIK_LEGACY_OPT="--providers.file.directory=/etc/traefik"

View File

@@ -0,0 +1,47 @@
# ./traefik/forward-to-legacy-nginx.yaml
tcp:
routers:
# Router for HTTPS (Passthrough)
nginx-legacy-router-secure:
rule: "HostSNI(`*`)"
service: nginx-legacy-service-secure
# Passthrough must be true for SSL to reach Nginx encrypted
tls:
passthrough: true
priority: 10
entryPoints:
- "https"
services:
# Service defining the external IP
nginx-legacy-service-secure:
loadBalancer:
servers:
# This is the actual external IP and Port of your Nginx
- address: "webserver:443"
http:
routers:
# 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:
rule: "HostRegexp(`^.+$`)"
service: nginx-legacy-service
# Low priority ensures specific containers are handled first, but before the default acme-handler
priority: 90
entryPoints:
- "web"
services:
nginx-legacy-service:
loadBalancer:
servers:
- url: "http://webserver:80"

View File

@@ -0,0 +1,30 @@
http:
routers:
# Router for HTTP (Port 80)
staging:
rule: "Host(`staging.kovagoadi.hu`) || Host(`test-whoami.staging.kovagoadi.hu`)"
entryPoints:
- "web"
service: "dev-staging"
priority: 1000000
# Router for HTTPS (Port 443)
staging-secure:
rule: "Host(`staging.kovagoadi.hu`) || Host(`dev.kovagoadi.hu`)"
entryPoints:
- "https"
service: "dev-staging-secure"
priority: 100
tls: {} # <--- This enables TLS for this router
services:
dev-staging:
loadBalancer:
servers:
- url: "http://192.168.1.85:8080"
dev-staging-secure:
loadBalancer:
servers:
# Note: Ensure Traefik trusts the cert at .85 or set insecureSkipVerify
- url: "https://192.168.1.85:445"

View File

@@ -6,7 +6,9 @@ services:
- no-new-privileges:true - no-new-privileges:true
networks: networks:
- proxy - proxy
- legacy-nginx
command: command:
- "--log.level=DEBUG"
- "--providers.docker=true" - "--providers.docker=true"
- "--providers.docker.exposedbydefault=false" - "--providers.docker.exposedbydefault=false"
- "--providers.docker.network=proxy" - "--providers.docker.network=proxy"
@@ -28,7 +30,7 @@ services:
volumes: volumes:
- "/var/run/docker.sock:/var/run/docker.sock:ro" - "/var/run/docker.sock:/var/run/docker.sock:ro"
- "letsencrypt:/letsencrypt" - "letsencrypt:/letsencrypt"
- "./${ENV}/forward-to-legacy-nginx.yaml:/etc/traefik/forward-to-legacy-nginx.yaml" - "./${ENV}:/etc/traefik"
whoami: whoami:
image: "traefik/whoami@sha256:200689790a0a0ea48ca45992e0450bc26ccab5307375b41c84dfc4f2475937ab" image: "traefik/whoami@sha256:200689790a0a0ea48ca45992e0450bc26ccab5307375b41c84dfc4f2475937ab"
@@ -38,9 +40,9 @@ services:
labels: labels:
- "env=${ENV}" - "env=${ENV}"
- "traefik.enable=true" - "traefik.enable=true"
- "traefik.http.routers.whoami.priority=100" - "traefik.http.routers.whoami.priority=1000000"
- "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.priority=1000000"
- "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
@@ -48,5 +50,8 @@ services:
- traefik.http.routers.https.tls.certresolver=letsencrypt - traefik.http.routers.https.tls.certresolver=letsencrypt
networks: networks:
proxy: proxy:
legacy-nginx:
name: proxy
external: true
volumes: volumes:
letsencrypt: letsencrypt:

View File

@@ -5,4 +5,4 @@ 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 ACME_BYPASS=true
TRAEFIK_LEGACY_OPT="--providers.file.filename=/etc/traefik/forward-to-legacy-nginx.yaml" TRAEFIK_LEGACY_OPT="--providers.file.directory=/etc/traefik"

View File

@@ -0,0 +1,30 @@
http:
routers:
# Router for HTTP (Port 80)
staging:
rule: "HostRegexp({subdomain:.+}.staging.kovagoadi.hu`) || Host(`staging.kovagoadi.hu`) || Host(`dev.kovagoadi.hu`)"
entryPoints:
- "web"
service: "dev-staging"
priority: 1_000_000
# Router for HTTPS (Port 443)
staging-secure:
rule: "Host(`staging.kovagoadi.hu`) || Host(`dev.kovagoadi.hu`)"
entryPoints:
- "https"
service: "dev-staging-secure"
priority: 100
tls: {} # <--- This enables TLS for this router
services:
dev-staging:
loadBalancer:
servers:
- url: "http://192.168.1.85:8080"
dev-staging-secure:
loadBalancer:
servers:
# Note: Ensure Traefik trusts the cert at .85 or set insecureSkipVerify
- url: "https://192.168.1.85:445"