-
-
Notifications
You must be signed in to change notification settings - Fork 46
/
docker-compose.yml
333 lines (317 loc) · 9.59 KB
/
docker-compose.yml
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
# Copyright (c) 2022, 2023 Humanitarian OpenStreetMap Team
# This file is part of FMTM.
#
# FMTM is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# FMTM is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with FMTM. If not, see <https:#www.gnu.org/licenses/>.
#
name: fmtm
volumes:
fmtm_data:
fmtm_db_data:
fmtm_logs:
fmtm_images:
fmtm_tiles:
central_db_data:
central_frontend:
networks:
fmtm-net:
name: fmtm-${GIT_BRANCH:-local}
services:
proxy:
image: "ghcr.io/hotosm/fmtm/proxy:debug"
build:
context: nginx
target: debug
args:
NGINX_TAG: "${NGINX_TAG:-1.27.0}"
depends_on:
api:
condition: service_started
ui:
condition: service_started
ui-mapper:
condition: service_started
central:
condition: service_started
required: false
central-ui:
condition: service_completed_successfully
required: false
s3:
condition: service_started
volumes:
- central_frontend:/usr/share/nginx/html/central
ports:
- ${FMTM_DEV_PORT:-7050}:80
networks:
- fmtm-net
restart: "unless-stopped"
api:
image: "ghcr.io/hotosm/fmtm/backend:${TAG_OVERRIDE:-debug}"
build:
context: src/backend
target: "${TARGET_OVERRIDE:-debug}"
args:
APP_VERSION: "${TAG_OVERRIDE:-debug}"
# Uncomment these to debug with a terminal debugger like pdb
# Then `docker attach fmtm_api` to debug
# stdin_open: true
# tty: true
volumes:
- fmtm_logs:/opt/logs
- fmtm_tiles:/opt/tiles
- ./src/backend/pyproject.toml:/opt/pyproject.toml:ro
- ./src/backend/app:/opt/app
- ./src/backend/tests:/opt/tests:ro
# - ../osm-fieldwork/osm_fieldwork:/home/appuser/.local/lib/python3.11/site-packages/osm_fieldwork:ro
# - ../osm-rawdata/osm_rawdata:/home/appuser/.local/lib/python3.11/site-packages/osm_rawdata:ro
# - ../fmtm-splitter/fmtm_splitter:/home/appuser/.local/lib/python3.11/site-packages/fmtm_splitter:ro
depends_on:
fmtm-db:
condition: service_healthy
central:
condition: service_healthy
required: false
migrations:
condition: service_completed_successfully
s3:
condition: service_healthy
env_file:
- .env
ports:
- "7052-7055:8000"
# - "5678-5679:5678" # Debugger port
networks:
- fmtm-net
restart: "unless-stopped"
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8000/__lbheartbeat__"]
start_period: 60s
interval: 10s
timeout: 5s
retries: 10
deploy:
replicas: ${API_REPLICAS:-1}
resources:
limits:
cpus: "0.9"
memory: 1500M
reservations:
cpus: "0.1"
memory: 100M
ui:
image: "ghcr.io/hotosm/fmtm/frontend:debug"
build:
context: src
additional_contexts:
- code=src/frontend
dockerfile: Dockerfile.ui.debug
depends_on:
api:
condition: service_started
volumes:
- ./src/frontend:/app
- /app/node_modules/
environment:
- VITE_API_URL=${API_URL:-http://api.${FMTM_DOMAIN}:${FMTM_DEV_PORT:-7050}}
ports:
- "7051:7051"
networks:
- fmtm-net
restart: "unless-stopped"
ui-mapper:
image: "ghcr.io/hotosm/fmtm/frontend:mapper"
build:
context: src
additional_contexts:
- code=src/mapper
dockerfile: Dockerfile.ui.debug
depends_on:
api:
condition: service_started
volumes:
- ./src/mapper:/app
- /app/node_modules/
- /app/.svelte-kit/
# - ../ui:/app/node_modules/@hotosm/ui:ro
environment:
- VITE_API_URL=${API_URL:-http://api.${FMTM_DOMAIN}:${FMTM_DEV_PORT:-7050}}
networks:
- fmtm-net
restart: "unless-stopped"
central:
profiles: ["", "central"]
image: "ghcr.io/hotosm/fmtm/odkcentral:${ODK_CENTRAL_TAG:-v2024.1.0}"
build:
context: odkcentral/api
args:
ODK_CENTRAL_TAG: ${ODK_CENTRAL_TAG:-v2024.1.0}
depends_on:
central-db:
condition: service_healthy
environment:
- DOMAIN=${CENTRAL_DOMAIN_OVERRIDE:-odk.${FMTM_DOMAIN}:${FMTM_DEV_PORT:-7050}}
- SSL_TYPE=upstream
- SYSADMIN_EMAIL=${ODK_CENTRAL_USER}
- SYSADMIN_PASSWD=${ODK_CENTRAL_PASSWD}
- HTTPS_PORT=${HTTPS_PORT:-443}
- DB_HOST=${CENTRAL_DB_HOST:-central-db}
- DB_USER=${CENTRAL_DB_USER:-odk}
- DB_PASSWORD=${CENTRAL_DB_PASSWORD:-odk}
- DB_NAME=${CENTRAL_DB_NAME:-odk}
- DB_SSL=${DB_SSL:-null}
- EMAIL_FROM=${ODK_CENTRAL_USER}
- EMAIL_HOST=${EMAIL_HOST:-mail}
- EMAIL_PORT=${EMAIL_PORT:-25}
- EMAIL_SECURE=${EMAIL_SECURE:-false}
- EMAIL_IGNORE_TLS=${EMAIL_IGNORE_TLS:-true}
- EMAIL_USER=${EMAIL_USER:-''}
- EMAIL_PASSWORD=${EMAIL_PASSWORD:-''}
- OIDC_ENABLED=${OIDC_ENABLED:-false}
- SENTRY_ORG_SUBDOMAIN=${SENTRY_ORG_SUBDOMAIN:-o130137}
- SENTRY_KEY=${SENTRY_KEY:-3cf75f54983e473da6bd07daddf0d2ee}
- SENTRY_PROJECT=${SENTRY_PROJECT:-1298632}
# ports:
# - "8383:8383"
networks:
- fmtm-net
restart: "unless-stopped"
pyxform:
image: "ghcr.io/getodk/pyxform-http:v2.0.3"
# Temp workaround until multiarch support
build:
context: https://github.com/getodk/pyxform-http.git#v2.0.3
depends_on:
central-db:
condition: service_healthy
networks:
- fmtm-net
restart: "unless-stopped"
central-ui:
# This service simply builds the frontend to a volume
# accessible to the proxy, then shuts down
profiles: ["", "central"]
image: "ghcr.io/hotosm/fmtm/odkcentral-ui:${ODK_CENTRAL_TAG:-v2024.1.0}"
build:
context: odkcentral/ui
args:
ODK_CENTRAL_TAG: ${ODK_CENTRAL_TAG:-v2024.1.0}
volumes:
- central_frontend:/frontend
network_mode: none
restart: "on-failure:2"
s3:
image: "docker.io/minio/minio:${MINIO_TAG:-RELEASE.2024-10-13T13-34-11Z}"
environment:
MINIO_ROOT_USER: ${S3_ACCESS_KEY:-fmtm}
MINIO_ROOT_PASSWORD: ${S3_SECRET_KEY:-somelongpassword}
MINIO_VOLUMES: "/mnt/data"
MINIO_BROWSER: ${MINIO_BROWSER:-off}
MINIO_CONSOLE_ADDRESS: ":9090"
volumes:
- fmtm_data:/mnt/data
# ports:
# - 9000:9000
# - 9090:9090
networks:
- fmtm-net
command: minio server
restart: "unless-stopped"
healthcheck:
test: timeout 5s bash -c ':> /dev/tcp/127.0.0.1/9000' || exit 1
interval: 5s
retries: 3
start_period: 5s
timeout: 5s
fmtm-db:
image: "postgis/postgis:${POSTGIS_TAG:-14-3.5-alpine}"
# Temp workaround until https://github.com/postgis/docker-postgis/issues/216
build:
context: https://github.com/postgis/docker-postgis.git#master:14-3.5/alpine
command: -c 'max_connections=300' -c 'wal_level=logical'
volumes:
- fmtm_db_data:/var/lib/postgresql/data/
environment:
- POSTGRES_USER=${FMTM_DB_USER:-fmtm}
- POSTGRES_PASSWORD=${FMTM_DB_PASSWORD:-fmtm}
- POSTGRES_DB=${FMTM_DB_NAME:-fmtm}
ports:
- "5438:5432"
networks:
- fmtm-net
restart: "unless-stopped"
healthcheck:
test: pg_isready -U ${FMTM_DB_USER:-fmtm} -d ${FMTM_DB_NAME:-fmtm}
start_period: 5s
interval: 10s
timeout: 5s
retries: 3
electric:
image: "electricsql/electric:${ELECTRIC_TAG:-0.7.7}"
depends_on:
fmtm-db:
condition: service_healthy
migrations:
condition: service_completed_successfully
environment:
DATABASE_URL: postgresql://${FMTM_DB_USER:-fmtm}:${FMTM_DB_PASSWORD:-fmtm}@${FMTM_DB_HOST:-fmtm-db}/${FMTM_DB_NAME:-fmtm}?sslmode=disable
# OTEL_EXPORT: otlp
# OTLP_ENDPOINT: https://...
# ELECTRIC_WRITE_TO_PG_MODE: direct_writes
# AUTH_JWT_ALG: HS384
# AUTH_JWT_KEY: ${ENCRYPTION_KEY}
# AUTH_JWT_AUD: ${FMTM_DOMAIN}
ports:
- "7055:3000"
networks:
- fmtm-net
restart: "unless-stopped"
central-db:
profiles: ["", "central"]
image: "postgis/postgis:${POSTGIS_TAG:-14-3.5-alpine}"
volumes:
- central_db_data:/var/lib/postgresql/data/
environment:
- POSTGRES_USER=${CENTRAL_DB_USER:-odk}
- POSTGRES_PASSWORD=${CENTRAL_DB_PASSWORD:-odk}
- POSTGRES_DB=${CENTRAL_DB_NAME:-odk}
ports:
- "5434:5432"
networks:
- fmtm-net
restart: "unless-stopped"
healthcheck:
test: pg_isready -U ${CENTRAL_DB_USER:-odk} -d ${CENTRAL_DB_NAME:-odk}
start_period: 5s
interval: 10s
timeout: 5s
retries: 3
migrations:
image: "ghcr.io/hotosm/fmtm/backend:${TAG_OVERRIDE:-debug}"
depends_on:
fmtm-db:
condition: service_healthy
s3:
condition: service_healthy
env_file:
- .env
# Hardcode some vars for dev, as not necessarily present in the .env file
environment:
- S3_ENDPOINT=${S3_ENDPOINT:-"http://s3:9000"}
- S3_BACKUP_BUCKET_NAME=${S3_BACKUP_BUCKET_NAME:-"fmtm-db-backups"}
networks:
- fmtm-net
entrypoint: ["/migrate-entrypoint.sh"]
restart: "on-failure:2"
healthcheck:
test: [] # Set the health check test to an empty value to disable it