-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
91 lines (86 loc) · 2.74 KB
/
Copy pathdocker-compose.yml
File metadata and controls
91 lines (86 loc) · 2.74 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
services:
redis:
image: redis:7-alpine
container_name: redis
command: ["redis-server", "--save", "", "--appendonly", "no"]
ports: ["6379:6379"]
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 5s
timeout: 3s
retries: 20
rabbitmq:
image: rabbitmq:3-management
container_name: rabbitmq
ports:
- "5672:5672" # AMQP
- "15672:15672" # UI
environment:
RABBITMQ_DEFAULT_USER: guest
RABBITMQ_DEFAULT_PASS: guest
healthcheck:
test: [ "CMD", "rabbitmq-diagnostics", "-q", "ping" ]
interval: 5s
timeout: 5s
retries: 30
api:
build: .
container_name: clinical-api
depends_on:
rabbitmq:
condition: service_healthy
redis:
condition: service_healthy
environment:
# --- security & admin bootstrap ---
JWT_SECRET_KEY: ${JWT_SECRET_KEY}
ACCESS_TOKEN_EXPIRE_MINUTES: ${ACCESS_TOKEN_EXPIRE_MINUTES:-15}
REFRESH_TOKEN_EXPIRE_DAYS: ${REFRESH_TOKEN_EXPIRE_DAYS:-7}
BOOTSTRAP_ADMIN_USERNAME: ${BOOTSTRAP_ADMIN_USERNAME}
BOOTSTRAP_ADMIN_PASSWORD: ${BOOTSTRAP_ADMIN_PASSWORD}
# --- CORS (as JSON list for pydantic parsing) ---
CORS_ALLOW_ORIGINS: ${CORS_ALLOW_ORIGINS:-["http://localhost:8000"]}
# --- infra addresses (Docker service DNS names) ---
RABBITMQ_URL: amqp://guest:guest@rabbitmq/
RECOMMEND_REQ_QUEUE: recommend.request
REDIS_URL: redis://redis:6379/0
DEFAULT_CACHE_TTL_SECONDS: ${DEFAULT_CACHE_TTL_SECONDS:-60}
# --- DB inside container (shared volume) ---
DATABASE_URL: sqlite+aiosqlite:////data/clinical.db
# --- disable in-app consumer; use dedicated container ---
START_EMBEDDED_CONSUMER: "false"
volumes:
- app_data:/data
- app_logs:/app/logs
ports:
- "8000:8000"
command: ["tini", "--", "uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000"]
# Optional healthcheck (uncomment to enable)
# healthcheck:
# test: ["CMD", "wget", "-qO-", "http://localhost:8000/docs"]
# interval: 10s
# timeout: 5s
# retries: 12
consumer:
build: .
container_name: recommendation-consumer
depends_on:
rabbitmq:
condition: service_healthy
redis:
condition: service_healthy
api:
condition: service_started
environment:
RABBITMQ_URL: amqp://guest:guest@rabbitmq/
RECOMMEND_REQ_QUEUE: recommend.request
REDIS_URL: redis://redis:6379/0
DATABASE_URL: sqlite+aiosqlite:////data/clinical.db
volumes:
- app_data:/data
- app_logs:/app/logs
# FIXED: use the actual module path where consumer.py lives
command: ["python", "-m", "app.events.consumer"]
volumes:
app_data:
app_logs: