-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
109 lines (106 loc) · 3.34 KB
/
Copy pathdocker-compose.yml
File metadata and controls
109 lines (106 loc) · 3.34 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
# =============================================================================
# docker-compose.yml — PokerTools local development / SQLite smoke deployment
#
# Usage:
# docker compose up --build # build + start local SQLite stack
# docker compose up -d # start in background
# docker compose down -v # tear down (remove volumes)
#
# The API image is built from the monorepo root Dockerfile and tagged as
# ghcr.io/aaurelions/pokertools.
#
# SECURITY: This file intentionally uses SQLite and is not the production
# deployment profile. Use docker-compose.prod.yml for PostgreSQL, Caddy TLS,
# Redis persistence, workers, and automated backups.
# =============================================================================
services:
# ---- Redis (required by the API for caching, pub/sub, job queues) ----
redis:
image: redis:8-alpine
restart: unless-stopped
command: redis-server --appendonly yes --appendfsync everysec --save 60 1
ports:
- "6379:6379"
volumes:
- redis_data:/data
deploy:
resources:
limits:
cpus: "1.0"
memory: 512M
reservations:
cpus: "0.25"
memory: 128M
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 10s
timeout: 3s
retries: 5
logging:
options:
max-size: "10m"
max-file: "3"
# ---- PokerTools API ----
api:
build:
context: .
dockerfile: Dockerfile
image: ghcr.io/aaurelions/pokertools:latest
restart: unless-stopped
ports:
- "3000:3000"
depends_on:
redis:
condition: service_healthy
environment:
# Application
NODE_ENV: ${NODE_ENV:-development}
PORT: "3000"
HOST: "0.0.0.0"
LOG_LEVEL: ${LOG_LEVEL:-info}
# Database — SQLite file on a named volume for persistence
DATABASE_URL: "file:.runtime/app.db"
# Redis — reach the redis service by its compose name
REDIS_URL: "redis://redis:6379"
# Security secrets — MUST be set via .env or orchestration secrets.
# The entrypoint enforces that production never uses dev defaults.
JWT_SECRET: "${JWT_SECRET:?err: JWT_SECRET must be set in .env for production}"
COOKIE_SECRET: "${COOKIE_SECRET:?err: COOKIE_SECRET must be set in .env for production}"
WALLET_ENCRYPTION_SECRET: "${WALLET_ENCRYPTION_SECRET:?err: WALLET_ENCRYPTION_SECRET must be set in .env for production}"
# Observability — set METRICS_TOKEN to secure the /metrics endpoint.
METRICS_TOKEN: ${METRICS_TOKEN:-}
CORS_ORIGIN: ${CORS_ORIGIN:-}
volumes:
# Persistent SQLite database (the .runtime folder inside the container)
- sqlite_data:/app/packages/api/.runtime
deploy:
resources:
limits:
cpus: "2.0"
memory: 1G
reservations:
cpus: "0.5"
memory: 256M
security_opt:
- no-new-privileges:true
cap_drop:
- ALL
cap_add:
- NET_BIND_SERVICE
read_only: true
tmpfs:
- /tmp:size=64M,mode=1777
healthcheck:
test: ["CMD-SHELL", "curl -fsS http://localhost:3000/health || exit 1"]
interval: 30s
timeout: 5s
start_period: 15s
retries: 3
logging:
options:
max-size: "10m"
max-file: "3"
# ---- Named volumes ----
volumes:
redis_data:
sqlite_data: