-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
168 lines (159 loc) · 4.51 KB
/
docker-compose.yml
File metadata and controls
168 lines (159 loc) · 4.51 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
# Inspired by https://docs.docker.com/compose/django/
version: '3'
services:
db:
# NOTE: No persistance storage configured.
# See: https://hub.docker.com/_/postgres/
image: postgres:17
environment:
POSTGRES_HOST_AUTH_METHOD: trust
# NOTE: this works for bitnami, not sure if this works for regular
# postgres image
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-klant-dev
web:
image: maykinmedia/open-klant:${TAG:-latest}
build:
context: .
environment: &web_env
DJANGO_SETTINGS_MODULE: openklant.conf.docker
IS_HTTPS: no
DB_NAME: postgres
DB_USER: postgres
DB_HOST: db
ALLOWED_HOSTS: '*'
CACHE_DEFAULT: redis:6379/0
CACHE_AXES: redis:6379/0
SUBPATH: ${SUBPATH:-/}
SECRET_KEY: ${SECRET_KEY:-django-insecure-f8s@b*ds4t84-q_2#c0j0506@!l2q6r5_pq5e!vm^_9c*#^66b}
CELERY_BROKER_URL: redis://redis:6379/0
CELERY_RESULT_BACKEND: redis://redis:6379/0
DISABLE_2FA: true
LOG_NOTIFICATIONS_IN_DB: ${LOG_NOTIFICATIONS_IN_DB:-yes}
DB_CONN_MAX_AGE: "0"
DB_POOL_ENABLED: True
# Celery
CELERY_WORKER_NAME: celery@docker
# 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: maykin.saas.client=maykin,maykin.saas.target=dev
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
healthcheck:
test: ["CMD", "maykin-common", "health-check"]
interval: 30s
timeout: 5s
retries: 5
# 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: 30s
volumes: &web_volumes
- media:/app/media
- private_media:/app/private_media
- log:/app/log
ports:
- 8000:8000
depends_on:
db:
condition: service_healthy
redis:
condition: service_started
web-init:
condition: service_completed_successfully
labels:
client: dev
target: test
app: open-klant
service: web
networks:
- open-klant-dev
web-init:
image: maykinmedia/open-klant:${TAG:-latest}
environment:
<<: *web_env
#
# Django-setup-configuration
RUN_SETUP_CONFIG: ${RUN_SETUP_CONFIG:-true}
command: sh -c "/upgrade_check_version.sh &&
/setup_configuration.sh"
volumes:
- log:/app/log
- ./docker/setup_configuration:/app/setup_configuration
depends_on:
- db
- redis
networks:
- open-klant-dev
celery:
image: maykinmedia/open-klant:${TAG:-latest}
environment: *web_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
depends_on:
web:
condition: service_healthy
volumes: *web_volumes
networks:
- open-klant-dev
celery-flower:
image: maykinmedia/open-klant:${TAG:-latest}
environment: *web_env
command: /celery_flower.sh
ports:
- 5555:5555
depends_on:
- redis
- celery
healthcheck:
test: [
"CMD",
"maykin-common",
"health-check",
"--endpoint=http://localhost:5555/"
]
networks:
- open-klant-dev
redis:
image: redis:8
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 30s
timeout: 1s
retries: 3
networks:
- open-klant-dev
volumes:
db:
log:
media:
private_media:
networks:
open-klant-dev:
name: open-klant-dev