-
Notifications
You must be signed in to change notification settings - Fork 6
/
docker-compose.yml
194 lines (184 loc) · 4.77 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
# docker compose file for productive useage
version: '3.8'
services:
postgis:
image: postgis/postgis:15-3.3-alpine
volumes:
- type: volume
source: db-data
target: /var/lib/postgresql/data
networks:
- mrmap-internal
env_file:
- ./docker/postgis/.db.env
redis:
image: library/redis:7.2.3-alpine
volumes:
- type: volume
source: mem-db-data
target: /data
networks:
- mrmap-internal
environment:
- loglevel=error
mapserver:
image: camptocamp/mapserver:7.6
volumes:
- type: bind
source: ./docker/mapserver/mapfiles
target: /etc/mapserver/mapfiles
- type: bind
source: ./docker/mapserver/shapefiles
target: /etc/mapserver/shapefiles
networks:
- mrmap-internal
backend:
build:
context: ./backend
dockerfile: ../docker/backend/alpine.Dockerfile
args:
MRMAP_PRODUCTION: "True"
hostname: "backend"
volumes:
- type: bind
source: ./backend
target: /opt/mrmap
- type: volume
source: backend-static
target: /var/www/mrmap/backend
- type: volume
source: backend-media
target: /var/mrmap/backend/media
- type: volume
source: backend-log
target: /var/log/mrmap/backend
- type: volume
source: backend-import
target: /var/mrmap/import
networks:
- mrmap-internal
env_file:
- docker/backend/.mrmap.env
depends_on:
- postgis
- redis
- mapserver
celery-worker:
build:
context: ./backend
dockerfile: ../docker/backend/alpine.Dockerfile
args:
MRMAP_PRODUCTION: "True"
# deploy:
# replicas: 10
command: >
/bin/sh -c "celery -A MrMap worker -E -l INFO -Q download,default,db-routines"
# Do not activate tty!!!!! This will freeze the worker process in case of console spamming.
# See: https://stackoverflow.com/questions/48021772/docker-process-hangs-on-write-system-call-to-stdout
#tty: true # To support colorized log output.
hostname: "celery-worker"
volumes:
- type: bind
source: ./backend
target: /opt/mrmap
- type: volume
source: backend-media
target: /var/mrmap/backend/media
- type: volume
source: backend-log
target: /var/log/mrmap/backend
- type: volume
source: backend-import
target: /var/mrmap/import
networks:
- mrmap-internal
env_file:
- ./docker/backend/.mrmap.env
depends_on:
- postgis
- redis
cap_add:
- SYS_PTRACE
healthcheck:
test: celery -A MrMap inspect ping || exit 1
interval: 1m
timeout: 10s
retries: 3
start_period: 40s
restart: always
celery-beat:
build:
context: ./backend
dockerfile: ../docker/backend/alpine.Dockerfile
args:
MRMAP_PRODUCTION: "True"
command: >
/bin/sh -c "celery -A MrMap beat --loglevel INFO --scheduler django"
tty: true # To support colorized log output.
hostname: "mrmap-celery-beat"
volumes:
- type: bind
source: ./backend
target: /opt/mrmap
- type: volume
source: backend-media
target: /var/mrmap/backend/media
- type: volume
source: backend-log
target: /var/log/mrmap/backend
- type: volume
source: backend-import
target: /var/mrmap/import
networks:
- mrmap-internal
env_file:
- ./docker/backend/.mrmap.env
depends_on:
- postgis
- redis
frontend:
build:
context: ./
dockerfile: ./docker/nginx/nginx.Dockerfile
args:
# For Production: Insert the correct schema and the correct hostname and port of the backend
- VITE_API_BASE_URL=localhost:443
- VITE_API_SCHEMA=https
hostname: "nginx"
volumes:
# To provide a concrete certificate
#- type: bind
# source: path-to-cert
# target: /etc/ssl/certs/nginx-selfsigned.crt
#- type: bind
# source: path-to-cert-key
# target: /etc/ssl/private/nginx-selfsigned.key
- type: bind
source: ./docker/nginx/mrmap.conf
target: /etc/nginx/conf.d/default.conf
- type: volume
source: backend-static
target: /var/www/mrmap/backend
- type: volume
source: frontend-static
target: /var/www/mrmap/frontend
ports:
- "80:80"
- "443:443"
depends_on:
- backend
networks:
- mrmap-internal
extra_hosts:
- host.docker.internal:host-gateway
volumes:
frontend-static: null
backend-static: null
backend-media: null
backend-log: null
backend-import: null
db-data: null
mem-db-data:
null
networks:
mrmap-internal: null