-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdocker-compose.yml
521 lines (487 loc) · 13 KB
/
docker-compose.yml
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
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
services:
read:
image: grafana/loki:3.0.0
container_name: loki-read
command: "-config.file=/etc/loki/config.yaml -target=read"
ports:
- "3101:3100"
- "7946"
- "9095"
volumes:
- ./observability/loki/loki-config.yaml:/etc/loki/config.yaml
depends_on:
- minio
healthcheck:
test: [ "CMD-SHELL", "wget --no-verbose --tries=1 --spider http://localhost:3100/ready || exit 1" ]
interval: 10s
timeout: 5s
retries: 5
networks: &loki-dns
bank-loan:
aliases:
- loki
write:
image: grafana/loki:3.0.0
container_name: loki-write
command: "-config.file=/etc/loki/config.yaml -target=write"
ports:
- "3102:3100"
- "7946"
- "9095"
volumes:
- ./observability/loki/loki-config.yaml:/etc/loki/config.yaml
healthcheck:
test: [ "CMD-SHELL", "wget --no-verbose --tries=1 --spider http://localhost:3100/ready || exit 1" ]
interval: 10s
timeout: 5s
retries: 5
depends_on:
- minio
networks:
<<: *loki-dns
alloy:
image: grafana/alloy-dev:latest
container_name: alloy
volumes:
- ./observability/alloy/alloy-local-config.yaml:/etc/alloy/config.alloy:ro
- /var/run/docker.sock:/var/run/docker.sock
command: run --server.http.listen-addr=0.0.0.0:12345 --storage.path=/var/lib/alloy/data /etc/alloy/config.alloy
ports:
- 12345:12345
depends_on:
- gateway
networks:
- bank-loan
minio:
image: minio/minio
container_name: minio
entrypoint:
- sh
- -euc
- |
mkdir -p /data/loki-data && \
mkdir -p /data/loki-ruler && \
minio server /data
environment:
- MINIO_ROOT_USER=loki
- MINIO_ROOT_PASSWORD=supersecret
- MINIO_PROMETHEUS_AUTH_TYPE=public
- MINIO_UPDATE=off
ports:
- 9000
volumes:
- ./.data/minio:/data
healthcheck:
test: [ "CMD", "curl", "-f", "http://localhost:9000/minio/health/live" ]
interval: 15s
timeout: 20s
retries: 5
networks:
- bank-loan
prometheus:
image: prom/prometheus:v2.50.1
container_name: prometheus
ports:
- "9090:9090"
volumes:
- ./observability/prometheus/prometheus.yml:/etc/prometheus/prometheus.yml
networks:
- bank-loan
tempo:
image: grafana/tempo:latest
container_name: tempo
command: -config.file /etc/tempo-config.yml
volumes:
- ./observability/tempo/tempo.yml:/etc/tempo-config.yml
ports:
- "3110:3100"
- "4317:4317"
healthcheck:
test: [ "CMD", "curl", "-f", "http://localhost:4317/health" ]
interval: 15s
timeout: 20s
retries: 20
networks:
- bank-loan
grafana:
image: grafana/grafana:latest
container_name: grafana
environment:
- GF_PATHS_PROVISIONING=/etc/grafana/provisioning
- GF_AUTH_ANONYMOUS_ENABLED=true
- GF_AUTH_ANONYMOUS_ORG_ROLE=Admin
depends_on:
- gateway
entrypoint:
- sh
- -euc
- |
/run.sh
ports:
- "3000:3000"
volumes:
- ./observability/grafana/datasource.yml:/etc/grafana/provisioning/datasources/datasource.yml
healthcheck:
test: [ "CMD-SHELL", "wget --no-verbose --tries=1 --spider http://localhost:3000/api/health || exit 1" ]
interval: 10s
timeout: 5s
retries: 5
networks:
- bank-loan
backend:
image: grafana/loki:3.0.0
container_name: loki-backend
volumes:
- ./observability/loki/loki-config.yaml:/etc/loki/config.yaml
ports:
- "3100"
- "7946"
command: "-config.file=/etc/loki/config.yaml -target=backend -legacy-read-mode=false"
depends_on:
- gateway
networks:
- bank-loan
gateway:
image: nginx:latest
container_name: grafana-gateway
depends_on:
- read
- write
entrypoint:
- sh
- -euc
- |
cat <<EOF > /etc/nginx/nginx.conf
user nginx;
worker_processes 5; ## Default: 1
events {
worker_connections 1000;
}
http {
resolver 127.0.0.11;
server {
listen 3100;
location = / {
return 200 'OK';
auth_basic off;
}
location = /api/prom/push {
proxy_pass http://write:3100\$$request_uri;
}
location = /api/prom/tail {
proxy_pass http://read:3100\$$request_uri;
proxy_set_header Upgrade \$$http_upgrade;
proxy_set_header Connection "upgrade";
}
location ~ /api/prom/.* {
proxy_pass http://read:3100\$$request_uri;
}
location = /loki/api/v1/push {
proxy_pass http://write:3100\$$request_uri;
}
location = /loki/api/v1/tail {
proxy_pass http://read:3100\$$request_uri;
proxy_set_header Upgrade \$$http_upgrade;
proxy_set_header Connection "upgrade";
}
location ~ /loki/api/.* {
proxy_pass http://read:3100\$$request_uri;
}
}
}
EOF
/docker-entrypoint.sh nginx -g "daemon off;"
ports:
- "3100:3100"
healthcheck:
test: [ "CMD", "service", "nginx", "status" ]
interval: 10s
timeout: 5s
retries: 5
networks:
- bank-loan
keycloak:
image: quay.io/keycloak/keycloak:24.0.1
container_name: keycloak
ports:
- "7080:8080"
environment:
KEYCLOAK_ADMIN: "admin"
KEYCLOAK_ADMIN_PASSWORD: "admin"
command: "start-dev"
networks:
- bank-loan
rabbitmq:
image: "rabbitmq:3.13.3-management"
container_name: rabbitmq
hostname: "rabbitmq"
ports:
- "5672:5672"
- "15672:15672"
depends_on:
gateway:
condition: service_healthy
healthcheck:
test: rabbitmq-diagnostics check_port_connectivity
interval: 30s
timeout: 10s
retries: 5
start_period: 40s
networks:
- bank-loan
redis:
image: redis
container_name: redis
ports:
- "6379:6379"
healthcheck:
test: [ "CMD-SHELL", "redis-cli ping | grep PONG" ]
timeout: 10s
retries: 5
start_period: 40s
networks:
- bank-loan
deploy:
resources:
limits:
cpus: '2'
memory: 2G
reservations:
cpus: '1'
memory: 1G
accounts-db:
image: postgres
container_name: accountsdb
environment:
POSTGRES_USER: root
POSTGRES_PASSWORD: root
POSTGRES_DB: accountsdb
networks:
- accounts-db
deploy:
resources:
limits:
cpus: '0.5'
memory: 512M
reservations:
cpus: '0.25'
memory: 256M
cards-db:
image: postgres
container_name: cardsdb
environment:
POSTGRES_USER: root
POSTGRES_PASSWORD: root
POSTGRES_DB: cardsdb
networks:
- cards-db
deploy:
resources:
limits:
cpus: '0.5'
memory: 512M
reservations:
cpus: '0.25'
memory: 256M
loans-db:
image: postgres
container_name: loansdb
environment:
POSTGRES_USER: root
POSTGRES_PASSWORD: root
POSTGRES_DB: loansdb
networks:
- loans-db
deploy:
resources:
limits:
cpus: '0.5'
memory: 512M
reservations:
cpus: '0.25'
memory: 256M
config-server:
image: "helmyl/config-server"
container_name: config-server
ports:
- "8071:8071"
depends_on:
rabbitmq:
condition: service_healthy
redis:
condition: service_healthy
healthcheck:
test: "curl --fail --silent localhost:8071/actuator/health/readiness | grep UP || exit 1"
interval: 30s
timeout: 10s
retries: 5
start_period: 40s
networks:
- bank-loan
environment:
SPRING_RABBITMQ_HOST: "rabbitmq"
JAVA_TOOL_OPTIONS: "-javaagent:/app/libs/opentelemetry-javaagent-1.32.0.jar"
OTEL_EXPORTER_OTLP_ENDPOINT: http://tempo:4317
OTEL_METRICS_EXPORTER: none
OTEL_SERVICE_NAME: config-server
eureka-server:
image: "helmyl/eureka-server"
container_name: eureka-server
ports:
- "8070:8070"
depends_on:
config-server:
condition: service_healthy
redis:
condition: service_healthy
environment:
SPRING_CONFIG_IMPORT: configserver:http://config-server:8071/
SPRING_RABBITMQ_HOST: "rabbitmq"
JAVA_TOOL_OPTIONS: "-javaagent:/app/libs/opentelemetry-javaagent-1.32.0.jar"
OTEL_EXPORTER_OTLP_ENDPOINT: http://tempo:4317
OTEL_METRICS_EXPORTER: none
OTEL_SERVICE_NAME: eureka-server
healthcheck:
test: "curl --fail --silent localhost:8070/actuator/health/readiness | grep UP || exit 1"
interval: 30s
timeout: 10s
retries: 5
start_period: 40s
networks:
- bank-loan
cards:
image: "helmyl/cards-ms"
container_name: cards-ms
healthcheck:
test: "curl --fail --silent localhost:9000/actuator/health/readiness | grep UP || exit 1"
interval: 30s
timeout: 10s
retries: 5
start_period: 40s
depends_on:
config-server:
condition: service_healthy
redis:
condition: service_healthy
environment:
SPRING_CONFIG_IMPORT: configserver:http://config-server:8071/
SPRING_RABBITMQ_HOST: "rabbitmq"
SPRING_DATASOURCE_URL: jdbc:postgresql://cards-db:5432/cardsdb
EUREKA_CLIENT_SERVICEURL_DEFAULTZONE: http://eureka-server:8070/eureka/
JAVA_TOOL_OPTIONS: "-javaagent:/app/libs/opentelemetry-javaagent-1.32.0.jar"
OTEL_EXPORTER_OTLP_ENDPOINT: http://tempo:4317
OTEL_METRICS_EXPORTER: none
OTEL_SERVICE_NAME: cards-ms
networks:
- bank-loan
- cards-db
deploy:
resources:
limits:
cpus: '0.5'
memory: 512M
reservations:
cpus: '0.25'
memory: 256M
loans:
image: "helmyl/loans-ms"
container_name: loans-ms
healthcheck:
test: "curl --fail --silent localhost:8090/actuator/health/readiness | grep UP || exit 1"
interval: 30s
timeout: 10s
retries: 5
start_period: 40s
depends_on:
config-server:
condition: service_healthy
redis:
condition: service_healthy
environment:
SPRING_CONFIG_IMPORT: configserver:http://config-server:8071/
SPRING_RABBITMQ_HOST: "rabbitmq"
SPRING_DATASOURCE_URL: jdbc:postgresql://loans-db:5432/loansdb
EUREKA_CLIENT_SERVICEURL_DEFAULTZONE: http://eureka-server:8070/eureka/
JAVA_TOOL_OPTIONS: "-javaagent:/app/libs/opentelemetry-javaagent-1.32.0.jar"
OTEL_EXPORTER_OTLP_ENDPOINT: http://tempo:4317
OTEL_METRICS_EXPORTER: none
OTEL_SERVICE_NAME: loans-ms
networks:
- bank-loan
- loans-db
deploy:
resources:
limits:
cpus: '0.5'
memory: 512M
reservations:
cpus: '0.25'
memory: 256M
accounts:
image: "helmyl/accounts-ms"
container_name: accounts-ms
healthcheck:
test: "curl --fail --silent localhost:8080/actuator/health/readiness | grep UP || exit 1"
interval: 30s
timeout: 10s
retries: 5
start_period: 40s
depends_on:
cards:
condition: service_started
loans:
condition: service_started
environment:
SPRING_CONFIG_IMPORT: configserver:http://config-server:8071/
SPRING_RABBITMQ_HOST: "rabbitmq"
SPRING_DATASOURCE_URL: jdbc:postgresql://accounts-db:5432/accountsdb
EUREKA_CLIENT_SERVICEURL_DEFAULTZONE: http://eureka-server:8070/eureka/
JAVA_TOOL_OPTIONS: "-javaagent:/app/libs/opentelemetry-javaagent-1.32.0.jar"
OTEL_EXPORTER_OTLP_ENDPOINT: http://tempo:4317
OTEL_METRICS_EXPORTER: none
OTEL_SERVICE_NAME: accounts-ms
networks:
- bank-loan
- accounts-db
- cards-db
- loans-db
deploy:
resources:
limits:
cpus: '0.5'
memory: 512M
reservations:
cpus: '0.25'
memory: 256M
gateway-server:
image: "helmyl/gateway-server"
container_name: gateway-server
ports:
- "8072:8072"
depends_on:
accounts:
condition: service_started
redis:
condition: service_healthy
environment:
SPRING_CONFIG_IMPORT: configserver:http://config-server:8071/
SPRING_RABBITMQ_HOST: "rabbitmq"
EUREKA_CLIENT_SERVICEURL_DEFAULTZONE: http://eureka-server:8070/eureka/
JAVA_TOOL_OPTIONS: "-javaagent:/app/libs/opentelemetry-javaagent-1.32.0.jar"
OTEL_EXPORTER_OTLP_ENDPOINT: http://tempo:4317
OTEL_METRICS_EXPORTER: none
OTEL_SERVICE_NAME: gateway-server
networks:
- bank-loan
- accounts-db
- cards-db
- loans-db
networks:
bank-loan:
driver: bridge
accounts-db:
driver: bridge
cards-db:
driver: bridge
loans-db:
driver: bridge