-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
232 lines (220 loc) · 6.71 KB
/
Copy pathdocker-compose.yml
File metadata and controls
232 lines (220 loc) · 6.71 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
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
name: platform
x-logging: &logging
driver: json-file
options:
max-size: "10m"
max-file: "5"
x-api-build: &api-build
context: .
target: api
x-api-hardening: &api-hardening
init: true
read_only: true
tmpfs:
- /tmp:size=16m,mode=1777,noexec,nosuid,nodev
cap_drop:
- ALL
security_opt:
- no-new-privileges:true
pids_limit: 256
logging: *logging
x-database-environment: &database-environment
DB_HOST: postgres
DB_PORT: "5432"
DB_DATABASE: ${DB_DATABASE:-platform}
DB_SSL: disable
services:
postgres:
image: postgres:17-alpine@sha256:b0f9560a2de083e2cc7382e75f808c7381a32852a7ec49117deedb300e552b24
restart: unless-stopped
environment:
POSTGRES_USER: ${DB_USER:-platform}
POSTGRES_PASSWORD: ${DB_PASSWORD:?DB_PASSWORD is required}
POSTGRES_DB: ${DB_DATABASE:-platform}
POSTGRES_INITDB_ARGS: --auth-host=scram-sha-256
APP_DB_USER: ${APP_DB_USER:-platform_app}
APP_DB_PASSWORD: ${APP_DB_PASSWORD:?APP_DB_PASSWORD is required}
volumes:
- postgres_data:/var/lib/postgresql/data
- ./docker/postgres:/docker-entrypoint-initdb.d:ro
networks:
- backend
healthcheck:
test: ["CMD-SHELL", 'pg_isready -U "$$POSTGRES_USER" -d "$$POSTGRES_DB"']
interval: 10s
timeout: 5s
retries: 5
security_opt:
- no-new-privileges:true
shm_size: 128m
logging: *logging
redis:
image: redis:8.0-alpine@sha256:5f61955be8ab2ccee9372b84ae4d4da2e2b156f87281e3f218544055e7ee04d4
restart: unless-stopped
command:
- sh
- -c
- >-
umask 077 &&
echo "requirepass $$REDIS_PASSWORD" > /data/redis.conf &&
exec redis-server /data/redis.conf
--maxmemory "$$REDIS_MAXMEMORY"
--maxmemory-policy volatile-lru
--save ""
--appendonly no
--protected-mode yes
--rename-command FLUSHALL ""
--rename-command FLUSHDB ""
--rename-command CONFIG ""
--rename-command DEBUG ""
--rename-command SHUTDOWN ""
--rename-command KEYS ""
environment:
REDIS_PASSWORD: ${REDIS_PASSWORD:?REDIS_PASSWORD is required}
REDIS_MAXMEMORY: ${REDIS_MAXMEMORY:-128mb}
REDISCLI_AUTH: ${REDIS_PASSWORD:?REDIS_PASSWORD is required}
networks:
- backend
healthcheck:
test: ["CMD-SHELL", "redis-cli ping | grep -q PONG"]
interval: 10s
timeout: 5s
retries: 5
user: "999:999"
read_only: true
tmpfs:
- /data:size=16m,uid=999,gid=999,mode=0700
cap_drop:
- ALL
security_opt:
- no-new-privileges:true
logging: *logging
migrate:
<<: *api-hardening
image: platform-api
build: *api-build
restart: "no"
command: ["node", "apps/api/dist/Migrate.js"]
environment:
<<: *database-environment
DB_USER: ${DB_USER:-platform}
DB_PASSWORD: ${DB_PASSWORD:?DB_PASSWORD is required}
NODE_ENV: production
healthcheck:
disable: true
networks:
- backend
depends_on:
postgres:
condition: service_healthy
api:
<<: *api-hardening
image: platform-api
build: *api-build
restart: unless-stopped
expose:
- "3333"
environment:
<<: *database-environment
DB_USER: ${APP_DB_USER:-platform_app}
DB_PASSWORD: ${APP_DB_PASSWORD:?APP_DB_PASSWORD is required}
NODE_ENV: production
HOST: 0.0.0.0
PORT: "3333"
LOG_LEVEL: ${LOG_LEVEL:-info}
TRUST_PROXY_HOPS: ${TRUST_PROXY_HOPS:-1}
APP_URL: ${APP_URL:?APP_URL is required}
APP_KEY: ${APP_KEY:?APP_KEY is required}
CORS_ORIGINS: ${CORS_ORIGINS:?CORS_ORIGINS is required}
WEB_AUTH_CALLBACK_PATH: ${WEB_AUTH_CALLBACK_PATH:-/auth/callback}
SESSION_TTL_DAYS: ${SESSION_TTL_DAYS:-30}
SERVICE_TOKEN: ${SERVICE_TOKEN:?SERVICE_TOKEN is required}
DB_POOL_MAX: ${DB_POOL_MAX:-20}
REDIS_HOST: redis
REDIS_PORT: "6379"
REDIS_PASSWORD: ${REDIS_PASSWORD:?REDIS_PASSWORD is required}
DISCORD_CLIENT_ID: ${DISCORD_CLIENT_ID:?DISCORD_CLIENT_ID is required}
DISCORD_CLIENT_SECRET: ${DISCORD_CLIENT_SECRET:?DISCORD_CLIENT_SECRET is required}
DISCORD_REDIRECT_URI: ${DISCORD_REDIRECT_URI:?DISCORD_REDIRECT_URI is required}
SUPER_ADMIN_DISCORD_IDS: ${SUPER_ADMIN_DISCORD_IDS:-}
ADMIN_DISCORD_IDS: ${ADMIN_DISCORD_IDS:-}
SUPERVISOR_DISCORD_IDS: ${SUPERVISOR_DISCORD_IDS:-}
MODERATOR_DISCORD_IDS: ${MODERATOR_DISCORD_IDS:-}
SENIOR_DISCORD_IDS: ${SENIOR_DISCORD_IDS:-}
RESEND_API_KEY: ${RESEND_API_KEY:-}
EMAIL_FROM: ${EMAIL_FROM:-}
TURNSTILE_SECRET_KEY: ${TURNSTILE_SECRET_KEY:-}
S3_ENDPOINT: ${S3_ENDPOINT:-}
S3_REGION: ${S3_REGION:-auto}
S3_ACCESS_KEY_ID: ${S3_ACCESS_KEY_ID:-}
S3_SECRET_ACCESS_KEY: ${S3_SECRET_ACCESS_KEY:-}
S3_DELIVERABLES_BUCKET: ${S3_DELIVERABLES_BUCKET:-}
S3_MEDIA_BUCKET: ${S3_MEDIA_BUCKET:-}
S3_MEDIA_PUBLIC_URL: ${S3_MEDIA_PUBLIC_URL:-}
MEDIA_MAX_BYTES: ${MEDIA_MAX_BYTES:-5242880}
DELIVERABLE_MAX_BYTES: ${DELIVERABLE_MAX_BYTES:-2147483648}
networks:
- backend
- edge
depends_on:
migrate:
condition: service_completed_successfully
postgres:
condition: service_healthy
redis:
condition: service_healthy
discord:
<<: *api-hardening
image: platform-discord
build:
context: .
target: discord
restart: unless-stopped
environment:
NODE_ENV: production
LOG_LEVEL: ${LOG_LEVEL:-info}
DISCORD_BOT_TOKEN: ${DISCORD_BOT_TOKEN:?DISCORD_BOT_TOKEN is required}
DISCORD_CLIENT_ID: ${DISCORD_CLIENT_ID:?DISCORD_CLIENT_ID is required}
DISCORD_GUILD_ID: ${DISCORD_GUILD_ID:?DISCORD_GUILD_ID is required}
API_BASE_URL: http://api:3333/api/v1
SERVICE_TOKEN: ${SERVICE_TOKEN:?SERVICE_TOKEN is required}
WEB_APP_URL: ${WEB_APP_URL:?WEB_APP_URL is required}
volumes:
- discord_data:/app/data
healthcheck:
disable: true
networks:
- edge
depends_on:
api:
condition: service_healthy
web:
<<: *api-hardening
image: platform-web
build:
context: .
target: web
restart: unless-stopped
expose:
- "3000"
environment:
NODE_ENV: production
WEB_APP_URL: ${WEB_APP_URL:?WEB_APP_URL is required}
API_INTERNAL_URL: http://api:3333
API_PUBLIC_URL: ${APP_URL:?APP_URL is required}
STORAGE_ORIGINS: ${WEB_STORAGE_ORIGINS:-}
DISCORD_GUILD_ID: ${DISCORD_GUILD_ID:-}
DISCORD_INVITE_URL: ${DISCORD_INVITE_URL:-}
TURNSTILE_SITE_KEY: ${TURNSTILE_SITE_KEY:-}
networks:
- edge
depends_on:
api:
condition: service_healthy
networks:
backend:
internal: true
edge: {}
volumes:
postgres_data:
discord_data: