Initial migration from legacy nginx (#11)
All checks were successful
Remote Deployment Pipeline / Prepare deployment vars (push) Successful in 2s
Remote Deployment Pipeline / Create remote directory (push) Successful in 5s
Remote Deployment Pipeline / Cleanup MR environment (push) Has been skipped
Remote Deployment Pipeline / Sync repository files (push) Successful in 19s
Remote Deployment Pipeline / Run docker-compose remotely (Dev) (push) Has been skipped
Remote Deployment Pipeline / Run docker-compose remotely (Staging) (push) Successful in 11s
Remote Deployment Pipeline / Run docker-compose remotely (Prod) (push) Successful in 10s

Reviewed-on: #11
Co-authored-by: kovagoadi <kovagoadi@gmail.com>
Co-committed-by: kovagoadi <kovagoadi@gmail.com>
This commit is contained in:
2025-11-27 23:58:43 +01:00
committed by kovagoadi
parent 931008367d
commit 2702b73798
5 changed files with 74 additions and 5 deletions

View File

@@ -1,3 +1,7 @@
PORT=898 PORT=898
HTTPS_PORT=446
ENV=dev ENV=dev
NETWORK_NAME=proxy NETWORK_NAME=proxy
CERTBOT_CA_RESOLVER=https://acme-staging-v02.api.letsencrypt.org/directory
DOMAIN=dev.kovagoadi.hu
TRAEFIK_LEGACY_OPT=

View File

@@ -1,23 +1,34 @@
services: services:
traefik: traefik:
image: "traefik:v3.6@sha256:aaf0f6185419a50c74651448c1a5bf4606bd2d2ddb7b8749eed505d55bf8b8ea" image: "traefik:v3.6@sha256:aaf0f6185419a50c74651448c1a5bf4606bd2d2ddb7b8749eed505d55bf8b8ea"
# container_name: "traefik"
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"
- "--providers.docker.network=proxy" - "--providers.docker.network=proxy"
- "--providers.docker.constraints=Label(`env`, `${ENV}`)" - "--providers.docker.constraints=Label(`env`, `${ENV}`)"
- "--entryPoints.web.address=:80" - "--entryPoints.web.address=:80"
- "--entryPoints.https.address=:443"
- "--certificatesresolvers.letsencrypt.acme.httpchallenge=true"
- "--certificatesresolvers.letsencrypt.acme.httpchallenge.entrypoint=web"
- "--certificatesresolvers.letsencrypt.acme.email=kovagoadi@gmail.com"
- "--certificatesresolvers.letsencrypt.acme.storage=/letsencrypt/acme.json"
- "--certificatesResolvers.letsencrypt.acme.caServer=${CERTBOT_CA_RESOLVER}"
- "${TRAEFIK_LEGACY_OPT:-}"
- "--providers.file.watch=true"
ports: ports:
- "${PORT}:80" - "${PORT}:80"
- "${HTTPS_PORT}:443"
- "8080" - "8080"
volumes: volumes:
- "/var/run/docker.sock:/var/run/docker.sock:ro" - "/var/run/docker.sock:/var/run/docker.sock:ro"
- "./data/letsencrypt:/letsencrypt"
- "./${ENV}/forward-to-legacy-nginx.yaml:/etc/traefik/forward-to-legacy-nginx.yaml"
whoami: whoami:
image: "traefik/whoami@sha256:200689790a0a0ea48ca45992e0450bc26ccab5307375b41c84dfc4f2475937ab" image: "traefik/whoami@sha256:200689790a0a0ea48ca45992e0450bc26ccab5307375b41c84dfc4f2475937ab"
@@ -27,7 +38,14 @@ services:
labels: labels:
- "env=${ENV}" - "env=${ENV}"
- "traefik.enable=true" - "traefik.enable=true"
- "traefik.http.routers.whoami.rule=Host(`whoami.docker.localhost`)" - "traefik.http.routers.whoami.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.tls=true
- traefik.http.routers.https.tls.certresolver=letsencrypt
networks: networks:
proxy: proxy:
legacy-nginx:
name: proxy
external: true

View File

@@ -1,3 +1,7 @@
PORT=81 PORT=81
HTTPS_PORT=444
ENV=prod ENV=prod
NETWORK_NAME=proxy NETWORK_NAME=proxy
CERTBOT_CA_RESOLVER=https://acme-v02.api.letsencrypt.org/directory
DOMAIN=kovagoadi.hu
TRAEFIK_LEGACY_OPT="--providers.file.filename=/etc/traefik/forward-to-legacy-nginx.yaml"

View File

@@ -0,0 +1,39 @@
# ./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: 1
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:
# Router for HTTP
nginx-legacy-router:
rule: "HostRegexp(`^.+$`)"
service: nginx-legacy-service
# Low priority ensures specific containers are handled first
priority: 1
entryPoints:
- "web"
services:
nginx-legacy-service:
loadBalancer:
servers:
- url: "http://webserver:80"

View File

@@ -1,3 +1,7 @@
PORT=8080 PORT=8080
HTTPS_PORT=445
ENV=staging ENV=staging
NETWORK_NAME=proxy NETWORK_NAME=proxy
CERTBOT_CA_RESOLVER=https://acme-staging-v02.api.letsencrypt.org/directory
DOMAIN=staging.kovagoadi.hu
TRAEFIK_LEGACY_OPT=