-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathcompose.yml
More file actions
121 lines (113 loc) · 3.61 KB
/
Copy pathcompose.yml
File metadata and controls
121 lines (113 loc) · 3.61 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
110
111
112
113
114
115
116
117
118
119
120
121
name: letscube
x-app-environment: &app-environment
NODE_ENV: ${NODE_ENV:-prod}
PORT: ${PORT:-8080}
SOCKETIO_PORT: ${SOCKETIO_PORT:-9000}
ROOM_RECONNECT_GRACE_MS: ${ROOM_RECONNECT_GRACE_MS:-60000}
GRAND_PRIX_ENABLED: ${GRAND_PRIX_ENABLED:-false}
MONGO_URL: ${MONGO_URL:-mongodb://mongo:27017/letscube}
REDIS_URL: ${REDIS_URL:-redis://redis:6379}
POSTGRES_ENABLED: ${POSTGRES_ENABLED:-true}
DATABASE_URL: ${DATABASE_URL:-}
DIRECT_DATABASE_URL: ${DIRECT_DATABASE_URL:-}
PGHOST: ${PGHOST:-postgres}
PGPORT: ${PGPORT:-5432}
PGDATABASE: ${PGDATABASE:-letscube}
PGUSER: ${PGUSER:-letscube}
PGPASSWORD: ${POSTGRES_PASSWORD:-change-me}
PGSSL: ${PGSSL:-false}
PGSSL_REJECT_UNAUTHORIZED: ${PGSSL_REJECT_UNAUTHORIZED:-true}
PGSSL_CA: ${PGSSL_CA:-}
AUTH_SECRET: ${AUTH_SECRET:-change-me}
SESSION_SECRET: ${SESSION_SECRET:-}
AUTH_CALLBACK_URL: ${AUTH_CALLBACK_URL:-https://letscube.net/auth/callback}
WCA_SOURCE: ${WCA_SOURCE:-https://www.worldcubeassociation.org}
WCA_CLIENT_ID: ${WCA_CLIENT_ID:-}
WCA_CLIENT_SECRET: ${WCA_CLIENT_SECRET:-}
CORS_ORIGINS: ${CORS_ORIGINS:-https://letscube.net,https://www.letscube.net}
services:
migrate:
image: letscube-app:${APP_IMAGE_TAG:-local}
command: ["./node_modules/.bin/prisma", "migrate", "deploy", "--config", "server/prisma.config.mjs"]
environment:
<<: *app-environment
depends_on:
postgres:
condition: service_healthy
restart: "no"
api:
image: letscube-app:${APP_IMAGE_TAG:-local}
command: ["node", "server/index.js"]
environment:
<<: *app-environment
depends_on:
mongo:
condition: service_healthy
redis:
condition: service_healthy
expose:
- "8080"
healthcheck:
test: ["CMD-SHELL", "node -e \"require('http').get({host:'127.0.0.1',port:process.env.PORT||8080,path:'/health/api'},res=>process.exit(res.statusCode===200?0:1)).on('error',()=>process.exit(1))\""]
interval: 30s
start_interval: 2s
timeout: 5s
retries: 5
start_period: 30s
socket:
image: letscube-app:${APP_IMAGE_TAG:-local}
command: ["node", "server/socket/index.js"]
environment:
<<: *app-environment
depends_on:
mongo:
condition: service_healthy
redis:
condition: service_healthy
expose:
- "9000"
healthcheck:
test: ["CMD-SHELL", "node -e \"require('http').get({host:'127.0.0.1',port:process.env.SOCKETIO_PORT||9000,path:'/health/socket'},res=>process.exit(res.statusCode===200?0:1)).on('error',()=>process.exit(1))\""]
interval: 30s
start_interval: 2s
timeout: 5s
retries: 5
start_period: 30s
mongo:
image: mongo:6.0
volumes:
- mongo-data:/data/db
healthcheck:
test: ["CMD-SHELL", "mongosh --quiet --eval \"db.adminCommand('ping').ok\" | grep 1"]
interval: 30s
timeout: 10s
retries: 5
start_period: 30s
postgres:
image: postgres:17-alpine
environment:
POSTGRES_DB: ${PGDATABASE:-letscube}
POSTGRES_USER: ${PGUSER:-letscube}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-change-me}
volumes:
- postgres-data:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${PGUSER:-letscube} -d ${PGDATABASE:-letscube}"]
interval: 10s
timeout: 5s
retries: 5
start_period: 10s
redis:
image: redis:7.2-alpine
command: ["redis-server", "--appendonly", "yes"]
volumes:
- redis-data:/data
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 30s
timeout: 5s
retries: 5
volumes:
mongo-data:
postgres-data:
redis-data: