-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
537 lines (505 loc) · 17.8 KB
/
Copy pathdocker-compose.yml
File metadata and controls
537 lines (505 loc) · 17.8 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
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
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
# Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0.
# This product includes software developed at Datadog (https://www.datadoghq.com/).
# Copyright 2025-Present Datadog, Inc.
# Stickerlandia Service Endpoints
# -------------------------------
# - Sticker Catalogue API:
# - Sticker catalog: http://localhost:8080/api/stickers/v1
# - Sticker image: http://localhost:8080/api/stickers/v1/sticker-001/image
#
# - Sticker Award API:
# - User assignments: http://localhost:8080/api/awards/v1/assignments/user-001
# - Award sticker: http://localhost:8080/api/awards/v1/assignments
#
# - User Management API: http://localhost:8080/api/users
# - Registration: http://localhost:8080/api/users/v1/register
# - Login: http://localhost:8080/api/users/v1/login
#
# - Traefik Dashboard: http://localhost:8081/dashboard/
# - Redpanda Console: http://localhost:8082
#
#
# Signing Up
# ---------
# curl -X POST http://localhost:8080/api/users/v1/register \
# -H "Content-Type: application/json" \
# -d '{
# "firstName": "John",
# "lastName": "Doe",
# "emailAddress": "john.doe@example.com",
# "password": "ValidPass123!"
# }'
#
#
# Logging In
# ----------
# curl -X POST http://localhost:8080/api/users/v1/login \
# -H "Content-Type: application/x-www-form-urlencoded" \
# -d "grant_type=password&username=john.doe@example.com&password=ValidPass123!&client_id=user-authentication&client_secret=388D45FA-B36B-4988-BA59-B187D329C207"
#
# Assigning a Sticker
# -------------------
# curl -X POST http://localhost:8080/api/awards/v1/assignments/user-123 \
# -H "Content-Type: application/json" \
# -d '{
# "stickerId": "sticker-001",
# "reason": "Excellent debugging work on the payment gateway issue"
# }'
#
services:
traefik:
image: traefik:v3.6
container_name: traefik
ports:
- "8080:80" # App traffic
- "8081:8080" # Dashboard
command:
- --api.dashboard=true
- --api.insecure=true
- --entrypoints.web.address=:80
- --entrypoints.dashboard.address=:8081
- --providers.docker=true
- --providers.docker.exposedbydefault=false
volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro
healthcheck:
test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:8080/api/entrypoints"]
interval: 1s
timeout: 10s
retries: 5
labels:
- "traefik.enable=true"
- "traefik.http.routers.traefik.rule=PathPrefix(`/dashboard`)"
- "traefik.http.routers.traefik.service=api@internal"
- "traefik.http.routers.traefik.entrypoints=dashboard"
redpanda:
image: redpandadata/redpanda:latest
container_name: stickerlandia-redpanda
command:
- redpanda
- start
- --smp=1
- --memory=1G
- --reserve-memory=0M
- --overprovisioned
- --node-id=0
- --check=false
- --pandaproxy-addr=0.0.0.0:8082
- --advertise-pandaproxy-addr=redpanda:8082
- --kafka-addr=0.0.0.0:9092
- --advertise-kafka-addr=redpanda:9092
- --rpc-addr=0.0.0.0:33145
- --advertise-rpc-addr=redpanda:33145
- --mode dev-container
ports:
- "9092:9092"
# - "8082:8082"
- "9644:9644"
volumes:
- redpanda-data:/var/lib/redpanda/data
healthcheck:
test: ["CMD", "rpk", "cluster", "health"]
interval: 1s
timeout: 10s
retries: 5
redpanda-init:
image: redpandadata/redpanda:latest
container_name: redpanda-init
depends_on:
redpanda:
condition: service_healthy
entrypoint: ["/bin/sh", "-c"]
command: >
"rpk topic create users.userRegistered.v1 users.stickerClaimed.v1 users.userDetailsUpdated.v1 stickers.stickerAssignedToUser.v1 stickers.stickerRemovedFromUser.v1 stickers.stickerAdded.v1 stickers.stickerUpdated.v1 stickers.stickerDeleted.v1 --brokers redpanda:9092 || true"
restart: "no"
redpanda-console:
image: redpandadata/console:latest
container_name: stickerlandia-redpanda-console
depends_on:
redpanda:
condition: service_healthy
ports:
- "8082:8080"
environment:
KAFKA_BROKERS: redpanda:9092
# REDPANDA_ADMIN_API_URLS: http://redpanda:9644
healthcheck:
test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:8080"]
interval: 1s
timeout: 10s
retries: 5
sticker-catalogue-db:
image: postgres:16
container_name: sticker-catalogue-db
environment:
POSTGRES_DB: sticker_catalogue
POSTGRES_USER: sticker_user
POSTGRES_PASSWORD: sticker_password
ports:
- "5432:5432"
volumes:
- sticker-catalogue-data:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U sticker_user -d sticker_catalogue"]
interval: 1s
timeout: 10s
retries: 5
sticker-award-db:
image: postgres:16
container_name: sticker-award-db
environment:
POSTGRES_DB: sticker_awards
POSTGRES_USER: sticker_user
POSTGRES_PASSWORD: sticker_password
ports:
- "5434:5432"
volumes:
- sticker-award-data:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U sticker_user -d sticker_awards"]
interval: 1s
timeout: 10s
retries: 5
user-management-db:
image: postgres:16
container_name: user-management-db
environment:
POSTGRES_DB: user_management
POSTGRES_USER: user_mgmt_user
POSTGRES_PASSWORD: user_mgmt_password
ports:
- "5433:5432"
volumes:
- user-management-data:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U user_mgmt_user -d user_management"]
interval: 1s
timeout: 10s
retries: 5
minio:
image: minio/minio:latest
container_name: stickerlandia-minio
ports:
- "9000:9000"
- "9001:9001"
environment:
MINIO_ROOT_USER: minioadmin
MINIO_ROOT_PASSWORD: minioadmin
command: server /data --console-address ":9001"
volumes:
- minio-data:/data
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:9000/minio/health/live"]
interval: 1s
timeout: 10s
retries: 3
minio-init:
image: minio/mc:latest
container_name: minio-init
depends_on:
minio:
condition: service_healthy
entrypoint: ["/bin/sh", "-c"]
command: >
"mc alias set myminio http://minio:9000 minioadmin minioadmin &&
mc mb myminio/sticker-images --ignore-existing"
restart: "no"
sticker-catalogue:
build:
context: ./sticker-catalogue
dockerfile: src/main/docker/Dockerfile.jvmlocal
container_name: sticker-catalogue
depends_on:
sticker-catalogue-db:
condition: service_healthy
redpanda:
condition: service_healthy
minio:
condition: service_healthy
minio-init:
condition: service_completed_successfully
environment:
# Quarkus profile - use prod-kafka for Kafka messaging
QUARKUS_PROFILE: prod-kafka
# DataDog APM configuration
DD_SERVICE: sticker-catalogue
DD_ENV: development
DD_VERSION: ${COMMIT_SHA:-latest}
DD_AGENT_HOST: datadog-agent
DD_DATA_STREAMS_ENABLED: "true"
DD_TRACE_REMOVE_INTEGRATION_SERVICE_NAMES_ENABLED: "true"
# Database configuration
QUARKUS_DATASOURCE_JDBC_URL: jdbc:postgresql://sticker-catalogue-db:5432/sticker_catalogue
QUARKUS_DATASOURCE_USERNAME: sticker_user
QUARKUS_DATASOURCE_PASSWORD: sticker_password
QUARKUS_DATASOURCE_DB_KIND: postgresql
# Kafka configuration
KAFKA_BOOTSTRAP_SERVERS: redpanda:9092
MP_MESSAGING_CONNECTOR_SMALLRYE_KAFKA_BOOTSTRAP_SERVERS: redpanda:9092
# S3/MinIO configuration
QUARKUS_S3_ENDPOINT_OVERRIDE: http://minio:9000
QUARKUS_S3_AWS_REGION: us-east-1
QUARKUS_S3_AWS_CREDENTIALS_TYPE: static
QUARKUS_S3_AWS_CREDENTIALS_STATIC_PROVIDER_ACCESS_KEY_ID: minioadmin
QUARKUS_S3_AWS_CREDENTIALS_STATIC_PROVIDER_SECRET_ACCESS_KEY: minioadmin
QUARKUS_S3_PATH_STYLE_ACCESS: "true"
STICKER_IMAGES_BUCKET: sticker-images
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8080/api/stickers/v1/"]
interval: 5s
timeout: 5s
retries: 3
start_period: 60s
labels:
- "traefik.enable=true"
- "traefik.http.routers.sticker-catalogue.rule=PathPrefix(`/api/stickers`)"
- "traefik.http.routers.sticker-catalogue.priority=100"
- "traefik.http.services.sticker-catalogue.loadbalancer.server.port=8080"
user-management:
build:
context: ./user-management
dockerfile: src/Stickerlandia.UserManagement.Api/Dockerfile
container_name: user-management
depends_on:
user-management-db:
condition: service_healthy
redpanda:
condition: service_healthy
user-management-db-migrations:
condition: service_completed_successfully
environment:
# DataDog APM configuration
DD_SERVICE: user-management
DD_ENV: development
DD_VERSION: ${COMMIT_SHA:-latest}
DD_AGENT_HOST: datadog-agent
DD_DATA_STREAMS_ENABLED: true
DD_TRACE_OTEL_ENABLED: "true"
DD_LOGS_INJECTION: "true"
DD_RUNTIME_METRICS_ENABLED: "true"
# Application configuration
ASPNETCORE_ENVIRONMENT: Development
DRIVING: AGNOSTIC
DRIVEN: AGNOSTIC
DISABLE_SSL: "true"
ConnectionStrings__messaging: "redpanda:9092"
ConnectionStrings__database: "Host=user-management-db;Port=5432;Database=user_management;Username=user_mgmt_user;Password=user_mgmt_password"
KAFKA__BOOTSTRAPSERVERS: "redpanda:9092"
KAFKA__SCHEMAREGISTRY: "http://redpanda:8082"
KAFKA__GROUPID: "stickerlandia-user-management"
OPENIDDICT_ISSUER: ${DEPLOYMENT_HOST_URL}
DEPLOYMENT_HOST_URL: ${DEPLOYMENT_HOST_URL}
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8080/api/users/v1/health"]
interval: 1s
timeout: 15s
retries: 10
labels:
- "traefik.enable=true"
- "traefik.http.routers.user-management.rule=PathPrefix(`/api/users`)"
- "traefik.http.routers.user-management.priority=100"
- "traefik.http.routers.auth.rule=PathRegexp(`(?i)^/auth`)"
- "traefik.http.routers.auth.priority=100"
- "traefik.http.services.user-management.loadbalancer.server.port=8080"
user-management-worker:
build:
context: ./user-management
dockerfile: src/Stickerlandia.UserManagement.Worker/Dockerfile
container_name: user-management-worker
depends_on:
user-management-db:
condition: service_healthy
redpanda:
condition: service_healthy
environment:
# DataDog APM configuration
DD_SERVICE: user-management-worker
DD_ENV: development
DD_VERSION: ${COMMIT_SHA:-latest}
DD_AGENT_HOST: datadog-agent
DD_DATA_STREAMS_ENABLED: true
DD_TRACE_OTEL_ENABLED: "true"
DD_LOGS_INJECTION: "true"
DD_RUNTIME_METRICS_ENABLED: "true"
ASPNETCORE_ENVIRONMENT: Development
DRIVING: AGNOSTIC
DRIVEN: AGNOSTIC
ConnectionStrings__messaging: "redpanda:9092"
ConnectionStrings__database: "Host=user-management-db;Port=5432;Database=user_management;Username=user_mgmt_user;Password=user_mgmt_password"
KAFKA__BOOTSTRAPSERVERS: "redpanda:9092"
KAFKA__SCHEMAREGISTRY: "http://redpanda:8082"
KAFKA__GROUPID: "stickerlandia-user-management"
command: ["worker/Stickerlandia.UserManagement.Worker.dll"]
user-management-db-migrations:
build:
context: ./user-management
dockerfile: src/Stickerlandia.UserManagement.MigrationService/Dockerfile
container_name: user-management-migrations
depends_on:
user-management-db:
condition: service_healthy
environment:
# DataDog APM configuration
DD_SERVICE: user-management-migration-service
DD_ENV: development
DD_VERSION: ${COMMIT_SHA:-latest}
DD_AGENT_HOST: datadog-agent
DD_TRACE_OTEL_ENABLED: "true"
DD_LOGS_INJECTION: "true"
DD_RUNTIME_METRICS_ENABLED: "true"
ASPNETCORE_ENVIRONMENT: Development
DRIVING: AGNOSTIC
DRIVEN: AGNOSTIC
ConnectionStrings__messaging: "redpanda:9092"
ConnectionStrings__database: "Host=user-management-db;Port=5432;Database=user_management;Username=user_mgmt_user;Password=user_mgmt_password"
KAFKA__BOOTSTRAPSERVERS: "redpanda:9092"
KAFKA__SCHEMAREGISTRY: "http://redpanda:8082"
KAFKA__GROUPID: "stickerlandia-user-management"
DEPLOYMENT_HOST_URL: ${DEPLOYMENT_HOST_URL}
command: ["migrations/Stickerlandia.UserManagement.MigrationService.dll"]
web-backend:
build:
context: ./web-backend
dockerfile: Dockerfile
container_name: web-backend
depends_on:
user-management:
condition: service_healthy
environment:
# DataDog APM configuration
DD_SERVICE: web-backend
DD_ENV: development
DD_VERSION: ${COMMIT_SHA:-latest}
DD_AGENT_HOST: datadog-agent
# Application configuration
NODE_ENV: development
OAUTH_ISSUER_INTERNAL: http://user-management:8080
OAUTH_CLIENT_ID: web-ui
OAUTH_CLIENT_SECRET: stickerlandia-web-ui-secret-2025
DEPLOYMENT_HOST_URL: ${DEPLOYMENT_HOST_URL}
labels:
- "traefik.enable=true"
- "traefik.http.routers.web-backend.rule=PathPrefix(`/api/app`)"
- "traefik.http.routers.web-backend.priority=100"
- "traefik.http.services.web-backend.loadbalancer.server.port=3000"
web-frontend:
build:
context: ./web-frontend
dockerfile: Dockerfile
environment:
# Application configuration
NODE_ENV: production
# Datadog RUM configuration (runtime injection via vite-envs)
DD_RUM_APPLICATION_ID: ${DD_RUM_APPLICATION_ID}
DD_RUM_CLIENT_TOKEN: ${DD_RUM_CLIENT_TOKEN}
DD_SITE: ${DD_SITE:-datadoghq.eu}
DD_ENV: production
DD_VERSION: ${COMMIT_SHA:-latest}
DD_SERVICE: web-frontend
labels:
- "traefik.enable=true"
- "traefik.http.routers.web-frontend.rule=PathPrefix(`/`)"
- "traefik.http.routers.web-frontend.priority=1"
- "traefik.http.services.web-frontend.loadbalancer.server.port=80"
sticker-award:
build:
context: ./sticker-award
dockerfile: Dockerfile
container_name: sticker-award
depends_on:
sticker-catalogue:
condition: service_healthy
sticker-award-db:
condition: service_healthy
redpanda:
condition: service_healthy
redpanda-init:
condition: service_completed_successfully
environment:
# DataDog APM configuration
DD_SERVICE: sticker-award
DD_ENV: development
DD_VERSION: ${COMMIT_SHA:-latest}
DD_AGENT_HOST: datadog-agent
DD_DATA_STREAMS_ENABLED: true
# Server configuration
SERVER_PORT: 8080
# Database configuration
DATABASE_HOST: sticker-award-db
DATABASE_PORT: 5432
DATABASE_USER: sticker_user
DATABASE_PASSWORD: sticker_password
DATABASE_NAME: sticker_awards
DATABASE_SSL_MODE: disable
# Logging configuration
LOG_LEVEL: info
LOG_FORMAT: json
# Kafka configuration
KAFKA_BROKERS: redpanda:9092
KAFKA_GROUP_ID: sticker-award-service
# External service configuration
CATALOGUE_BASE_URL: http://sticker-catalogue:8080
# OAuth/JWT configuration
# OAUTH_ISSUER: The issuer claim expected in JWT tokens (matches what user-management sets)
# Note: OpenIddict adds trailing slash to issuer, so we must include it here
# OAUTH_JWKS_URL: Internal Docker network URL to fetch JWKS for token validation
OAUTH_ISSUER: ${DEPLOYMENT_HOST_URL}/
OAUTH_JWKS_URL: http://user-management:8080/.well-known/jwks
healthcheck:
test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:8080/health"]
interval: 1s
timeout: 10s
retries: 3
start_period: 40s
labels:
- "traefik.enable=true"
- "traefik.http.routers.sticker-award.rule=PathPrefix(`/api/awards`)"
- "traefik.http.routers.sticker-award.priority=100"
- "traefik.http.services.sticker-award.loadbalancer.server.port=8080"
datadog-agent:
image: datadog/agent:7
container_name: datadog-agent
profiles:
- monitoring
environment:
# Core Datadog configuration
- DD_API_KEY=${DD_API_KEY}
- DD_SITE=${DD_SITE:-datadoghq.eu}
- DD_HOSTNAME=stickerlandia-dev
- DD_TAGS=env:development,project:stickerlandia
# APM (Application Performance Monitoring) configuration
- DD_APM_ENABLED=true
- DD_APM_NON_LOCAL_TRAFFIC=true
- DD_APM_RECEIVER_PORT=8126
# Log collection configuration
- DD_LOGS_ENABLED=true
- DD_LOGS_CONFIG_CONTAINER_COLLECT_ALL=true
- DD_LOGS_CONFIG_AUTO_MULTI_LINE_DETECTION=true
# Container monitoring
- DD_CONTAINER_EXCLUDE_LOGS=name:datadog-agent
- DD_CONTAINER_EXCLUDE_METRICS=name:datadog-agent
# OTLP configuration for OpenTelemetry
- DD_OTLP_CONFIG_RECEIVER_PROTOCOLS_GRPC_ENDPOINT=0.0.0.0:4317
- DD_OTLP_CONFIG_RECEIVER_PROTOCOLS_HTTP_ENDPOINT=0.0.0.0:4318
# Docker integration
- DD_DOCKER_LABELS_AS_TAGS=true
- DD_DOCKER_ENV_AS_TAGS=true
volumes:
# Docker socket for container monitoring
- /var/run/docker.sock:/var/run/docker.sock:ro
# System directories for host metrics
- /proc/:/host/proc/:ro
- /sys/fs/cgroup/:/host/sys/fs/cgroup:ro
restart: unless-stopped
healthcheck:
test: ["CMD", "agent", "health"]
interval: 2s
timeout: 30s
retries: 20
start_period: 40s
volumes:
sticker-catalogue-data:
sticker-award-data:
user-management-data:
redpanda-data:
minio-data: