107 lines
2.8 KiB
YAML
107 lines
2.8 KiB
YAML
# Shattered Void MMO - local dev stack
|
|
# frontend -> http://localhost:8080
|
|
# backend -> http://localhost:3000
|
|
# Bring up with: docker compose up -d --build
|
|
|
|
services:
|
|
postgres:
|
|
image: postgres:16-alpine
|
|
environment:
|
|
POSTGRES_DB: ${DB_NAME:-shattered_void_dev}
|
|
POSTGRES_USER: ${DB_USER:-postgres}
|
|
POSTGRES_PASSWORD: ${DB_PASSWORD:-devpassword}
|
|
ports:
|
|
- "5432:5432"
|
|
volumes:
|
|
- postgres_data:/var/lib/postgresql/data
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "pg_isready -U ${DB_USER:-postgres} -d ${DB_NAME:-shattered_void_dev}"]
|
|
interval: 5s
|
|
timeout: 5s
|
|
retries: 10
|
|
|
|
redis:
|
|
image: redis:7-alpine
|
|
ports:
|
|
- "6379:6379"
|
|
volumes:
|
|
- redis_data:/data
|
|
healthcheck:
|
|
test: ["CMD", "redis-cli", "ping"]
|
|
interval: 5s
|
|
timeout: 5s
|
|
retries: 10
|
|
|
|
# Runs to completion before the backend starts, so the schema always exists first.
|
|
migrate:
|
|
build: .
|
|
command: sh -c "npx knex migrate:latest && npx knex seed:run"
|
|
environment:
|
|
NODE_ENV: development
|
|
DB_HOST: postgres
|
|
DB_PORT: 5432
|
|
DB_NAME: ${DB_NAME:-shattered_void_dev}
|
|
DB_USER: ${DB_USER:-postgres}
|
|
DB_PASSWORD: ${DB_PASSWORD:-devpassword}
|
|
depends_on:
|
|
postgres:
|
|
condition: service_healthy
|
|
restart: "no"
|
|
|
|
backend:
|
|
build: .
|
|
ports:
|
|
- "3000:3000"
|
|
environment:
|
|
NODE_ENV: development
|
|
PORT: 3000
|
|
HOST: 0.0.0.0
|
|
LOG_LEVEL: debug
|
|
|
|
DB_HOST: postgres
|
|
DB_PORT: 5432
|
|
DB_NAME: ${DB_NAME:-shattered_void_dev}
|
|
DB_USER: ${DB_USER:-postgres}
|
|
DB_PASSWORD: ${DB_PASSWORD:-devpassword}
|
|
|
|
REDIS_HOST: redis
|
|
REDIS_PORT: 6379
|
|
REDIS_DB: 0
|
|
|
|
JWT_PLAYER_SECRET: ${JWT_PLAYER_SECRET:-dev-player-secret}
|
|
JWT_ADMIN_SECRET: ${JWT_ADMIN_SECRET:-dev-admin-secret}
|
|
JWT_REFRESH_SECRET: ${JWT_REFRESH_SECRET:-dev-refresh-secret}
|
|
JWT_ISSUER: shattered-void-mmo
|
|
|
|
# The browser loads the SPA from :8080 but calls the API on :3000 — both must be allowed.
|
|
CORS_ALLOWED_ORIGINS: http://localhost:8080,http://localhost:3000,http://127.0.0.1:8080
|
|
CORS_CREDENTIALS: "true"
|
|
WEBSOCKET_CORS_ORIGIN: http://localhost:8080,http://localhost:3000
|
|
|
|
ENABLE_GAME_TICK: "false"
|
|
ENABLE_ADMIN_ROUTES: "true"
|
|
ENABLE_DEBUG_ENDPOINTS: "true"
|
|
volumes:
|
|
- ./logs:/app/logs
|
|
depends_on:
|
|
postgres:
|
|
condition: service_healthy
|
|
redis:
|
|
condition: service_healthy
|
|
migrate:
|
|
condition: service_completed_successfully
|
|
|
|
frontend:
|
|
build:
|
|
context: ./frontend
|
|
args:
|
|
VITE_API_URL: http://localhost:3000
|
|
VITE_WS_URL: http://localhost:3000
|
|
ports:
|
|
- "8080:80"
|
|
depends_on:
|
|
- backend
|
|
|
|
volumes:
|
|
postgres_data:
|
|
redis_data:
|