-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
293 lines (265 loc) · 7.75 KB
/
docker-compose.yml
File metadata and controls
293 lines (265 loc) · 7.75 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
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
services:
payload:
profiles:
- dev
build:
context: .
dockerfile: dev.Dockerfile
ports:
- '3000:3000'
- '51212:51212'
- '9464:9464' # Prometheus metrics
volumes:
- .:/home/node/app
- next-cache:/home/node/app/.next
- node-cache:/nodecache
- node_modules:/home/node/app/node_modules
working_dir: /home/node/app/
command: >
sh -c "export PRISMA_OUTPUT='src/lib/prisma/client/' && npx prisma generate --no-hints && npx prisma db push --accept-data-loss && npx prisma studio --browser none & corepack enable pnpm && pnpm i --frozen-lockfile && sh /home/node/app/create_build_info.sh && pnpm dev-next"
dns:
- 8.8.8.8
- 1.1.1.1
depends_on:
mongo:
condition: service_started
postgres:
condition: service_healthy
env_file:
- .env
environment:
- NODE_COMPILE_CACHE=/nodecache # see https://nodejs.org/en/blog/release/v22.1.0
- NEXT_PUBLIC_DISABLE_SERWIST=true
- CI=true
healthcheck:
test: ['CMD-SHELL', 'curl -f http://localhost:3000/status | grep -q ''"status":"ok"''']
interval: 30s
timeout: 10s
retries: 3
start_period: 40s
payload-service-worker:
profiles:
- service-worker
build:
context: .
dockerfile: service-worker.Dockerfile
ports:
- '3000:3000'
- '51212:51212'
- '9464:9464' # Prometheus metrics
volumes:
- next-cache:/home/node/app/.next
- node-cache:/nodecache
- node_modules:/home/node/app/node_modules
working_dir: /home/node/app/
command: >
sh -c "export PRISMA_OUTPUT='src/lib/prisma/client/' && npx prisma generate --no-hints && npx prisma db push --accept-data-loss && npx prisma studio --browser none & corepack enable pnpm && pnpm i --frozen-lockfile && sh /home/node/app/create_build_info.sh && pnpm build && mkdir -p .next/standalone/.next/cache && cp -r .next/cache/fs-fallback .next/standalone/.next/cache/ && cp -r .next/static .next/standalone/.next/ && cp -r public .next/standalone/ || true && node .next/standalone/server.js"
dns:
- 8.8.8.8
- 1.1.1.1
depends_on:
mongo:
condition: service_started
postgres:
condition: service_healthy
env_file:
- .env
environment:
- NODE_COMPILE_CACHE=/nodecache # see https://nodejs.org/en/blog/release/v22.1.0
- NEXT_PUBLIC_DISABLE_SERWIST=false
- ENABLE_TURBOPACK_FS_CACHE=true
- CI=true
healthcheck:
test: ['CMD-SHELL', 'curl -f http://localhost:3000/status | grep -q ''"status":"ok"''']
interval: 30s
timeout: 10s
retries: 3
start_period: 40s
develop:
watch:
- action: sync+restart
path: ./src
target: /home/node/app/src
- action: sync+restart
path: ./public
target: /home/node/app/public
- action: sync+restart
path: ./next.config.ts
target: /home/node/app/next.config.ts
- action: sync+restart
path: ./package.json
target: /home/node/app/package.json
- action: sync+restart
path: ./tsconfig.json
target: /home/node/app/tsconfig.json
mongo:
image: mongo:latest
ports:
- '27017:27017'
command: mongod --quiet --logpath /dev/null --storageEngine=wiredTiger
volumes:
- data:/data/db
logging:
driver: none
mongodb-exporter:
profiles:
- observability
image: percona/mongodb_exporter:0.40
command:
- '--mongodb.uri=mongodb://mongo:27017'
- '--compatible-mode'
- '--collect-all'
ports:
- '9216:9216'
depends_on:
- mongo
mongo-express:
image: mongo-express
ports:
- '8081:8081'
depends_on:
- mongo
environment:
ME_CONFIG_BASICAUTH_USERNAME: 'admin'
ME_CONFIG_BASICAUTH_PASSWORD: 'pass'
ME_CONFIG_MONGODB_SERVER: mongo
logging:
driver: none
minio:
image: minio/minio
entrypoint: sh
command: >
-c "mkdir -p /data/${MINIO_BUCKET_NAME} && /usr/bin/minio server --console-address ':9001' /data & sleep 10 && mc alias set myminio http://minio:9000 ${MINIO_ROOT_USER} ${MINIO_ROOT_PASSWORD} && mc admin user svcacct add --access-key '${MINIO_ACCESS_KEY_ID}' --secret-key '${MINIO_SECRET_ACCESS_KEY}' myminio ${MINIO_ROOT_USER} || true && echo 'minio is ready' && sleep infinity"
env_file:
- .env
ports:
- '9000:9000'
- '9001:9001'
volumes:
- minio-data:/data
fake-oauth:
build: dev-oauth
ports:
- '3001:5000'
restart: always
postgres:
image: postgres:17
ports:
- '5432:5432'
env_file:
- .env
volumes:
- postgress-data:/var/lib/postgresql/data
healthcheck:
test: ['CMD-SHELL', 'pg_isready -d $${POSTGRES_DB} -U $${POSTGRES_USER}']
interval: 10s
timeout: 5s
retries: 5
postgres-exporter:
profiles:
- observability
image: prometheuscommunity/postgres-exporter
ports:
- '9187:9187'
environment:
DATA_SOURCE_URI: 'postgres:5432/${POSTGRES_DB}?sslmode=disable'
DATA_SOURCE_USER: '${POSTGRES_USER}'
DATA_SOURCE_PASS: '${POSTGRES_PASSWORD}'
depends_on:
postgres:
condition: service_healthy
env_file:
- .env
redis-exporter:
profiles:
- observability
image: oliver006/redis_exporter
ports:
- '9121:9121'
environment:
- REDIS_ADDR=redis:6379
depends_on:
- redis
prometheus:
profiles:
- observability
image: prom/prometheus
volumes:
- ./observability/prometheus/prometheus.yml:/etc/prometheus/prometheus.yml
- logging-prometheus-storage:/prometheus
command:
- '--config.file=/etc/prometheus/prometheus.yml'
- '--storage.tsdb.path=/prometheus'
- '--storage.tsdb.retention.time=30d'
- '--storage.tsdb.retention.size=10GB'
- '--web.enable-remote-write-receiver'
- '--enable-feature=exemplar-storage'
- '--enable-feature=native-histograms'
- '--log.level=error'
ports:
- '9090:9090'
tempo:
profiles:
- observability
user: '0:0'
image: grafana/tempo:latest
command: ['-config.file=/etc/tempo/tempo.yml']
volumes:
- ./observability/tempo/tempo.yml:/etc/tempo/tempo.yml
- logging-tempo-data:/tmp/tempo
ports:
- '3200' # tempo
- '4317' # otlp grpc
- '4318' # otlp http
loki:
profiles:
- observability
image: grafana/loki
ports:
- '3100:3100'
command:
- --config.file=/mnt/config/loki-config.yml
volumes:
- ./observability/loki/loki-config.yml:/mnt/config/loki-config.yml:ro
- logging-loki-data:/loki
promtail:
profiles:
- observability
image: grafana/promtail:latest
volumes:
- ./observability/promtail/promtail-config.yml:/etc/promtail/promtail-config.yml
- /var/run/docker.sock:/var/run/docker.sock
- /var/lib/docker/containers:/var/lib/docker/containers:ro
command: -config.file=/etc/promtail/promtail-config.yml
depends_on:
- loki
grafana:
profiles:
- observability
image: grafana/grafana
volumes:
- logging-grafana-storage:/var/lib/grafana
- ./observability/grafana/provisioning:/etc/grafana/provisioning
- ./observability/grafana/dashboards:/etc/dashboards
environment:
- GF_LOG_LEVEL=error
ports:
- '9050:3000' # localhost:9050 for accessing grafana
redis:
image: redis:alpine
ports:
- '6379:6379'
logging:
driver: none
volumes:
data:
node_modules:
next-cache:
minio-data:
node-cache:
postgress-data:
# Volumes for observability components
logging-prometheus-storage:
logging-grafana-storage:
logging-tempo-data:
logging-loki-data: