-
-
Notifications
You must be signed in to change notification settings - Fork 52
/
docker-compose.deploy.yml
161 lines (153 loc) · 5.55 KB
/
docker-compose.deploy.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
# 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_db_data:
traefik-public-certificates:
networks:
fmtm-net:
name: fmtm-${GIT_BRANCH}
services:
traefik:
image: "docker.io/traefik:v2.8"
container_name: fmtm_proxy
volumes:
- "/var/run/docker.sock:/var/run/docker.sock:ro"
- "traefik-public-certificates:/certificates"
ports:
- 80:80
- 443:443
networks:
- fmtm-net
restart: unless-stopped
command:
- "--entrypoints.web.address=:80"
- "--entrypoints.websecure.address=:443"
- "--providers.docker=true"
- "--providers.docker.exposedbydefault=false"
- "--certificatesresolvers.letsencrypt.acme.httpchallenge=true"
- "--certificatesresolvers.letsencrypt.acme.httpchallenge.entrypoint=web"
- "--certificatesresolvers.letsencrypt.acme.storage=/certificates/acme.json"
## Enable below for staging tests
# - "--certificatesresolvers.letsencrypt.acme.caserver=https://acme-staging-v02.api.letsencrypt.org/directory"
labels:
- "traefik.enable=true"
- "traefik.docker.network=fmtm-${GIT_BRANCH}"
- "traefik.api.dashboard=false"
- "traefik.http.middlewares.https_redirect.redirectscheme.scheme=https"
- "traefik.http.middlewares.https_redirect.redirectscheme.permanent=true"
- "traefik.http.routers.http_catchall.rule=HostRegexp(`{any:.+}`) && !PathPrefix(`/.well-known/acme-challenge/`)"
- "traefik.http.routers.http_catchall.entrypoints=web"
- "traefik.http.routers.http_catchall.middlewares=https_redirect"
fmtm-db:
image: "postgis/postgis:14-3.3-alpine"
container_name: fmtm_db
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:
- "5432:5432"
networks:
- fmtm-net
restart: unless-stopped
api:
image: "ghcr.io/hotosm/fmtm/backend:${API_VERSION}-${GIT_BRANCH}"
build:
context: src/backend
target: prod
args:
APP_VERSION: ${API_VERSION}
container_name: fmtm_api
depends_on:
- fmtm-db
- traefik
env_file:
- .env
networks:
- fmtm-net
restart: unless-stopped
labels:
- "traefik.enable=true"
- "traefik.http.routers.api.tls=true"
- "traefik.http.routers.api.tls.certresolver=letsencrypt"
- "traefik.http.routers.api.rule=Host(`${API_URL}`)"
- "traefik.http.services.api-svc.loadbalancer.server.port=8000"
- "traefik.http.routers.api.service=api-svc"
ui-main:
image: "ghcr.io/hotosm/fmtm/frontend/main:${FRONTEND_MAIN_VERSION}-${GIT_BRANCH}"
build:
context: src/frontend
dockerfile: prod.dockerfile
args:
APP_NAME: main
APP_VERSION: ${FRONTEND_MAIN_VERSION}
API_URL: ${URL_SCHEME}://${API_URL}
FRONTEND_MAIN_URL: ${URL_SCHEME}://${FRONTEND_MAIN_URL}
FRONTEND_MAP_URL: ${URL_SCHEME}://${FRONTEND_MAP_URL}
container_name: fmtm_main
depends_on:
- api
- traefik
networks:
- fmtm-net
environment:
- BROTLI=true
- API_URL=${URL_SCHEME}://${API_URL}
- FRONTEND_MAIN_URL=${URL_SCHEME}://${FRONTEND_MAIN_URL}
- FRONTEND_MAP_URL=${URL_SCHEME}://${FRONTEND_MAP_URL}
restart: unless-stopped
labels:
- "traefik.enable=true"
- "traefik.http.routers.ui-main.tls=true"
- "traefik.http.routers.ui-main.tls.certresolver=letsencrypt"
- "traefik.http.routers.ui-main.rule=Host(`${FRONTEND_MAIN_URL}`)"
- "traefik.http.services.ui-main-svc.loadbalancer.server.port=8080"
- "traefik.http.routers.ui-main.service=ui-main-svc"
ui-map:
image: "ghcr.io/hotosm/fmtm/frontend/map:${FRONTEND_MAP_VERSION}-${GIT_BRANCH}"
build:
context: src/frontend
dockerfile: prod.dockerfile
args:
APP_NAME: fmtm_openlayer_map
APP_VERSION: ${FRONTEND_MAP_VERSION}
API_URL: ${URL_SCHEME}://${API_URL}
FRONTEND_MAIN_URL: ${URL_SCHEME}://${FRONTEND_MAIN_URL}
FRONTEND_MAP_URL: ${URL_SCHEME}://${FRONTEND_MAP_URL}
container_name: fmtm_map
depends_on:
- api
- traefik
networks:
- fmtm-net
environment:
- BROTLI=true
- API_URL=${URL_SCHEME}://${API_URL}
- FRONTEND_MAIN_URL=${URL_SCHEME}://${FRONTEND_MAIN_URL}
- FRONTEND_MAP_URL=${URL_SCHEME}://${FRONTEND_MAP_URL}
restart: unless-stopped
labels:
- "traefik.enable=true"
- "traefik.http.routers.ui-map.tls=true"
- "traefik.http.routers.ui-map.tls.certresolver=letsencrypt"
- "traefik.http.routers.ui-map.rule=Host(`${FRONTEND_MAP_URL}`)"
- "traefik.http.services.ui-map-svc.loadbalancer.server.port=8080"
- "traefik.http.routers.ui-map.service=ui-map-svc"