-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
247 lines (237 loc) · 8.33 KB
/
docker-compose.yml
File metadata and controls
247 lines (237 loc) · 8.33 KB
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
# docker compose file for productive useage
services:
postgis:
image: postgis/postgis:17-3.6-alpine
volumes:
- type: volume
source: db-data-17
target: /var/lib/postgresql/data
- type: tmpfs
target: /dev/shm
tmpfs:
size: 134217728 # 128*2^20 bytes = 128Mb
networks:
- mrmap-internal
environment:
POSTGRES_USER: "${DB_USER:?Please configure DB_USER in the .env file}"
POSTGRES_PASSWORD: "${DB_PASSWORD:?Please configure DB_PASSWORD in the .env file}"
POSTGRES_DB: "${POSTGRES_DB:-mrmap}"
# migration guide:
# 1. backup current db => docker exec -it `container_id` pg_dumpall -U mrmap > .upgrade_backup.sql
# 2. call pg_extract script => backend/.bash_scripts/pg_extract.sh .upgrade_backup.sql mrmap >> upgrade_backup_mydb.sql
# 3. change image definition to higher postgis; change volume source to new location; start container => docker compose up postgis --build
# 4. cat upgrade_backup_mydb.sql | docker exec -i `container_id` psql -U mrmap
# Done
redis:
image: library/redis:8.6.1-alpine3.23
volumes:
- type: volume
source: mem-db-data
target: /data
networks:
- mrmap-internal
environment:
- loglevel=error
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
environment:
EXTERNAL_BASE_URL: "${EXTERNAL_BASE_URL:?Please configure EXTERNAL_BASE_URL in the .env file}"
DJANGO_SECRET_KEY: "${DJANGO_SECRET_KEY:?Please configure DJANGO_SECRET_KEY in the .env file}"
MRMAP_USER: "${DJANGO_ADMIN_USER:?Please configure DJANGO_ADMIN_USER in the .env file}"
MRMAP_PASSWORD: "${DJANGO_ADMIN_PASSWORD:?Please configure DJANGO_ADMIN_PASSWORD in the .env file}"
SQL_USER: "${DB_USER:?Please configure DB_PASSWORD in the .env file}"
SQL_PASSWORD: "${DB_PASSWORD:?Please configure DB_PASSWORD in the .env file}"
GUNICORN_WORKERS: ${GUNICORN_WORKERS:-4}
env_file:
- docker/backend/.mrmap.env
depends_on:
- postgis
- redis
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 --statedb=/var/run/celery/%n-%i_worker.state"
# 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
- type: volume
source: celery-state
target: /var/run/celery
networks:
- mrmap-internal
environment:
EXTERNAL_BASE_URL: "${EXTERNAL_BASE_URL:?Please configure EXTERNAL_BASE_URL in the .env file}"
DJANGO_SECRET_KEY: "${DJANGO_SECRET_KEY:?Please configure DJANGO_SECRET_KEY in the .env file}"
MRMAP_USER: "${DJANGO_ADMIN_USER:?Please configure DJANGO_ADMIN_USER in the .env file}"
MRMAP_PASSWORD: "${DJANGO_ADMIN_PASSWORD:?Please configure DJANGO_ADMIN_PASSWORD in the .env file}"
SQL_USER: "${DB_USER:?Please configure DB_PASSWORD in the .env file}"
SQL_PASSWORD: "${DB_PASSWORD:?Please configure DB_PASSWORD in the .env file}"
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
environment:
EXTERNAL_BASE_URL: "${EXTERNAL_BASE_URL:?Please configure EXTERNAL_BASE_URL in the .env file}"
DJANGO_SECRET_KEY: "${DJANGO_SECRET_KEY:?Please configure DJANGO_SECRET_KEY in the .env file}"
MRMAP_USER: "${DJANGO_ADMIN_USER:?Please configure DJANGO_ADMIN_USER in the .env file}"
MRMAP_PASSWORD: "${DJANGO_ADMIN_PASSWORD:?Please configure DJANGO_ADMIN_PASSWORD in the .env file}"
SQL_USER: "${DB_USER:?Please configure DB_PASSWORD in the .env file}"
SQL_PASSWORD: "${DB_PASSWORD:?Please configure DB_PASSWORD in the .env file}"
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=${EXTERNAL_BASE_URL:?Please configure EXTERNAL_BASE_URL in the .env file}
- VITE_API_PORT=${EXTERNAL_PORT:?Please configure EXTERNAL_PORT in the .env file}
- VITE_API_SCHEMA=${EXTERNAL_SCHEME:?Please configure EXTERNAL_SCHEME in the .env file}
hostname: "nginx"
volumes:
- 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:
- "${EXTERNAL_PORT:?Please configure EXTERNAL_PORT in the .env file}:80"
depends_on:
- backend
networks:
- mrmap-internal
extra_hosts:
- host.docker.internal:host-gateway
openobserve:
image: public.ecr.aws/zinclabs/openobserve:v0.15.0-rc5
restart: unless-stopped
hostname: "openobserve"
environment:
ZO_ROOT_USER_EMAIL: "${OPENOBSERVE_USER:?Please configure OPENOBSERVE_USER in the .env file}"
ZO_ROOT_USER_PASSWORD: "${OPENOBSERVE_PASSWORD:?Please configure OPOPENOBSERVE_PASSWORDNOBSERVE_USER in the .env file}"
ZO_BASE_URI: "/openobserve"
volumes:
- type: volume
source: openobserve-data
target: /data
networks:
- mrmap-internal
pgadmin:
image: dpage/pgadmin4:9.13.0
restart: unless-stopped
hostname: "pgadmin"
environment:
PGADMIN_DEFAULT_EMAIL: "${PGADMIN_USER:?Please configure PGADMIN_USER in the .env file}"
PGADMIN_DEFAULT_PASSWORD: "${PGADMIN_PASSWORD:?Please configure PGADMIN_PASSWORD in the .env file}"
PGADMIN_REPLACE_SERVERS_ON_STARTUP: true
PGADMIN_LISTEN_PORT: 8009
volumes:
- type: bind
source: ./docker/pgadmin/servers.json
target: /pgadmin4/servers.json
networks:
- mrmap-internal
flower:
image: mher/flower:2.0
command: ["celery", "--broker=redis://redis:6379", "flower", "--port=5555"]
networks:
- mrmap-internal
volumes:
frontend-static: null
backend-static: null
backend-media: null
backend-log: null
backend-import: null
celery-state: null
db-data: null
db-data-17: null
mem-db-data: null
openobserve-data: null
networks:
mrmap-internal: null