forked from hotosm/fmtm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-compose.development.yml
289 lines (274 loc) · 8.24 KB
/
docker-compose.development.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
# 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-dev
volumes:
fmtm_frontend:
name: fmtm-frontend-${GIT_BRANCH}
fmtm_db_data:
name: fmtm-db-data-${GIT_BRANCH}
fmtm_data:
name: fmtm-s3-data-${GIT_BRANCH}
fmtm_logs:
name: fmtm-logs-${GIT_BRANCH}
fmtm_images:
name: fmtm-images-${GIT_BRANCH}
fmtm_tiles:
name: fmtm-tiles-${GIT_BRANCH}
certs:
name: fmtm-certs-${GIT_BRANCH}
certbot_data:
name: fmtm-certbot-data-${GIT_BRANCH}
central_db_data:
name: fmtm-central-db-data-${GIT_BRANCH}
central_frontend:
name: fmtm-central-frontend-${GIT_BRANCH}
networks:
fmtm-net:
name: fmtm-${GIT_BRANCH}
services:
proxy:
image: "ghcr.io/hotosm/fmtm/proxy:${GIT_BRANCH}"
depends_on:
api:
condition: service_started
central:
condition: service_started
central-ui:
condition: service_completed_successfully
s3:
condition: service_started
certbot:
condition: service_completed_successfully
ui:
condition: service_completed_successfully
electric:
condition: service_started
volumes:
- fmtm_frontend:/usr/share/nginx/html/fmtm
- central_frontend:/usr/share/nginx/html/central/
- certs:/etc/letsencrypt
- certbot_data:/var/www/certbot
environment:
FMTM_DOMAIN: ${FMTM_DOMAIN}
FMTM_API_DOMAIN: ${FMTM_API_DOMAIN:-api.${FMTM_DOMAIN}}
FMTM_ODK_DOMAIN: ${FMTM_ODK_DOMAIN:-odk.${FMTM_DOMAIN}}
FMTM_S3_DOMAIN: ${FMTM_S3_DOMAIN:-s3.${FMTM_DOMAIN}}
FMTM_SYNC_DOMAIN: ${FMTM_SYNC_DOMAIN:-sync.${FMTM_DOMAIN}}
ports:
- 80:80
- 443:443
networks:
- fmtm-net
restart: "unless-stopped"
api:
image: "ghcr.io/hotosm/fmtm/backend:${GIT_BRANCH}"
volumes:
- fmtm_logs:/opt/logs
- fmtm_tiles:/opt/tiles
depends_on:
fmtm-db:
condition: service_healthy
migrations:
condition: service_completed_successfully
s3:
condition: service_healthy
env_file:
- .env
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:-2}
resources:
limits:
cpus: "0.9"
memory: 1500M
reservations:
cpus: "0.1"
memory: 100M
ui:
# This service simply builds the frontend to a volume
# accessible to the proxy, then shuts down
image: "ghcr.io/hotosm/fmtm/frontend:${GIT_BRANCH:-development}"
build:
context: src
dockerfile: Dockerfile.ui.prod
args:
APP_VERSION: ${GIT_BRANCH}
VITE_API_URL: https://${FMTM_API_DOMAIN:-api.${FMTM_DOMAIN}}
VITE_SYNC_URL: https://${FMTM_SYNC_DOMAIN:-sync.${FMTM_DOMAIN}}
volumes:
- fmtm_frontend:/frontend
network_mode: none
restart: "on-failure:2"
central:
image: "ghcr.io/hotosm/fmtm/odkcentral:${ODK_CENTRAL_TAG:-v2024.2.1}"
depends_on:
central-db:
condition: service_healthy
environment:
- DOMAIN=${FMTM_ODK_DOMAIN:-odk.${FMTM_DOMAIN}}
- SSL_TYPE=upstream
- SYSADMIN_EMAIL=${ODK_CENTRAL_USER}
- SYSADMIN_PASSWD=${ODK_CENTRAL_PASSWD}
- HTTPS_PORT=443
- DB_HOST=${CENTRAL_DB_HOST:-central-db}
- DB_USER=${CENTRAL_DB_USER}
- DB_PASSWORD=${CENTRAL_DB_PASSWORD}
- DB_NAME=${CENTRAL_DB_NAME}
- 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}
networks:
- fmtm-net
restart: "unless-stopped"
pyxform:
image: "ghcr.io/getodk/pyxform-http:v2.0.2"
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
image: "ghcr.io/hotosm/fmtm/odkcentral-ui:${ODK_CENTRAL_TAG:-v2024.2.1}"
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}
MINIO_ROOT_PASSWORD: ${S3_SECRET_KEY}
MINIO_VOLUMES: "/mnt/data"
MINIO_BROWSER: "off"
# MINIO_CONSOLE_ADDRESS: ":9090"
volumes:
- fmtm_data:/mnt/data
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}"
command: -c 'max_connections=300' -c 'wal_level=logical'
volumes:
- fmtm_db_data:/var/lib/postgresql/data/
environment:
- POSTGRES_USER=${FMTM_DB_USER}
- POSTGRES_PASSWORD=${FMTM_DB_PASSWORD}
- POSTGRES_DB=${FMTM_DB_NAME}
ports:
- "5433:5432"
networks:
- fmtm-net
restart: "unless-stopped"
healthcheck:
test: pg_isready -U ${FMTM_DB_USER} -d ${FMTM_DB_NAME}
start_period: 5s
interval: 10s
timeout: 5s
retries: 3
electric:
image: "electricsql/electric:${ELECTRIC_TAG:-0.9.3}"
depends_on:
fmtm-db:
condition: service_healthy
migrations:
condition: service_completed_successfully
environment:
DATABASE_URL: postgresql://${FMTM_DB_USER}:${FMTM_DB_PASSWORD}@${FMTM_DB_HOST:-fmtm-db}/${FMTM_DB_NAME:-fmtm}?sslmode=disable
# OTEL_EXPORT: otlp
# OTLP_ENDPOINT: https://...
# ELECTRIC_WRITE_TO_PG_MODE: direct_writes
networks:
- fmtm-net
restart: "unless-stopped"
central-db:
image: "postgis/postgis:${POSTGIS_TAG:-14-3.5-alpine}"
volumes:
- central_db_data:/var/lib/postgresql/data/
environment:
- POSTGRES_USER=${CENTRAL_DB_USER}
- POSTGRES_PASSWORD=${CENTRAL_DB_PASSWORD}
- POSTGRES_DB=${CENTRAL_DB_NAME}
ports:
- "5434:5432"
networks:
- fmtm-net
restart: "unless-stopped"
healthcheck:
test: pg_isready -U ${CENTRAL_DB_USER} -d ${CENTRAL_DB_NAME}
start_period: 5s
interval: 10s
timeout: 5s
retries: 3
migrations:
image: "ghcr.io/hotosm/fmtm/backend:${GIT_BRANCH}"
depends_on:
fmtm-db:
condition: service_healthy
s3:
condition: service_healthy
env_file:
- .env
networks:
- fmtm-net
entrypoint: ["/migrate-entrypoint.sh"]
restart: "on-failure:2"
certbot:
image: "ghcr.io/hotosm/fmtm/proxy:certs-init-development"
volumes:
- certs:/etc/letsencrypt
- certbot_data:/var/www/certbot
environment:
FMTM_DOMAIN: ${FMTM_DOMAIN}
FMTM_API_DOMAIN: ${FMTM_API_DOMAIN:-api.${FMTM_DOMAIN}}
FMTM_ODK_DOMAIN: ${FMTM_ODK_DOMAIN:-odk.${FMTM_DOMAIN}}
FMTM_S3_DOMAIN: ${FMTM_S3_DOMAIN:-s3.${FMTM_DOMAIN}}
FMTM_SYNC_DOMAIN: ${FMTM_SYNC_DOMAIN:-sync.${FMTM_DOMAIN}}
CERT_EMAIL: ${CERT_EMAIL}
ports:
- 80:80
- 443:443
networks:
- fmtm-net
restart: "on-failure:2"