-
Notifications
You must be signed in to change notification settings - Fork 33
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
279 lines (262 loc) · 7.12 KB
/
Copy pathdocker-compose.yml
File metadata and controls
279 lines (262 loc) · 7.12 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
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
#
# Docker-compose for full Open Form stack.
#
# DISCLAIMER: THIS IS FOR DEVELOPMENT PURPOSES ONLY AND NOT SUITABLE FOR PRODUCTION.
#
# You can use this docker-compose to spin up a local Open Forms stack for demo/try-out
# purposes, or to get some insight in the various components involved (e.g. to build
# your Helm charts from). Note that various environment variables are UNSAFE and merely
# specified so that you can get up and running with the least amount of friction.
#
# Before deploying to production, please review the environment configuration reference:
# https://open-forms.readthedocs.io/en/latest/installation/config.html
#
x-labels: &x-labels
client: of
target: docker-compose
app: openforms
x-app-env: &x-app-env
- DJANGO_SETTINGS_MODULE=openforms.conf.docker
- SECRET_KEY=${SECRET_KEY:-@r0w-0(&apjfde5fl6h23!vn)r1ldkp1c_d2#!$$did4z5hun4a}
- DB_NAME=openforms
- DB_USER=openforms
- DB_HOST=db
- STATIC_ROOT_VOLUME=/srv/static/
- CACHE_DEFAULT=redis:6379/0
- CACHE_AXES=redis:6379/0
- CACHE_PORTALOCKER=redis:6379/0
- ALLOWED_HOSTS=*
- USE_X_FORWARDED_HOST=true
- CSRF_TRUSTED_ORIGINS=http://localhost:9000,http://localhost:8000
- CELERY_BROKER_URL=redis://redis:6379/0
- CELERY_RESULT_BACKEND=redis://redis:6379/0
- CELERY_LOGLEVEL=DEBUG
- CELERY_WORKER_NAME=celery@docker
- OPENFORMS_LOCATION_CLIENT=${OPENFORMS_LOCATION_CLIENT:-openforms.contrib.bag.client.BAGClient}
- CORS_ALLOW_ALL_ORIGINS=${CORS_ALLOW_ALL_ORIGINS:-true}
- EMAIL_HOST=smtp
# Needed for Celery Flower to match the TIME_ZONE configured in the
# settings used by workers and beat containers.
- TZ=Europe/Amsterdam
- CSP_REPORT_ONLY=yes
# Environment labeling
- SHOW_ENVIRONMENT=yes
- ENVIRONMENT_LABEL=docker-compose
- ENVIRONMENT_BACKGROUND_COLOR=#1d63ed
- ENVIRONMENT_FOREGROUND_COLOR=white
# Django-setup-configuration
- RUN_SETUP_CONFIG=${RUN_SETUP_CONFIG:-True}
- UWSGI_MEMORY_REPORT=1
# Enabling Open Telemetry requires the services in docker/docker-compose.observability.yml
# to be up and running.
- OTEL_SDK_DISABLED=${OTEL_SDK_DISABLED:-true}
- OTEL_RESOURCE_ATTRIBUTES=of.client=of,of.target=docker-compose
- OTEL_METRIC_EXPORT_INTERVAL=${OTEL_METRIC_EXPORT_INTERVAL:-60000}
- OTEL_EXPORTER_OTLP_ENDPOINT=${OTEL_EXPORTER_OTLP_ENDPOINT:-http://otel-collector:4317} # gRPC
# otel:supersecret, escape spaces and = with percent encoding
- OTEL_EXPORTER_OTLP_HEADERS=Authorization=Basic b3RlbDpzdXBlcnNlY3JldA==
- OTEL_EXPORTER_OTLP_METRICS_INSECURE=${OTEL_EXPORTER_OTLP_METRICS_INSECURE:-true}
- _OTEL_ENABLE_CONTAINER_RESOURCE_DETECTOR=true
x-app-volumes: &x-app-volumes
- static:/srv/static
- media:/app/media
- private_media:/app/private_media
- ./docker/setup_configuration:/app/setup_configuration
- log:/app/log
- certifi_ca_bundle:/app/certifi_ca_bundle
- ./bin/test_fix_scripts.sh:/app/bin/test_fix_scripts.sh
services:
db:
image: postgres:${PG_VERSION:-15} # Minimum required version is 12
environment:
- POSTGRES_HOST_AUTH_METHOD=trust
volumes:
- ./docker-init-db.sql:/docker-entrypoint-initdb.d/init_db.sql
- db:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready"]
interval: 10s
timeout: 5s
retries: 5
networks:
- open-forms-dev
redis:
image: redis:8
command: ["redis-server", "--appendonly", "yes"]
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 30s
timeout: 1s
retries: 3
networks:
- open-forms-dev
volumes:
- data:/data
smtp:
image: namshi/smtp
networks:
- open-forms-dev
clamav:
image: clamav/clamav:1.5
healthcheck:
test: ["CMD", "clamdcheck.sh"]
interval: 5s
timeout: 1s
retries: 5
start_period: 6m
networks:
- open-forms-dev
prepare-volumes:
image: busybox
command: /bin/chown -R 1000 /private-media /srv/static
volumes:
- static:/srv/static
- private_media:/private-media
web:
build: &web_build
context: .
args:
RELEASE: ${TAG:-latest}
SDK_RELEASE: ${SDK_TAG:-latest}
image: openformulieren/open-forms:${TAG:-latest}
environment: *x-app-env
volumes: *x-app-volumes
labels:
<<: *x-labels
service: web
ports:
- 8000:8000
depends_on:
- prepare-volumes
- db
- redis
- smtp
- clamav
# The following pattern can be used to let the web container start after
# setup-configuration is done running
# web-init:
# condition: service_completed_successfully
healthcheck:
test: ["CMD", "maykin-common", "health-check"]
interval: 30s
timeout: 5s
retries: 5
networks:
- open-forms-dev
web-init:
build: .
environment: *x-app-env
command: /setup_configuration.sh
volumes: *x-app-volumes
depends_on:
- prepare-volumes
- db
- redis
networks:
- open-forms-dev
nginx:
build:
context: ./docker/nginx
volumes:
- static:/static
- private_media:/private-media
ports:
- '9000:80'
depends_on:
- web
healthcheck:
test: ['CMD', 'curl', '-f', 'http://localhost:80/_healthz/livez/']
interval: 30s
timeout: 5s
retries: 3
start_period: 10s
networks:
- open-forms-dev
celery:
build: *web_build
image: openformulieren/open-forms:${TAG:-latest}
environment: *x-app-env
command: /celery_worker.sh
healthcheck:
test: [
"CMD",
"maykin-common",
"worker-health-check",
"--liveness-file=/app/tmp/celery_worker_event_loop.live",
"--max-age=70",
"--broker=redis://redis:6379/0",
"--worker-name=celery@docker",
]
interval: 60s
timeout: 5s
retries: 3
start_period: 10s
volumes: *x-app-volumes
labels:
<<: *x-labels
service: background-tasks
depends_on:
- db
- redis
networks:
- open-forms-dev
celery-beat:
build: *web_build
image: openformulieren/open-forms:${TAG:-latest}
environment: *x-app-env
command: /celery_beat.sh
labels:
<<: *x-labels
service: task-scheduler
depends_on:
- db
- redis
healthcheck:
test: [
"CMD",
"maykin-common",
"beat-health-check",
"--file=/app/tmp/celery_beat.live",
"--max-age=120"
]
interval: 60s
timeout: 5s
retries: 5
networks:
- open-forms-dev
celery-flower:
build: *web_build
image: openformulieren/open-forms:${TAG:-latest}
environment: *x-app-env
command: /celery_flower.sh
ports:
- 5555:5555
labels:
<<: *x-labels
service: task-monitoring
depends_on:
- redis
- celery
healthcheck:
test: [
"CMD",
"maykin-common",
"health-check",
"--endpoint=http://localhost:5555/"
]
interval: 30s
timeout: 5s
retries: 5
networks:
- open-forms-dev
volumes:
db:
static:
media:
private_media:
log:
certifi_ca_bundle:
data:
networks:
open-forms-dev:
name: open-forms-dev