This commit is contained in:
2026-07-29 12:43:22 +02:00
parent b5c7c5305a
commit a498a51cf9
+66 -24
View File
@@ -1,48 +1,90 @@
# wiki-tcg — replaces the previous docker-compose.yml, which did not describe
# the deployment (findings-02 §5.4).
#
# Networks:
# proxy - shared, created outside compose. NPM meets front-facing
# containers here. Also used by other stacks later.
# tcg-internal - private. Only the backend and the database. Marked internal,
# so the database has no route off this network at all.
#
# Deploy: docker compose up -d --build
# Migrate: docker compose run --rm backend alembic upgrade head
services: services:
db: db:
image: postgres:16 image: postgres:16
container_name: wikitcg-db container_name: wikitcg-db
restart: unless-stopped restart: unless-stopped
environment: environment:
POSTGRES_USER: wikitcg
POSTGRES_PASSWORD: ${DB_PASSWORD}
POSTGRES_DB: wikitcg POSTGRES_DB: wikitcg
POSTGRES_USER: wikitcg
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:?set POSTGRES_PASSWORD in .env}
PGDATA: /var/lib/postgresql/data
TZ: Europe/Paris
volumes: volumes:
- /mnt/user/appdata/wikitcg/postgres:/var/lib/postgresql/data # EXACT path from the running container. /mnt/cache, NOT /mnt/user —
# this deliberately bypasses Unraid's FUSE layer. Do not "correct" it.
- /mnt/cache/appdata/postgresql16:/var/lib/postgresql/data
networks: networks:
- wikitcg - tcg-internal
# No ports. The database is unreachable from the host and the LAN.
healthcheck:
test: ["CMD-SHELL", "pg_isready -U wikitcg -d wikitcg"]
interval: 10s
timeout: 5s
retries: 5
start_period: 30s
backend: backend:
build: ./backend build:
context: ./backend
dockerfile: dockerfile
image: wikitcg-backend
container_name: wikitcg-backend container_name: wikitcg-backend
restart: unless-stopped restart: unless-stopped
depends_on:
- db
environment: environment:
DATABASE_URL: postgresql://wikitcg:${DB_PASSWORD}@db/wikitcg # Runtime connection — DML only, cannot alter schema.
JWT_SECRET_KEY: ${JWT_SECRET_KEY} DATABASE_URL: postgresql://wikitcg_app:${APP_DB_PASSWORD:?}@db:5432/wikitcg
RESEND_API_KEY: ${RESEND_API_KEY} # Migrations only. Owns the schema. Used by `compose run`, never by the
EMAIL_FROM: ${EMAIL_FROM} # running app. See tcg-remediation-todo.md Task 5.
FRONTEND_URL: ${FRONTEND_URL} MIGRATION_DATABASE_URL: postgresql://wikitcg:${POSTGRES_PASSWORD:?}@db:5432/wikitcg
CORS_ORIGINS: ${FRONTEND_URL} JWT_SECRET_KEY: ${JWT_SECRET_KEY:?}
WIKIRANK_USER_AGENT: ${WIKIRANK_USER_AGENT} STRIPE_SECRET_KEY: ${STRIPE_SECRET_KEY:?}
ports: STRIPE_PUBLISHABLE_KEY: ${STRIPE_PUBLISHABLE_KEY:?}
- "8000:8000" STRIPE_WEBHOOK_SECRET: ${STRIPE_WEBHOOK_SECRET:?}
RESEND_API_KEY: ${RESEND_API_KEY:?}
EMAIL_FROM: noreply@tcg.gade.gg
FRONTEND_URL: https://tcg.gade.gg
CORS_ORIGINS: https://tcg.gade.gg
WIKIRANK_USER_AGENT: WikiTCG/1.0 (nikolaj@gade.gg)
TZ: Europe/Paris
networks: networks:
- wikitcg - tcg-internal # to reach db
- proxy # to be reached by NPM
ports:
# STAGE 1 ONLY. Remove once NPM points at backend:8000 by name.
- "555:8000"
depends_on:
db:
condition: service_healthy
frontend: frontend:
build: build:
context: ./frontend context: ./frontend
args: dockerfile: dockerfile
PUBLIC_API_URL: ${BACKEND_URL} image: wikitcg-frontend
container_name: wikitcg-frontend container_name: wikitcg-frontend
restart: unless-stopped restart: unless-stopped
ports: environment:
- "3000:80" TZ: Europe/Paris
networks: networks:
- wikitcg - proxy # NPM only. No database access, by construction.
ports:
# STAGE 1 ONLY. Remove once NPM points at frontend:80 by name.
- "444:80"
networks: networks:
wikitcg: proxy:
driver: bridge external: true
tcg-internal:
internal: true