102 lines
2.7 KiB
YAML
102 lines
2.7 KiB
YAML
services:
|
|
# --- PostgreSQL ---
|
|
postgres:
|
|
image: postgres:16-alpine
|
|
container_name: gamepanel-postgres
|
|
restart: unless-stopped
|
|
environment:
|
|
POSTGRES_USER: ${DB_USER:-gamepanel}
|
|
POSTGRES_PASSWORD: ${DB_PASSWORD:-gamepanel}
|
|
POSTGRES_DB: ${DB_NAME:-gamepanel}
|
|
volumes:
|
|
- postgres_data:/var/lib/postgresql/data
|
|
ports:
|
|
- "${DB_PORT:-5432}:5432"
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "pg_isready -U ${DB_USER:-gamepanel}"]
|
|
interval: 10s
|
|
timeout: 5s
|
|
retries: 5
|
|
|
|
# --- Redis (rate limiting, session cache) ---
|
|
redis:
|
|
image: redis:7-alpine
|
|
container_name: gamepanel-redis
|
|
restart: unless-stopped
|
|
command: redis-server --appendonly yes --requirepass ${REDIS_PASSWORD:-gamepanel}
|
|
volumes:
|
|
- redis_data:/data
|
|
ports:
|
|
- "${REDIS_PORT:-6379}:6379"
|
|
healthcheck:
|
|
test: ["CMD", "redis-cli", "-a", "${REDIS_PASSWORD:-gamepanel}", "ping"]
|
|
interval: 10s
|
|
timeout: 5s
|
|
retries: 5
|
|
|
|
# --- API ---
|
|
api:
|
|
build:
|
|
context: .
|
|
dockerfile: apps/api/Dockerfile
|
|
container_name: gamepanel-api
|
|
restart: unless-stopped
|
|
depends_on:
|
|
postgres:
|
|
condition: service_healthy
|
|
redis:
|
|
condition: service_healthy
|
|
environment:
|
|
NODE_ENV: production
|
|
DATABASE_URL: postgresql://${DB_USER:-gamepanel}:${DB_PASSWORD:-gamepanel}@postgres:5432/${DB_NAME:-gamepanel}
|
|
REDIS_URL: redis://:${REDIS_PASSWORD:-gamepanel}@redis:6379
|
|
PORT: 3000
|
|
HOST: 0.0.0.0
|
|
JWT_SECRET: ${JWT_SECRET}
|
|
JWT_REFRESH_SECRET: ${JWT_REFRESH_SECRET}
|
|
CORS_ORIGIN: ${CORS_ORIGIN:-http://localhost}
|
|
RATE_LIMIT_MAX: ${RATE_LIMIT_MAX:-100}
|
|
RATE_LIMIT_WINDOW_MS: ${RATE_LIMIT_WINDOW_MS:-60000}
|
|
ports:
|
|
- "${API_PORT:-3000}:3000"
|
|
|
|
# --- Web (nginx + SPA) ---
|
|
web:
|
|
build:
|
|
context: .
|
|
dockerfile: apps/web/Dockerfile
|
|
args:
|
|
VITE_API_URL: /api
|
|
container_name: gamepanel-web
|
|
restart: unless-stopped
|
|
depends_on:
|
|
- api
|
|
ports:
|
|
- "${WEB_PORT:-80}:80"
|
|
|
|
# --- Daemon (runs on game server nodes) ---
|
|
daemon:
|
|
build:
|
|
context: .
|
|
dockerfile: apps/daemon/Dockerfile
|
|
container_name: gamepanel-daemon
|
|
restart: unless-stopped
|
|
depends_on:
|
|
- api
|
|
privileged: true
|
|
environment:
|
|
DAEMON_CONFIG: /etc/gamepanel/config.yml
|
|
volumes:
|
|
- /var/run/docker.sock:/var/run/docker.sock
|
|
- daemon_data:/var/lib/gamepanel/servers
|
|
- daemon_backups:/var/lib/gamepanel/backups
|
|
- ./daemon-config.yml:/etc/gamepanel/config.yml:ro
|
|
ports:
|
|
- "${DAEMON_GRPC_PORT:-50051}:50051"
|
|
|
|
volumes:
|
|
postgres_data:
|
|
redis_data:
|
|
daemon_data:
|
|
daemon_backups:
|