-
Notifications
You must be signed in to change notification settings - Fork 6
/
docker-compose.yml
181 lines (169 loc) · 5.22 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
#
# Docker-compose for full Open Inwoner 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 Inwoner 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-inwoner.readthedocs.io/
#
version: '3.4'
services:
db:
image: postgis/postgis:${PG_VERSION:-14-master}
container_name: open-inwoner-db
environment:
- POSTGRES_HOST_AUTH_METHOD=${POSTGRES_HOST_AUTH_METHOD:-trust}
- POSTGRES_DB=${POSTGRES_DB:-open_inwoner}
- POSTGRES_USER=${POSTGRES_USER:-open_inwoner}
volumes:
- ./docker-initdb.d/:/docker-entrypoint-initdb.d
- db:/var/lib/postgresql/data
networks:
- openinwoner-dev
elasticsearch:
image: docker.elastic.co/elasticsearch/elasticsearch:7.9.2
container_name: elasticsearch
environment:
- discovery.type=single-node
- cluster.routing.allocation.disk.threshold_enabled=false
- "ES_JAVA_OPTS=-Xms512m -Xmx512m"
networks:
- openinwoner-dev
volumes:
- es_data:/usr/share/elasticsearch/data
ports:
- ${ES_PORTS:-9201:9201}
redis:
image: redis:6
command: ["redis-server", "--appendonly", "yes"]
networks:
- openinwoner-dev
volumes:
- data:/data
busybox:
image: busybox
command: /bin/chown -R 1000 /private-media
volumes:
- private_media:/private-media
web: &web-service
build: &web_build
context: .
args:
RELEASE: ${TAG:-latest}
container_name: open-inwoner-web
image: maykinmedia/open-inwoner:${TAG:-latest}
environment: &web_env
- DJANGO_SETTINGS_MODULE=open_inwoner.conf.docker
- SECRET_KEY=${SECRET_KEY:-7bk)w=_%lnm#68rc!c)h@gy&5+%^fl=okq17bv!)yv!l0udu2y}
- ALLOWED_HOSTS=*
- CORS_ALLOW_ALL_ORIGINS=${CORS_ALLOW_ALL_ORIGINS:-true}
- CSRF_TRUSTED_ORIGINS='http://localhost:9000'
- CACHE_DEFAULT=redis:6379/0
- CACHE_AXES=redis:6379/0
- CACHE_OIDC=redis:6379/0
- CACHE_PORTALOCKER=redis:6379/0
- CELERY_BROKER_URL=redis://redis:6379/0
- CELERY_RESULT_BACKEND=redis://redis:6379/0
- CELERY_LOGLEVEL=DEBUG
- ES_HOST=elasticsearch
# Needed for Celery Flower to match the TIME_ZONE configured in the
# settings used by workers and beat containers.
- TZ=Europe/Amsterdam
# WARNING: Strictly for development!
- DISABLE_2FA=${DISABLE_2FA:-True}
- DEBUG=True
- IS_HTTPS=no
healthcheck:
test: ["CMD", "python", "-c", "import requests; exit(requests.head('http://localhost:8000/admin/').status_code not in [200, 302])"]
interval: 30s
timeout: 5s
retries: 3
# This should allow for enough time for migrations to run before the max
# retries have passed. This healthcheck in turn allows other containers
# to wait for the database migrations.
start_period: 60s
volumes: &web_volumes
- media:/app/media
- private_media:/app/private_media
ports:
- 8000:8000
depends_on:
- db
- redis
networks:
- openinwoner-dev
web-init:
<<: *web-service
container_name: open-inwoner-web-init
ports: []
env_file:
- django-setup-config.env
command: /setup_configuration.sh
nginx:
image: nginx
volumes:
- ./docker-nginx-default.conf:/etc/nginx/conf.d/default.conf
- private_media:/private-media
ports:
- '9000:80'
depends_on:
- web
networks:
- openinwoner-dev
celery:
build: *web_build
image: maykinmedia/open-inwoner:${TAG:-latest}
environment: *web_env
command: /celery_worker.sh
healthcheck:
test: ["CMD", "python", "/app/bin/check_celery_worker_liveness.py"]
interval: 30s
timeout: 5s
retries: 3
start_period: 10s
volumes: *web_volumes
depends_on:
web:
# This health check condition is needed because Celery Beat will
# try to convert the CELERY_BEAT_SCHEDULE into database entries. For
# this, migrations need to be finished. If Celery tasks were still
# pending, the database also needs to be ready for Celery itself. We
# therefore have the health check here, and make Celery beat and
# monitor containers depend on the celery container.
condition: service_healthy
redis:
condition: service_started
networks:
- openinwoner-dev
celery-beat:
build: *web_build
image: maykinmedia/open-inwoner:${TAG:-latest}
environment: *web_env
command: /celery_beat.sh
depends_on:
- celery
networks:
- openinwoner-dev
celery-monitor:
build: *web_build
image: maykinmedia/open-inwoner:${TAG:-latest}
environment: *web_env
command: /celery_monitor.sh
depends_on:
- celery
networks:
- openinwoner-dev
volumes:
db:
media:
private_media:
data:
es_data:
networks:
openinwoner-dev:
name: openinwoner-dev