-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
235 lines (227 loc) · 5.48 KB
/
Copy pathdocker-compose.yml
File metadata and controls
235 lines (227 loc) · 5.48 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
services:
db:
image: timescale/timescaledb:2.28.2-pg16@sha256:ba149561ad4ddff5940d6eb0a0df60aefd1355cee1a450928f271267038fc888
container_name: pulsebase-db
restart: unless-stopped
environment:
POSTGRES_DB: garmin
POSTGRES_USER: ${DB_USER}
POSTGRES_PASSWORD: ${DB_PASSWORD}
ports:
- "127.0.0.1:5433:5432"
volumes:
- timescale-data:/var/lib/postgresql/data
networks:
- internal
labels:
- "monitoring=true"
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${DB_USER} -d garmin"]
interval: 10s
timeout: 5s
retries: 5
deploy:
resources:
limits:
memory: 2g
cpus: '1.00'
logging:
driver: json-file
options:
max-size: "10m"
max-file: "3"
flyway:
image: flyway/flyway:12@sha256:455c23d438811c27415f2c28052d0cc4494665a313b6faa41a7ece5242c24f10
container_name: pulsebase-flyway
command: migrate
volumes:
- ./db/migrations:/flyway/sql
environment:
- FLYWAY_URL=jdbc:postgresql://db:5432/garmin
- FLYWAY_USER=${DB_USER}
- FLYWAY_PASSWORD=${DB_PASSWORD}
- FLYWAY_CONNECT_RETRIES=10
- FLYWAY_MIXED=true
- FLYWAY_PLACEHOLDERS_DB_APP_USER=${DB_APP_USER}
- FLYWAY_PLACEHOLDERS_DB_APP_PASSWORD=${DB_APP_PASSWORD}
- FLYWAY_PLACEHOLDERS_DB_SYNC_USER=${DB_SYNC_USER}
- FLYWAY_PLACEHOLDERS_DB_SYNC_PASSWORD=${DB_SYNC_PASSWORD}
- FLYWAY_PLACEHOLDERS_DB_ML_USER=${DB_ML_USER}
- FLYWAY_PLACEHOLDERS_DB_ML_PASSWORD=${DB_ML_PASSWORD}
depends_on:
db:
condition: service_healthy
networks:
- internal
deploy:
resources:
limits:
memory: 256m
cpus: '0.25'
logging:
driver: json-file
options:
max-size: "5m"
max-file: "2"
api:
build: ./api
container_name: pulsebase-api
restart: unless-stopped
stop_grace_period: 45s
init: true
security_opt:
- "no-new-privileges:true"
labels:
- "monitoring=true"
env_file:
- env/.env.app
- env/.env.api
environment:
DB_HOST: db
DB_PORT: 5432
DB_NAME: garmin
depends_on:
flyway:
condition: service_completed_successfully
networks:
- internal
- proxy
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8000/ready"]
interval: 30s
timeout: 5s
retries: 3
start_period: 30s
deploy:
resources:
limits:
memory: 512m
cpus: '0.50'
logging:
driver: json-file
options:
max-size: "10m"
max-file: "3"
sync-service:
build: ./sync-service
container_name: pulsebase-sync
restart: unless-stopped
stop_grace_period: 120s
init: true
security_opt:
- "no-new-privileges:true"
labels:
- "monitoring=true"
depends_on:
flyway:
condition: service_completed_successfully
env_file:
- env/.env.app
- env/.env.sync
environment:
DB_HOST: db
DB_PORT: 5432
DB_NAME: garmin
networks:
- internal
healthcheck:
test: ["CMD-SHELL", "test -f /tmp/sync_alive && python -c \"import urllib.request; urllib.request.urlopen('http://localhost:8080/health')\""]
interval: 30s
timeout: 5s
start_period: 120s
retries: 3
deploy:
resources:
limits:
memory: 256m
cpus: '0.25'
logging:
driver: json-file
options:
max-size: "10m"
max-file: "3"
ml-service:
build: ./ml-service
container_name: pulsebase-ml
restart: unless-stopped
stop_grace_period: 120s
init: true
security_opt:
- "no-new-privileges:true"
labels:
- "monitoring=true"
depends_on:
flyway:
condition: service_completed_successfully
env_file:
- env/.env.app
- env/.env.ml
environment:
MODEL_DIR: /app/models
DB_HOST: db
DB_PORT: 5432
DB_NAME: garmin
volumes:
- ml-models:/app/models
networks:
- internal
healthcheck:
test: ["CMD-SHELL", "test -f /tmp/ml_alive && python -c \"import urllib.request; urllib.request.urlopen('http://localhost:8080/health')\""]
interval: 30s
timeout: 5s
start_period: 60s
retries: 3
deploy:
resources:
limits:
memory: 1g
cpus: '1.00'
logging:
driver: json-file
options:
max-size: "10m"
max-file: "3"
backup:
build: ./backup
container_name: pulsebase-backup
restart: unless-stopped
labels:
- "monitoring=true"
# DB admin creds come from env/.env (pg_dump needs full read); backup config
# from env/.env.backup (optional — stack still starts if absent, the run just
# fails its preflight on a missing AGE_RECIPIENT).
env_file:
- path: env/.env.backup
required: false
environment:
PGHOST: db
PGPORT: 5432
PGUSER: ${DB_USER}
PGPASSWORD: ${DB_PASSWORD}
PGDATABASE: garmin
depends_on:
db:
condition: service_healthy
volumes:
- backups:/backups
networks:
- internal
deploy:
resources:
limits:
memory: 256m
cpus: '0.25'
logging:
driver: json-file
options:
max-size: "10m"
max-file: "3"
volumes:
timescale-data:
ml-models:
backups:
networks:
internal:
driver: bridge
proxy:
external: true # must exist: docker network create proxy