feat: nginx를 Traefik v3.2로 교체
- Docker 라벨 기반 자동 라우팅으로 전환 - /admin/* → admin 서비스 (StripPrefix 미들웨어) - /* → web 서비스 (catch-all) - Let's Encrypt 설정 준비 (도메인 확보 시 활성화) - 다른 서비스 추가 시 라벨만 붙이면 자동 등록 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,21 @@
|
|||||||
|
api:
|
||||||
|
dashboard: false
|
||||||
|
|
||||||
|
entryPoints:
|
||||||
|
web:
|
||||||
|
address: ":80"
|
||||||
|
websecure:
|
||||||
|
address: ":443"
|
||||||
|
|
||||||
|
providers:
|
||||||
|
docker:
|
||||||
|
exposedByDefault: false
|
||||||
|
|
||||||
|
# 도메인 준비되면 주석 해제
|
||||||
|
# certificatesResolvers:
|
||||||
|
# letsencrypt:
|
||||||
|
# acme:
|
||||||
|
# email: your-email@example.com
|
||||||
|
# storage: /letsencrypt/acme.json
|
||||||
|
# httpChallenge:
|
||||||
|
# entryPoint: web
|
||||||
+28
-13
@@ -30,6 +30,20 @@ services:
|
|||||||
timeout: 5s
|
timeout: 5s
|
||||||
retries: 5
|
retries: 5
|
||||||
|
|
||||||
|
traefik:
|
||||||
|
image: traefik:v3.2
|
||||||
|
restart: unless-stopped
|
||||||
|
ports:
|
||||||
|
- "80:80"
|
||||||
|
- "443:443"
|
||||||
|
volumes:
|
||||||
|
- /var/run/docker.sock:/var/run/docker.sock:ro
|
||||||
|
- ./deploy/traefik/traefik.yml:/etc/traefik/traefik.yml:ro
|
||||||
|
- traefik_letsencrypt:/letsencrypt
|
||||||
|
depends_on:
|
||||||
|
- web
|
||||||
|
- admin
|
||||||
|
|
||||||
web:
|
web:
|
||||||
build:
|
build:
|
||||||
context: .
|
context: .
|
||||||
@@ -45,6 +59,12 @@ services:
|
|||||||
NEXTAUTH_URL: ${NEXTAUTH_URL:-http://localhost:3000}
|
NEXTAUTH_URL: ${NEXTAUTH_URL:-http://localhost:3000}
|
||||||
NEXTAUTH_SECRET: ${NEXTAUTH_SECRET:?NEXTAUTH_SECRET is required}
|
NEXTAUTH_SECRET: ${NEXTAUTH_SECRET:?NEXTAUTH_SECRET is required}
|
||||||
NODE_ENV: production
|
NODE_ENV: production
|
||||||
|
labels:
|
||||||
|
- "traefik.enable=true"
|
||||||
|
- "traefik.http.routers.web.rule=PathPrefix(`/`)"
|
||||||
|
- "traefik.http.routers.web.entrypoints=web"
|
||||||
|
- "traefik.http.routers.web.priority=1"
|
||||||
|
- "traefik.http.services.web.loadbalancer.server.port=3000"
|
||||||
depends_on:
|
depends_on:
|
||||||
postgres:
|
postgres:
|
||||||
condition: service_healthy
|
condition: service_healthy
|
||||||
@@ -64,25 +84,20 @@ services:
|
|||||||
DATABASE_URL: postgresql://${DB_USER:-relink}:${DB_PASSWORD}@postgres:5432/${DB_NAME:-relink_prod}?schema=public
|
DATABASE_URL: postgresql://${DB_USER:-relink}:${DB_PASSWORD}@postgres:5432/${DB_NAME:-relink_prod}?schema=public
|
||||||
REDIS_URL: redis://:${REDIS_PASSWORD}@redis:6379
|
REDIS_URL: redis://:${REDIS_PASSWORD}@redis:6379
|
||||||
NODE_ENV: production
|
NODE_ENV: production
|
||||||
|
labels:
|
||||||
|
- "traefik.enable=true"
|
||||||
|
- "traefik.http.routers.admin.rule=PathPrefix(`/admin`)"
|
||||||
|
- "traefik.http.routers.admin.entrypoints=web"
|
||||||
|
- "traefik.http.routers.admin.middlewares=admin-strip"
|
||||||
|
- "traefik.http.middlewares.admin-strip.stripprefix.prefixes=/admin"
|
||||||
|
- "traefik.http.services.admin.loadbalancer.server.port=3000"
|
||||||
depends_on:
|
depends_on:
|
||||||
postgres:
|
postgres:
|
||||||
condition: service_healthy
|
condition: service_healthy
|
||||||
redis:
|
redis:
|
||||||
condition: service_healthy
|
condition: service_healthy
|
||||||
|
|
||||||
nginx:
|
|
||||||
image: nginx:alpine
|
|
||||||
restart: unless-stopped
|
|
||||||
ports:
|
|
||||||
- "80:80"
|
|
||||||
- "443:443"
|
|
||||||
volumes:
|
|
||||||
- ./deploy/nginx/default.conf:/etc/nginx/conf.d/default.conf:ro
|
|
||||||
- ./deploy/nginx/ssl:/etc/nginx/ssl:ro
|
|
||||||
depends_on:
|
|
||||||
- web
|
|
||||||
- admin
|
|
||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
postgres_data:
|
postgres_data:
|
||||||
redis_data:
|
redis_data:
|
||||||
|
traefik_letsencrypt:
|
||||||
|
|||||||
Reference in New Issue
Block a user