-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdocker-compose.prod.yml
More file actions
executable file
·206 lines (164 loc) · 5.04 KB
/
docker-compose.prod.yml
File metadata and controls
executable file
·206 lines (164 loc) · 5.04 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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
version: '3'
services:
supertokens-db:
hostname: supertokens-db
image: mysql:8.3
environment:
MYSQL_ROOT_PASSWORD: ${SUPERTOKENS_DB_PASS}
MYSQL_USER: ${SUPERTOKENS_DB_USER}
MYSQL_PASSWORD: ${SUPERTOKENS_DB_PASS}
MYSQL_DATABASE: supertokens
networks:
- game_node_app
restart: always
volumes:
- supertokens-db:/var/lib/mysql
healthcheck:
test: [ "CMD", "mysqladmin", "ping", "-h", "localhost" ]
timeout: 20s
retries: 10
supertokens:
hostname: supertokens
image: registry.supertokens.io/supertokens/supertokens-mysql:10.1.3
environment:
MYSQL_CONNECTION_URI: mysql://${SUPERTOKENS_DB_USER}:${SUPERTOKENS_DB_PASS}@supertokens-db:3306/supertokens
networks:
- game_node_app
restart: always
deploy:
replicas: 1
healthcheck:
test: >
bash -c 'exec 3<>/dev/tcp/127.0.0.1/3567 && echo -e "GET /hello HTTP/1.1\r\nhost: 127.0.0.1:3567\r\nConnection: close\r\n\r\n" >&3 && cat <&3 | grep "Hello"'
interval: 10s
timeout: 5s
retries: 5
db:
image: mysql:8.3
hostname: server-db
environment:
MYSQL_ROOT_PASSWORD: ${DB_PASS}
MYSQL_USER: ${DB_USER}
MYSQL_PASSWORD: ${DB_PASS}
MYSQL_DATABASE: gamenode
MYSQL_ROOT_HOST: '%'
networks:
- game_node_app
restart: always
volumes:
- db:/var/lib/mysql
healthcheck:
test: [ "CMD", "mysqladmin", "ping", "-h", "localhost", "--password=${DB_USER}"]
timeout: 20s
retries: 10
# Redis server for caching
redis:
image: redis:latest
hostname: server-redis
command: ["redis-server", "--appendonly", "yes", "--maxmemory", "2048mb", "--maxmemory-policy", "allkeys-lru"]
environment:
ALLOW_EMPTY_PASSWORD: 'yes'
restart: always
healthcheck:
test: ["CMD", "redis-cli", "ping"]
deploy:
replicas: 1
volumes:
- redis:/var/lib/redis
networks:
- game_node_app
# Redis server exclusive to BullMQ
redis_bullmq:
image: redis:latest
hostname: server-redis-bullmq
command: ["redis-server", "--appendonly", "yes", "--maxmemory", "20480mb", "--maxmemory-policy", "allkeys-lru"]
environment:
ALLOW_EMPTY_PASSWORD: 'yes'
restart: always
healthcheck:
test: [ "CMD", "redis-cli", "ping" ]
volumes:
- redis_bullmq:/var/lib/redis
networks:
- game_node_app
server:
image: lamarcke/game-node-server:latest
hostname: server
# Most of the env vars are loaded directly from .env, we only need to override some to make sure
# the docker resources are accessible.
environment:
REDIS_URL: redis://server-redis:6379
BULLMQ_REDIS_URL: redis://server-redis-bullmq:6379
SUPERTOKENS_CORE_URI: http://@supertokens:3567
SERVER_PORT: 5000
DOMAIN_API: https://server.gamenode.app
DOMAIN_WEBSITE: https://gamenode.app
DB_HOST: server-db
DB_DATABASE: gamenode
DB_PASS: ${DB_PASS}
DB_USER: ${DB_USER}
DB_PORT: 3306
EMAIL_HOST: ${EMAIL_HOST}
EMAIL_PORT: ${EMAIL_PORT}
EMAIL_USERNAME: ${EMAIL_USERNAME}
EMAIL_PASSWORD: ${EMAIL_PASSWORD}
EMAIL_FROM: ${EMAIL_FROM}
PROVIDER_GOOGLE_CLIENT_ID: ${PROVIDER_GOOGLE_CLIENT_ID}
PROVIDER_GOOGLE_CLIENT_SECRET: ${PROVIDER_GOOGLE_CLIENT_SECRET}
PROVIDER_DISCORD_CLIENT_ID: ${PROVIDER_DISCORD_CLIENT_ID}
PROVIDER_DISCORD_CLIENT_SECRET: ${PROVIDER_DISCORD_CLIENT_SECRET}
PROVIDER_TWITTER_CLIENT_ID: ${PROVIDER_TWITTER_CLIENT_ID}
PROVIDER_TWITTER_CLIENT_SECRET: ${PROVIDER_TWITTER_CLIENT_SECRET}
XBOX_API_USER: ${XBOX_API_USER}
XBOX_API_PASS: ${XBOX_API_PASS}
STEAM_API_KEY: ${STEAM_API_KEY}
TWITCH_CLIENT_ID: ${TWITCH_CLIENT_ID}
TWITCH_CLIENT_SECRET: ${TWITCH_CLIENT_SECRET}
PSN_NPSSO_KEY: ${PSN_NPSSO_KEY}
S3_ENDPOINT: ${S3_ENDPOINT}
S3_ACCESS_KEY_ID: ${S3_ACCESS_KEY_ID}
S3_SECRET_ACCESS_KEY: ${S3_SECRET_ACCESS_KEY}
healthcheck:
test: [ "CMD-SHELL", "yarn run healthcheck" ]
interval: 30s
timeout: 10s
retries: 3
restart: always
deploy:
replicas: 2
command: "yarn start:prod"
volumes:
- gamenode:/app/public/uploads
networks:
- game_node_app
- game_node_app_public
# This image is here to allow us to run migration separately, and doesn't feature health checks.
server_migration:
image: lamarcke/game-node-server:latest
hostname: server-migration
environment:
DB_HOST: server-db
DB_DATABASE: gamenode
DB_PASS: ${DB_PASS}
DB_USER: ${DB_USER}
DB_PORT: 3306
restart: always
# The server process is not meant to actually be started here.
# This could be done better, but we need to manually check every migration
# before running.
command: "sleep infinity"
deploy:
replicas: 1
networks:
- game_node_app
networks:
game_node_app:
external: true
game_node_app_public:
external: true
volumes:
redis:
redis_bullmq:
db:
gamenode:
supertokens-db: