-
-
Notifications
You must be signed in to change notification settings - Fork 52
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
107 lines (102 loc) · 4.98 KB
/
docker-compose.yml
File metadata and controls
107 lines (102 loc) · 4.98 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
# ═══════════════════════════════════════════════════════════════════════════════
# XActions — Docker Compose (Full Stack)
# Runs: API + Worker + PostgreSQL + Redis
# Usage: docker compose up -d
# by nichxbt
# ═══════════════════════════════════════════════════════════════════════════════
services:
# ─────────────────────────────────────────────────────────────────────────────
# PostgreSQL Database
# ─────────────────────────────────────────────────────────────────────────────
postgres:
image: postgres:16-alpine
restart: unless-stopped
environment:
POSTGRES_USER: xactions
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-xactions_dev_password}
POSTGRES_DB: xactions
volumes:
- postgres_data:/var/lib/postgresql/data
ports:
- "5432:5432"
healthcheck:
test: ["CMD-SHELL", "pg_isready -U xactions"]
interval: 10s
timeout: 5s
retries: 5
# ─────────────────────────────────────────────────────────────────────────────
# Redis (Job Queue + Caching)
# ─────────────────────────────────────────────────────────────────────────────
redis:
image: redis:7-alpine
restart: unless-stopped
command: redis-server --appendonly yes --maxmemory 128mb --maxmemory-policy allkeys-lru
volumes:
- redis_data:/data
ports:
- "6379:6379"
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 10s
timeout: 5s
retries: 5
# ─────────────────────────────────────────────────────────────────────────────
# XActions API Server
# ─────────────────────────────────────────────────────────────────────────────
api:
build:
context: .
dockerfile: Dockerfile
restart: unless-stopped
ports:
- "${PORT:-3001}:3001"
environment:
NODE_ENV: production
PORT: 3001
DATABASE_URL: postgresql://xactions:${POSTGRES_PASSWORD:-xactions_dev_password}@postgres:5432/xactions?schema=public
REDIS_HOST: redis
REDIS_PORT: 6379
JWT_SECRET: ${JWT_SECRET:?Set JWT_SECRET in .env}
SESSION_SECRET: ${SESSION_SECRET:-$(openssl rand -hex 32)}
PUPPETEER_EXECUTABLE_PATH: /usr/bin/chromium
PUPPETEER_HEADLESS: "true"
PUPPETEER_NO_SANDBOX: "true"
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
command: >
sh -c "npx prisma migrate deploy && node api/server.js"
healthcheck:
test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:3001/api/health"]
interval: 30s
timeout: 10s
start_period: 30s
retries: 3
# ─────────────────────────────────────────────────────────────────────────────
# XActions Background Worker (Job Queue Processor)
# ─────────────────────────────────────────────────────────────────────────────
worker:
build:
context: .
dockerfile: Dockerfile
restart: unless-stopped
environment:
NODE_ENV: production
DATABASE_URL: postgresql://xactions:${POSTGRES_PASSWORD:-xactions_dev_password}@postgres:5432/xactions?schema=public
REDIS_HOST: redis
REDIS_PORT: 6379
JWT_SECRET: ${JWT_SECRET:?Set JWT_SECRET in .env}
PUPPETEER_EXECUTABLE_PATH: /usr/bin/chromium
PUPPETEER_HEADLESS: "true"
PUPPETEER_NO_SANDBOX: "true"
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
command: ["node", "api/services/jobQueue.js"]
volumes:
postgres_data:
redis_data: