Repository navigation
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
478 lines (460 loc) · 15.9 KB
/
Copy pathdocker-compose.yml
File metadata and controls
478 lines (460 loc) · 15.9 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
services:
caddy:
image: caddy:2-alpine
ports:
- "80:80"
environment:
# ":80" makes Caddy serve plain HTTP (no TLS/ACME) — same shared
# Caddyfile as prod, which instead sets SITE_ADDRESS to a public host.
SITE_ADDRESS: ":80"
# HTTP basic auth for the /mailpit UI. Dev credentials: mailpit / mailpit
# (the hash is bcrypt of "mailpit"; $$ escapes $ for compose interpolation).
MAILPIT_BASIC_AUTH_USER: mailpit
MAILPIT_BASIC_AUTH_HASH: "$$2y$$05$$EKc8Qn8M119jQbj.A2W1JuOfZl3O7QJ7LYyrPikreFIG/BgfgQpPu"
volumes:
- ./infra/caddy/Caddyfile:/etc/caddy/Caddyfile:ro
restart: unless-stopped
depends_on:
web-client:
condition: service_started
api-gateway:
condition: service_healthy
networks:
- caredesk
web-client:
build:
# Repo root so the Dockerfile can reach api/openapi.yaml and web-client/
context: .
dockerfile: web-client/Dockerfile
args:
VITE_API_URL: /api/v1
restart: unless-stopped
depends_on:
api-gateway:
condition: service_healthy
environment:
PUBLIC_API_URL: /api/v1
networks:
- caredesk
ai-db:
image: postgres:16-alpine
restart: unless-stopped
environment:
POSTGRES_DB: ai_db
POSTGRES_USER: caredesk
POSTGRES_PASSWORD: caredesk
ports:
- "5436:5432"
volumes:
- ai-db-data:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U caredesk -d ai_db"]
interval: 5s
timeout: 5s
retries: 5
# Generous window: on a fresh volume Postgres has to initdb, run init
# scripts and restart, which can exceed 30s under a heavy first-build on
# WSL2. A long start_period keeps it "starting" (never "unhealthy") until
# it accepts connections.
start_period: 120s
networks:
- caredesk
ai-assistant:
build:
context: ./services/ai-assistant
dockerfile: Dockerfile
restart: unless-stopped
environment:
# Surfaces in the app_info metric; compose builds from source, so no image tag.
APP_VERSION: local
LLM_PROVIDER: openwebui
LLM_MODEL: llama3.2
LLM_API_KEY: ollama
OPENWEBUI_BASE_URL: http://ollama:11434/v1
# Source-of-truth services the assistant pulls live patient context from.
PATIENT_SERVICE_URL: http://patient-service:8082
NOTES_SERVICE_URL: http://notes-service:8083
# Persistent conversation sessions.
DB_HOST: ai-db
DB_PORT: 5432
DB_NAME: ai_db
DB_USER: caredesk
DB_PASSWORD: caredesk
healthcheck:
test: ["CMD-SHELL", "python -c \"import urllib.request; urllib.request.urlopen('http://localhost:8000/ai/health')\""]
interval: 30s
timeout: 10s
retries: 3
start_period: 15s
depends_on:
ollama:
condition: service_healthy
ai-db:
condition: service_healthy
networks:
- caredesk
ollama:
image: ollama/ollama
environment:
OLLAMA_MODEL: llama3.2
entrypoint: >
sh -c "ollama serve &
until ollama list > /dev/null 2>&1; do sleep 1; done &&
ollama pull $$OLLAMA_MODEL &&
wait"
volumes:
- ollama_data:/root/.ollama
restart: unless-stopped
healthcheck:
test: ["CMD-SHELL", "ollama list | grep -q $$OLLAMA_MODEL"]
interval: 15s
timeout: 5s
retries: 120
start_period: 30s
networks:
- caredesk
auth-db:
image: postgres:16-alpine
restart: unless-stopped
environment:
POSTGRES_DB: auth_db
POSTGRES_USER: caredesk
POSTGRES_PASSWORD: caredesk
ports:
- "5432:5432"
volumes:
- auth-db-data:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U caredesk -d auth_db"]
interval: 5s
timeout: 5s
retries: 5
# See ai-db: long window so a fresh-volume first init never flips to unhealthy.
start_period: 120s
networks:
- caredesk
auth-service:
build:
# Build context is the repo root so the Dockerfile can reach both
# services/auth-service AND services/springboot/generated (stubs).
context: .
dockerfile: services/auth-service/Dockerfile
restart: unless-stopped
depends_on:
auth-db:
condition: service_healthy
# No published port — only reachable inside the compose network via the gateway.
environment:
# Surfaces as the `version` tag on all metrics; compose builds from source.
APP_VERSION: local
DB_HOST: auth-db
DB_PORT: 5432
DB_NAME: auth_db
DB_USER: caredesk
DB_PASSWORD: caredesk
# Dev-only secret — override in production via env or secrets management.
JWT_SECRET: caredesk-compose-dev-secret-must-be-at-least-32-chars
# The `dev` profile is the single switch for all demo seeding: it enables
# every service's DemoDataSeeder (auth seeds the demo users; the others
# seed appointments, notes and notifications). Always on for local compose;
# on k8s it is off by default and toggled via the SEED_DEMO GitHub variable
# (helm seedDemoData).
SPRING_PROFILES_ACTIVE: dev
# The administrator is always created from these env vars (never from the
# demo seeding), matching production. Local default creds:
CAREDESK_BOOTSTRAP_ADMIN_ENABLED: "true"
CAREDESK_ADMIN_NAME: Admin
CAREDESK_ADMIN_EMAIL: admin@admin.com
CAREDESK_ADMIN_PASSWORD: admin123
# application.yml ships with ddl-auto: validate for production safety.
# Compose dev profile overrides to `update` so schema is auto-created
# against a fresh Postgres. Production should use proper migrations.
SPRING_JPA_HIBERNATE_DDL_AUTO: update
healthcheck:
test: ["CMD-SHELL", "wget -q -O /dev/null http://localhost:8081/actuator/health || exit 1"]
interval: 10s
timeout: 5s
retries: 5
start_period: 30s
networks:
- caredesk
patient-db:
image: postgres:16-alpine
restart: unless-stopped
environment:
POSTGRES_DB: patient_db
POSTGRES_USER: caredesk
POSTGRES_PASSWORD: caredesk
ports:
- "5433:5432"
volumes:
- patient-db-data:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U caredesk -d patient_db"]
interval: 5s
timeout: 5s
retries: 5
# See ai-db: long window so a fresh-volume first init never flips to unhealthy.
start_period: 120s
networks:
- caredesk
patient-service:
build:
# Build context is the repo root so the Dockerfile can reach both
# services/patient-service AND services/springboot/generated (stubs).
context: .
dockerfile: services/patient-service/Dockerfile
restart: unless-stopped
depends_on:
patient-db:
condition: service_healthy
# No published port — only reachable inside the compose network via the gateway.
environment:
# Surfaces as the `version` tag on all metrics; compose builds from source.
APP_VERSION: local
DB_HOST: patient-db
DB_PORT: 5432
DB_NAME: patient_db
DB_USER: caredesk
DB_PASSWORD: caredesk
# Internal auth-service URL for the cross-service profile lookup.
AUTH_SERVICE_URL: http://auth-service:8081
# Internal notification-service URL for booking-confirmation triggers.
NOTIFICATION_SERVICE_URL: http://notification-service:8084
# The `dev` profile is the single switch that enables this service's
# DemoDataSeeder (demo dataset for presentations, #168). Always on locally.
SPRING_PROFILES_ACTIVE: dev
# application.yml ships with ddl-auto: validate. Compose dev profile
# overrides to update so the schema is auto-created against a fresh DB.
SPRING_JPA_HIBERNATE_DDL_AUTO: update
healthcheck:
test: ["CMD-SHELL", "wget -q -O /dev/null http://localhost:8082/actuator/health || exit 1"]
interval: 10s
timeout: 5s
retries: 5
start_period: 30s
networks:
- caredesk
notes-db:
image: postgres:16-alpine
restart: unless-stopped
environment:
POSTGRES_DB: notes_db
POSTGRES_USER: caredesk
POSTGRES_PASSWORD: caredesk
ports:
- "5434:5432"
volumes:
- notes-db-data:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U caredesk -d notes_db"]
interval: 5s
timeout: 5s
retries: 5
# See ai-db: long window so a fresh-volume first init never flips to unhealthy.
start_period: 120s
networks:
- caredesk
notes-service:
build:
# Build context is the repo root so the Dockerfile can reach both
# services/notes-service AND services/springboot/generated (stubs).
context: .
dockerfile: services/notes-service/Dockerfile
restart: unless-stopped
depends_on:
notes-db:
condition: service_healthy
# No published port — only reachable inside the compose network via the gateway.
environment:
# Surfaces as the `version` tag on all metrics; compose builds from source.
APP_VERSION: local
DB_HOST: notes-db
DB_PORT: 5432
DB_NAME: notes_db
DB_USER: caredesk
DB_PASSWORD: caredesk
# The `dev` profile is the single switch that enables this service's
# DemoDataSeeder (demo dataset for presentations, #168). Always on locally.
SPRING_PROFILES_ACTIVE: dev
# application.yml ships with ddl-auto: validate. Compose dev profile
# overrides to update so the schema is auto-created against a fresh DB.
SPRING_JPA_HIBERNATE_DDL_AUTO: update
healthcheck:
test: ["CMD-SHELL", "wget -q -O /dev/null http://localhost:8083/actuator/health || exit 1"]
interval: 10s
timeout: 5s
retries: 5
start_period: 30s
networks:
- caredesk
notification-db:
image: postgres:16-alpine
restart: unless-stopped
environment:
POSTGRES_DB: notification_db
POSTGRES_USER: caredesk
POSTGRES_PASSWORD: caredesk
ports:
- "5435:5432"
volumes:
- notification-db-data:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U caredesk -d notification_db"]
interval: 5s
timeout: 5s
retries: 5
# See ai-db: long window so a fresh-volume first init never flips to unhealthy.
start_period: 120s
networks:
- caredesk
# Catch-all SMTP server for dev. notification-service sends real SMTP to it;
# Mailpit stores nothing externally and exposes every caught message in a web
# UI reached through Caddy at http://localhost/mailpit (basic auth: mailpit /
# mailpit). No real mail ever leaves the machine.
mailpit:
image: axllent/mailpit:latest
restart: unless-stopped
environment:
# Serve the UI under /mailpit so its assets resolve behind the Caddy route.
MP_WEBROOT: mailpit
# SMTP (1025) is reachable in-cluster by service name; the web UI (8025) is
# fronted by Caddy at /mailpit, so no host ports are published.
networks:
- caredesk
notification-service:
build:
# Build context is the repo root so the Dockerfile can reach both
# services/notification-service AND services/springboot/generated (stubs).
context: .
dockerfile: services/notification-service/Dockerfile
restart: unless-stopped
depends_on:
notification-db:
condition: service_healthy
# No published port — only reachable inside the compose network via the gateway.
environment:
# Surfaces as the `version` tag on all metrics; compose builds from source.
APP_VERSION: local
DB_HOST: notification-db
DB_PORT: 5432
DB_NAME: notification_db
DB_USER: caredesk
DB_PASSWORD: caredesk
# The `dev` profile is the single switch that enables this service's
# DemoDataSeeder (demo dataset for presentations, #168). Always on locally.
SPRING_PROFILES_ACTIVE: dev
# application.yml ships with ddl-auto: validate. Compose dev profile
# overrides to update so the schema is auto-created against a fresh DB.
SPRING_JPA_HIBERNATE_DDL_AUTO: update
# SMTP target is the Mailpit container (no auth, no TLS).
SMTP_HOST: mailpit
SMTP_PORT: 1025
# Reminder scheduler reads upcoming appointments from patient-service.
PATIENT_SERVICE_URL: http://patient-service:8082
healthcheck:
test: ["CMD-SHELL", "wget -q -O /dev/null http://localhost:8084/actuator/health || exit 1"]
interval: 10s
timeout: 5s
retries: 5
start_period: 30s
networks:
- caredesk
api-gateway:
build:
# Build context is the repo root so the Dockerfile can reach api/openapi.yaml
# and bundle it (served at /api/v1/openapi.yaml with Swagger UI at /api/v1/docs).
context: .
dockerfile: services/api-gateway/Dockerfile
restart: unless-stopped
depends_on:
auth-service:
condition: service_healthy
patient-service:
condition: service_healthy
notes-service:
condition: service_healthy
notification-service:
condition: service_healthy
ports:
- "8080:8080"
environment:
# Surfaces as the `version` tag on all metrics; compose builds from source.
APP_VERSION: local
AUTH_SERVICE_URL: http://auth-service:8081
AI_ASSISTANT_URL: http://ai-assistant:8000
PATIENT_SERVICE_URL: http://patient-service:8082
NOTES_SERVICE_URL: http://notes-service:8083
NOTIFICATION_SERVICE_URL: http://notification-service:8084
# Must match auth-service's JWT_SECRET so issued tokens verify.
JWT_SECRET: caredesk-compose-dev-secret-must-be-at-least-32-chars
healthcheck:
test: ["CMD-SHELL", "wget -q -O /dev/null http://localhost:8080/actuator/health || exit 1"]
interval: 10s
timeout: 5s
retries: 5
start_period: 30s
networks:
- caredesk
prometheus:
image: prom/prometheus:v3.13.1
volumes:
- ./infra/prometheus/prometheus.yml:/etc/prometheus/prometheus.yml:ro
- prometheus-data:/prometheus
command:
- '--config.file=/etc/prometheus/prometheus.yml'
- '--storage.tsdb.path=/prometheus'
- '--storage.tsdb.retention.time=7d'
ports:
- "9090:9090"
restart: unless-stopped
depends_on:
api-gateway:
condition: service_healthy
networks:
- caredesk
grafana:
image: grafana/grafana:11.6.16
# No host port published — reached through Caddy at http://localhost/grafana
# (matches the prod sub-path setup so dev and prod behave the same).
expose:
- "3000"
environment:
GF_SECURITY_ADMIN_USER: admin
GF_SECURITY_ADMIN_PASSWORD: admin
GF_AUTH_ANONYMOUS_ENABLED: "false"
GF_SERVER_ROOT_URL: http://localhost/grafana
GF_SERVER_SERVE_FROM_SUB_PATH: "true"
PROMETHEUS_URL: http://prometheus:9090
# Alert delivery (provisioning/alerting/contact-points.yaml). The
# placeholder keeps Grafana provisioning valid when no webhook is set —
# alerts then only show in the UI. Set a real URL in .env to deliver.
DISCORD_WEBHOOK_URL: ${DISCORD_WEBHOOK_URL:-https://alerts-disabled.invalid/discord}
# SMTP relay for the caredesk-mailpit-email alert contact point — delivers
# alert emails into the Mailpit inbox. skipVerify because Mailpit is
# plaintext (no TLS cert to validate).
GF_SMTP_ENABLED: "true"
GF_SMTP_HOST: mailpit:1025
GF_SMTP_FROM_ADDRESS: grafana-alerts@caredesk.local
GF_SMTP_SKIP_VERIFY: "true"
volumes:
- ./infra/grafana/provisioning:/etc/grafana/provisioning:ro
- ./infra/grafana/dashboards:/var/lib/grafana/dashboards:ro
- grafana-data:/var/lib/grafana
restart: unless-stopped
depends_on:
- prometheus
networks:
- caredesk
networks:
caredesk:
driver: bridge
volumes:
auth-db-data:
patient-db-data:
notes-db-data:
notification-db-data:
ai-db-data:
ollama_data:
prometheus-data:
grafana-data: