forked from hotosm/fmtm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-compose.main.yml
166 lines (156 loc) · 4.22 KB
/
docker-compose.main.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
# 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/>.
#
version: "3"
volumes:
fmtm_frontend:
name: fmtm-frontend-main
fmtm_db_data:
name: fmtm-db-data-main
fmtm_logs:
name: fmtm-logs-main
fmtm_images:
name: fmtm-images-main
fmtm_tiles:
name: fmtm-tiles-main
certs:
name: fmtm-certs-main
certbot_data:
name: fmtm-certbot-data-main
networks:
fmtm-net:
name: fmtm-main
services:
proxy:
image: "ghcr.io/hotosm/fmtm/proxy:main"
container_name: fmtm-main
depends_on:
api:
condition: service_started
certbot:
condition: service_completed_successfully
ui:
condition: service_completed_successfully
volumes:
- fmtm_frontend:/usr/share/nginx/html/fmtm/
- certs:/etc/letsencrypt
- certbot_data:/var/www/certbot
environment:
FMTM_DOMAIN: ${FMTM_DOMAIN}
FMTM_API_DOMAIN: ${FMTM_API_DOMAIN:-api.${FMTM_DOMAIN}}
ports:
- 80:80
- 443:443
networks:
- fmtm-net
restart: "unless-stopped"
api:
image: "ghcr.io/hotosm/fmtm/backend:main"
container_name: fmtm-api-main
volumes:
- fmtm_logs:/opt/logs
- fmtm_tiles:/opt/tiles
depends_on:
fmtm-db:
condition: service_healthy
migrations:
condition: service_completed_successfully
env_file:
- .env
networks:
- fmtm-net
restart: "unless-stopped"
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:-main}"
build:
context: src/frontend
dockerfile: prod.dockerfile
args:
APP_VERSION: main
VITE_API_URL: https://${FMTM_API_DOMAIN:-api.${FMTM_DOMAIN}}
container_name: fmtm-ui-main
volumes:
- fmtm_frontend:/frontend
network_mode: none
restart: "on-failure:2"
fmtm-db:
image: "postgis/postgis:${POSTGIS_TAG:-14-3.4-alpine}"
container_name: fmtm-db-main
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
migrations:
image: "ghcr.io/hotosm/fmtm/backend:main"
container_name: fmtm-migrations-main
depends_on:
fmtm-db:
condition: service_healthy
env_file:
- .env
networks:
- fmtm-net
entrypoint: ["/migrate-entrypoint.sh"]
restart: "on-failure:3"
backups:
image: "ghcr.io/hotosm/fmtm/backend:main"
container_name: fmtm-backups-main
depends_on:
fmtm-db:
condition: service_healthy
env_file:
- .env
networks:
- fmtm-net
entrypoint: ["/backup-entrypoint.sh"]
restart: "on-failure:3"
healthcheck:
test: pg_isready -U ${FMTM_DB_USER} -d ${FMTM_DB_NAME}
start_period: 5s
interval: 10s
timeout: 5s
retries: 3
certbot:
image: "ghcr.io/hotosm/fmtm/proxy:certs-init-main"
container_name: fmtm-cert-renew-main
volumes:
- certs:/etc/letsencrypt
- certbot_data:/var/www/certbot
environment:
FMTM_DOMAIN: ${FMTM_DOMAIN}
FMTM_API_DOMAIN: ${FMTM_API_DOMAIN:-api.${FMTM_DOMAIN}}
CERT_EMAIL: ${CERT_EMAIL}
ports:
- 80:80
- 443:443
networks:
- fmtm-net
restart: "on-failure:2"