-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
117 lines (111 loc) · 2.83 KB
/
docker-compose.yml
File metadata and controls
117 lines (111 loc) · 2.83 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
services:
db:
image: timescale/timescaledb:latest-pg16
env_file: .env
environment:
POSTGRES_USER: ${POSTGRES_USER}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
POSTGRES_DB: ${POSTGRES_DB}
ports:
- "5432:5432"
volumes:
- db_data:/var/lib/postgresql/data
- ./docker/migrations:/docker-entrypoint-initdb.d
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER} -d ${POSTGRES_DB}"]
interval: 10s
timeout: 5s
retries: 5
db_test:
image: timescale/timescaledb:latest-pg16
env_file: .env
environment:
POSTGRES_USER: ${POSTGRES_USER}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
POSTGRES_DB: badi_test
ports:
- "5433:5432"
tmpfs:
- /var/lib/postgresql/data
volumes:
- ./docker/migrations:/docker-entrypoint-initdb.d
migrator:
build:
context: .
dockerfile: collector/Dockerfile
env_file: .env
environment:
DATABASE_URL: ${DATABASE_URL}
command: ["python", "scripts/migrate.py"]
depends_on:
db:
condition: service_healthy
restart: "no"
collector:
build:
context: .
dockerfile: collector/Dockerfile
env_file: .env
environment:
WS_URL: wss://badi-public.crowdmonitor.ch:9591/api
DATABASE_URL: ${DATABASE_URL}
ports:
- "8080:8080"
depends_on:
db:
condition: service_healthy
migrator:
condition: service_completed_successfully
restart: unless-stopped
healthcheck:
test: ["CMD-SHELL", "curl -sf http://localhost:8080/health || exit 1"]
interval: 30s
timeout: 5s
retries: 3
api:
build:
context: .
dockerfile: api/Dockerfile
env_file: .env
environment:
DATABASE_URL: ${DATABASE_URL}
ports:
- "8000:8000"
volumes:
- model_artifacts:/app/ml/models
- ./api/static:/app/api/static
- ./api/templates:/app/api/templates
depends_on:
db:
condition: service_healthy
migrator:
condition: service_completed_successfully
restart: unless-stopped
command: ["uvicorn", "api.main:app", "--host", "0.0.0.0", "--port", "8000"]
healthcheck:
test: ["CMD-SHELL", "curl -sf http://localhost:8000/health || exit 1"]
interval: 30s
timeout: 5s
retries: 3
retrain:
build:
context: .
dockerfile: ml/Dockerfile
env_file: .env
volumes:
- model_artifacts:/app/ml/models
environment:
- DATABASE_URL=${DATABASE_URL}
# - RETRAIN_INTERVAL_HOURS=168 # 1 week
- RETRAIN_INTERVAL_HOURS=8
- MIN_RECORDS_FOR_TRAINING=1000
- LOOKBACK_DAYS=90
depends_on:
db:
condition: service_healthy
migrator:
condition: service_completed_successfully
restart: unless-stopped
volumes:
db_data:
model_artifacts: