83 lines
2.2 KiB
YAML
83 lines
2.2 KiB
YAML
|
|
services:
|
|
postgres:
|
|
image: postgres:15
|
|
environment:
|
|
POSTGRES_DB: ${POSTGRES_DB:-skymoney}
|
|
POSTGRES_USER: ${POSTGRES_USER:-app}
|
|
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-app}
|
|
volumes:
|
|
- pgdata:/var/lib/postgresql/data
|
|
ports:
|
|
- "5432:5432"
|
|
restart: unless-stopped
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-app} -d ${POSTGRES_DB:-skymoney}"]
|
|
interval: 5s
|
|
timeout: 3s
|
|
retries: 10
|
|
|
|
api:
|
|
build:
|
|
context: ./api
|
|
dockerfile: Dockerfile
|
|
environment:
|
|
NODE_ENV: ${NODE_ENV:-development}
|
|
PORT: ${PORT:-8080}
|
|
DATABASE_URL: ${DATABASE_URL:-postgres://app:app@postgres:5432/skymoney}
|
|
CORS_ORIGIN: ${CORS_ORIGIN:-http://localhost:5173}
|
|
SEED_DEFAULT_BUDGET: ${SEED_DEFAULT_BUDGET:-0}
|
|
AUTH_DISABLED: ${AUTH_DISABLED:-false}
|
|
JWT_SECRET: ${JWT_SECRET:-dev-jwt-secret-change-me}
|
|
COOKIE_SECRET: ${COOKIE_SECRET:-dev-cookie-secret-change-me}
|
|
|
|
depends_on:
|
|
- postgres
|
|
ports:
|
|
- "8081:8080"
|
|
restart: unless-stopped
|
|
healthcheck:
|
|
# runs *inside* the container; port 8080 is the app's internal port
|
|
test: ["CMD-SHELL", "wget -qO- http://localhost:8080/health || exit 1"]
|
|
interval: 5s
|
|
timeout: 3s
|
|
retries: 10
|
|
start_period: 10s
|
|
|
|
caddy:
|
|
image: caddy:2
|
|
ports:
|
|
- "8080:80"
|
|
volumes:
|
|
- ./Caddyfile.dev:/etc/caddy/Caddyfile:ro
|
|
- ./web/dist:/srv/site:ro
|
|
depends_on:
|
|
- api
|
|
restart: unless-stopped
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "wget -qO- http://localhost/ || exit 1"]
|
|
interval: 10s
|
|
timeout: 3s
|
|
retries: 10
|
|
|
|
scheduler:
|
|
build:
|
|
context: ./api
|
|
dockerfile: Dockerfile
|
|
command: ["node", "dist/worker/rollover.js"]
|
|
environment:
|
|
NODE_ENV: ${NODE_ENV:-production}
|
|
DATABASE_URL: ${DATABASE_URL:-postgres://app:app@postgres:5432/skymoney}
|
|
ROLLOVER_SCHEDULE_CRON: "${ROLLOVER_SCHEDULE_CRON:-0 6 * * *}"
|
|
restart: unless-stopped
|
|
depends_on:
|
|
- postgres
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "node -e \"process.exit(0)\""]
|
|
interval: 60s
|
|
timeout: 5s
|
|
retries: 3
|
|
|
|
volumes:
|
|
pgdata:
|