-
-
Notifications
You must be signed in to change notification settings - Fork 9
/
docker-compose.yml
379 lines (374 loc) · 12.1 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
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
services:
webclient:
image: ghcr.io/tum-dev/navigatum-webclient:main
restart: unless-stopped
labels:
- "traefik.enable=true"
- "traefik.http.routers.navigatum-webclient.entrypoints=webs"
- "traefik.http.routers.navigatum-webclient.tls.certresolver=leacme"
- "traefik.http.routers.navigatum-webclient.rule=Host(`nav.tum.de`)"
- "traefik.http.services.navigatum-webclient.loadbalancer.server.port=3000"
networks:
- traefik_traefik
expose:
- "3000"
environment:
TZ: Europe/Berlin
NUXT_PUBLIC_MAPS_URL: https://nav.tum.de
NUXT_PUBLIC_CDN_URL: https://nav.tum.de
NUXT_PUBLIC_API_URL: https://nav.tum.de
# maps
tileserver-init-config:
image: alpine:latest
command:
- /bin/sh
- -c
- |
rm -f /data/*.json
cp /map/*.json /data/
rm -fr /data/sprites/
mkdir -p /data/sprites/
cp /map/sprites/* /data/sprites/
rm -fr /data/styles/
mkdir -p /data/styles/
cp /map/styles/* /data/styles/
mkdir -p /data/fonts/
volumes:
- tileserver-src:/data
- ./map/:/map/:ro
environment:
TZ: Europe/Berlin
tileserver:
image: maptiler/tileserver-gl:v5.0.0
restart: unless-stopped
labels:
- "traefik.enable=true"
- "traefik.http.routers.navigatum-tileserver.entrypoints=webs"
- "traefik.http.routers.navigatum-tileserver.tls.certresolver=leacme"
- "traefik.http.routers.navigatum-tileserver.rule=Host(`nav.tum.de`) && PathPrefix(`/maps/`)"
- "traefik.http.routers.navigatum-tileserver.middlewares=navigatum-maps-stripprefix@docker, navigatum-compress@docker, navigatum-cache-2m@docker"
- "traefik.http.middlewares.navigatum-maps-stripprefix.stripprefix.prefixes=/maps"
- "traefik.http.middlewares.navigatum-compress.compress=true"
- "traefik.http.middlewares.navigatum-cache-2m.headers.customrequestheaders.Cache-Control=public, max-age=5184000"
- "traefik.http.services.navigatum-tileserver.loadbalancer.server.port=8080"
networks:
- traefik_traefik
expose:
- "8080"
command: /usr/src/app/docker-entrypoint.sh --public_url=https://nav.tum.de/maps/
environment:
TZ: Europe/Berlin
tmpfs:
- /tmp
volumes:
- tileserver-src:/data/:ro
read_only: true
depends_on:
tileserver-init-config:
condition: service_completed_successfully
# cdn
data:
image: ghcr.io/tum-dev/navigatum-data:main
restart: unless-stopped
labels:
- "traefik.enable=true"
- "traefik.http.routers.navigatum-data.entrypoints=webs"
- "traefik.http.routers.navigatum-data.tls.certresolver=leacme"
- "traefik.http.routers.navigatum-data.rule=Host(`nav.tum.de`) && PathPrefix(`/cdn/`)"
- "traefik.http.services.navigatum-data.loadbalancer.server.port=3002"
networks:
- traefik_traefik
environment:
TZ: Europe/Berlin
expose:
- "3002"
server:
image: ghcr.io/tum-dev/navigatum-server:main
restart: unless-stopped
labels:
- "traefik.enable=true"
- "traefik.http.routers.navigatum-server.entrypoints=webs"
- "traefik.http.routers.navigatum-server.tls.certresolver=leacme"
- "traefik.http.routers.navigatum-server.rule=Host(`nav.tum.de`) && (PathPrefix(`/api/locations/`) || PathPrefix(`/api/get/`) || PathPrefix(`/api/preview/`) || Path(`/api/search`) || PathPrefix(`/api/feedback/`) || Path(`/api/calendar`) || Path(`/api/status`)|| Path(`/api/metrics`) || PathPrefix(`/api/maps/indoor`))"
- "traefik.http.services.navigatum-server.loadbalancer.server.port=3003"
networks:
- traefik_traefik
expose:
- "3003"
command: /bin/navigatum-server
user: 1000:3000
environment:
TZ: Europe/Berlin
LOG_LEVEL: ${LOG_LEVEL-info}
MIELI_URL: http://meilisearch:7700
MEILI_MASTER_KEY: ${MEILI_MASTER_KEY}
TILESERVER_URL: http://tileserver:8080
CDN_URL: http://data:3002/cdn
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
POSTGRES_USER: ${POSTGRES_USER}
POSTGRES_DB: ${POSTGRES_DB}
POSTGRES_URL: db:5432
CONNECTUM_OAUTH_CLIENT_ID: ${CONNECTUM_OAUTH_CLIENT_ID}
CONNECTUM_OAUTH_CLIENT_SECRET: ${CONNECTUM_OAUTH_CLIENT_SECRET}
GITHUB_TOKEN: ${GITHUB_TOKEN}
JWT_KEY: ${JWT_KEY}
depends_on:
meilisearch:
condition: service_healthy
osm2pgsql-init:
condition: service_started
db:
condition: service_healthy
meilisearch:
image: getmeili/meilisearch:v1.11.3
restart: unless-stopped
networks:
- traefik_traefik
expose:
- "7700"
environment:
TZ: Europe/Berlin
MEILI_MASTER_KEY: ${MEILI_MASTER_KEY}
MEILI_ENV: production
healthcheck:
test: wget --quiet --spider http://localhost:7700/health
retries: 5
interval: 10s
start_period: 10s
db:
image: postgis/postgis:17-3.4
restart: unless-stopped
environment:
TZ: Europe/Berlin
PGDATA: /var/lib/postgresql/data/pgdata
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
POSTGRES_USER: ${POSTGRES_USER}
POSTGRES_DB: ${POSTGRES_DB}
networks:
- traefik_traefik
expose:
- "5432"
volumes:
- postgis-data:/var/lib/postgresql/data
- ./resources/init-db.sh:/docker-entrypoint-initdb.d/init-db.sh:ro
healthcheck:
test: [ "CMD", "pg_isready", "-U", "${POSTGRES_USER}" ]
retries: 5
interval: 10s
# requires docker v25 to be available for ubuntu
# start_interval: 20s
start_period: 20s
download-data:
image: alpine:latest
command: sh /map/download.sh europe/germany/bayern/oberbayern
environment:
TZ: Europe/Berlin
working_dir: /map
volumes:
- ./map/data/:/map/data/:rw
- ./map/gtfs_feeds/:/map/gtfs_feeds/:rw
- ./map/download.sh:/map/download.sh:ro
valhalla-build:
image: ghcr.io/gis-ops/docker-valhalla/valhalla:latest
volumes:
- ./map/data/:/custom_files:rw
- ./map/gtfs_feeds:/gtfs_feeds:rw
environment:
TZ: Europe/Berlin
build_elevation: True
build_admins: Force
build_time_zones: Force
build_transit: True
use_default_speeds_config: True
serve_tiles: False
server_threads: 3 # we don't want to gobble up all the CPU and have 2 cores/4 threads
depends_on:
download-data:
condition: service_completed_successfully
valhalla:
image: ghcr.io/gis-ops/docker-valhalla/valhalla:latest
restart: unless-stopped
labels:
- "traefik.enable=true"
- "traefik.http.routers.navigatum-valhalla.entrypoints=webs"
- "traefik.http.routers.navigatum-valhalla.tls.certresolver=leacme"
- "traefik.http.routers.navigatum-valhalla.rule=Host(`nav.tum.de`) && PathPrefix(`/valhalla`)"
- "traefik.http.routers.navigatum-valhalla.middlewares=navigatum-valhalla-stripprefix@docker"
- "traefik.http.middlewares.navigatum-valhalla-stripprefix.stripprefix.prefixes=/valhalla"
- "traefik.http.services.navigatum-valhalla.loadbalancer.server.port=8002"
environment:
TZ: Europe/Berlin
networks:
- traefik_traefik
expose:
- 8002
depends_on:
valhalla-build:
condition: service_completed_successfully
volumes:
- ./map/data/:/custom_files:rw
tmpfs:
- /tmp
read_only: true
healthcheck:
test: curl --fail -s http://localhost:8002/status || exit 1
interval: 60s
retries: 2
start_period: 5s
timeout: 1s
osm2pgsql-init:
image: iboates/osm2pgsql:latest
networks:
- traefik_traefik
environment:
TZ: Europe/Berlin
PGPASSWORD: ${POSTGRES_PASSWORD}
command:
- osm2pgsql
- --create
- --slim
- --cache
- "4096" # cache size in MB, maybe too low for optimum
- --database
- ${POSTGRES_DB}
- --user
- ${POSTGRES_USER}
- --host
- db
- --port
- "5432"
- /map/data/oberbayern-latest.osm.pbf
- --output=flex
- --style
- /map/osm2pgsql/style.lua
volumes:
- ./map/data/:/map/data/:ro
- ./map/osm2pgsql/:/map/osm2pgsql/:ro
depends_on:
download-data:
condition: service_completed_successfully
db:
condition: service_healthy
osm2pgsql-replication-init:
image: iboates/osm2pgsql:latest
networks:
- traefik_traefik
environment:
TZ: Europe/Berlin
PGPASSWORD: ${POSTGRES_PASSWORD}
command:
- replication
- init
- --database
- ${POSTGRES_DB}
- --username
- ${POSTGRES_USER}
- --host
- db
- --port
- "5432"
depends_on:
osm2pgsql-init:
condition: service_completed_successfully
db:
condition: service_healthy
volumes:
- ./map/osm2pgsql/:/map/osm2pgsql/:ro
osm2pgsql-replication:
image: iboates/osm2pgsql:latest
networks:
- traefik_traefik
environment:
TZ: Europe/Berlin
PGPASSWORD: ${POSTGRES_PASSWORD}
command:
- replication
- update
- --database
- ${POSTGRES_DB}
- --username
- ${POSTGRES_USER}
- --host
- db
- --port
- "5432"
depends_on:
osm2pgsql-replication-init:
condition: service_completed_successfully
volumes:
- ./map/osm2pgsql/:/map/osm2pgsql/:ro
martin-init-config:
image: alpine:latest
command:
- /bin/sh
- /map/martin/setup.sh
environment:
TZ: Europe/Berlin
volumes:
- ./map/:/map/
martin:
image: ghcr.io/maplibre/martin:main # TODO: just to see sdf images in action.. don't keep this on permanently
restart: unless-stopped
command:
- --config
- /map/config.yaml
labels:
- "traefik.enable=true"
- "traefik.http.routers.navigatum-martin.entrypoints=webs"
- "traefik.http.routers.navigatum-martin.tls.certresolver=leacme"
- "traefik.http.routers.navigatum-martin.rule=Host(`nav.tum.de`) && PathPrefix(`/tiles`)"
- "traefik.http.routers.navigatum-martin.middlewares=navigatum-martin-stripprefix@docker"
- "traefik.http.middlewares.navigatum-martin-stripprefix.stripprefix.prefixes=/tiles"
- "traefik.http.services.navigatum-martin.loadbalancer.server.port=3001"
networks:
- traefik_traefik
expose:
- "3001"
environment:
TZ: Europe/Berlin
BASE_PATH: /tiles/
DATABASE_URL: postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@db/${POSTGRES_DB}
RUST_LOG: info
depends_on:
db:
condition: service_healthy
martin-init-config:
condition: service_completed_successfully
osm2pgsql-init:
condition: service_started
volumes:
- ./map/martin/:/map/:ro
- tileserver-src:/data:ro
healthcheck:
test: wget --spider http://localhost:3001/health || exit 1
retries: 10
interval: 1s
start_period: 1s
redirect-domain:
image: traefik/whoami:latest
restart: unless-stopped
labels:
- "traefik.enable=true"
- "traefik.http.routers.navigatum-redirect-domain.entrypoints=webs"
- "traefik.http.routers.navigatum-redirect-domain.tls.certresolver=leacme"
- "traefik.http.routers.navigatum-redirect-domain.rule=Host(`www.nav.tum.de`) || Host(`nav.tum.sexy`)"
- "traefik.http.routers.navigatum-redirect-domain.middlewares=navigatum-redirect-to-domain@docker"
- "traefik.http.middlewares.navigatum-redirect-to-domain.redirectregex.regex=^https://(www.)?nav.tum.(de|sexy)/(.*)"
- "traefik.http.middlewares.navigatum-redirect-to-domain.redirectregex.replacement=https://nav.tum.de/$${3}"
- "traefik.http.middlewares.navigatum-redirect-to-domain.redirectregex.permanent=true"
- "traefik.http.services.navigatum-redirect-domain.loadbalancer.server.port=80"
environment:
TZ: Europe/Berlin
healthcheck:
test: ["CMD", "/whoami", "--help"] # I know that this is not usefull. There does not exists a executable in that image that can call /health
retries: 2
interval: 10s
start_period: 10s
volumes:
tileserver-src:
driver: local
postgis-data:
driver: local
networks:
traefik_traefik:
external: true