-
Notifications
You must be signed in to change notification settings - Fork 8
/
docker-compose.yml
238 lines (223 loc) · 6.37 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
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
version: '3'
services:
corgi-db:
container_name: corgi-db
deploy:
resources:
limits:
memory: 2G
image: registry.redhat.io/rhel8/postgresql-15:1-44
shm_size: 1G
hostname: corgi-db
environment:
POSTGRESQL_DATABASE: corgi-db
POSTGRESQL_USER: corgi-db-user
POSTGRESQL_PASSWORD: "test"
POSTGRESQL_ADMIN_PASSWORD: "test"
volumes:
- corgi-pg-data:/var/lib/pgsql/data/
# Config files in below directory are automatically loaded by postgres at startup
- ${PWD}/etc/pg:/opt/app-root/src/postgresql-cfg:z
ports:
- "5433:5432"
healthcheck:
test: ["CMD-SHELL", "pg_isready -d corgi-db"]
interval: "60s"
timeout: "5s"
retries: 3
redis:
container_name: redis
deploy:
resources:
limits:
memory: 1G # Keep in sync with OpenShift mem limits to catch OOM problems
hostname: redis
# Keep this in sync with openshift/playbooks/redis.yml
image: "registry.redhat.io/rhel8/redis-6:1"
ports:
- "6379:6379"
redis-exporter:
container_name: redis-exporter
image: quay.io/oliver006/redis_exporter@sha256:6ef9be804859638d84a588b387009e3695e1e29cd8f45a1197d6d923b49ae9b7
environment:
REDIS_ADDR: "redis://redis:6379"
REDIS_EXPORTER_CHECK_SINGLE_KEYS: "slow,fast,cpu"
ports:
- "9121:9121"
deploy:
resources:
limits:
memory: 300M # Keep in sync with OpenShift mem limits to catch OOM problems
corgi-nginx:
container_name: corgi-nginx
image: registry.redhat.io/ubi9/nginx-122:1
depends_on: ["corgi-web"]
ports:
- "8080:8080"
command: "nginx -g 'daemon off;'"
volumes:
- ./staticfiles:/opt/app-root/src/staticfiles:z
- ./etc/nginx:/opt/app-root/etc/nginx.default.d/
deploy:
resources:
limits:
memory: 1.5G # Keep in sync with OpenShift mem limits to catch OOM problems
corgi-nginx-exporter:
container_name: corgi-nginx-exporter
depends_on: ["corgi-nginx"]
image: quay.io/nginx/nginx-prometheus-exporter@sha256:131c2c2963296bbae7e9fcb52f77a1202f1d87d5d85e8e6cd7bcbccad799bc01
environment:
SCRAPE_URI: "http://corgi-nginx:8080/stub_status"
ports:
- "9113:9113"
deploy:
resources:
limits:
memory: 128M # Keep in sync with OpenShift mem limits to catch OOM problems
corgi-web:
container_name: corgi-web
build:
context: .
args:
- PIP_INDEX_URL=${PIP_INDEX_URL}
- PIP_REQUIREMENT=./requirements/dev.txt
- ROOT_CA_URL=${ROOT_CA_URL}
image: corgi
depends_on: ["corgi-db"]
deploy:
resources:
limits:
memory: 1.5G # Keep in sync with OpenShift mem limits to catch OOM problems
ports:
- "8008:8008"
env_file:
- .env
environment:
CORGI_DB_HOST: corgi-db
command: ./run_service.sh
healthcheck:
test: ["CMD-SHELL", "curl -f http://localhost:8008/api/healthy || exit 1"]
interval: "60s"
timeout: "3s"
retries: 3
volumes:
# Mount local source files in the container so file changes do not require container respins. But, ignore
# the venv directory so that locally installed (using local paths) dependencies don't clash with
# the container-specific virtual environment.
- .:/opt/app-root/src:z
- /opt/app-root/src/venv/
corgi-monitor:
container_name: corgi-monitor
image: corgi
depends_on: ["corgi-db", "redis"]
deploy:
resources:
limits:
memory: 128M # Keep in sync with OpenShift mem limits to catch OOM problems
environment:
CORGI_DB_HOST: corgi-db
env_file: .env
command: ./run_umb_monitor.sh
# TODO: add healthcheck
volumes:
- .:/opt/app-root/src:z
- /opt/app-root/src/venv/
corgi-celery-beat:
container_name: corgi-celery-beat
image: corgi
env_file:
- .env
environment:
CORGI_DB_HOST: corgi-db
depends_on: ["corgi-db", "redis"]
deploy:
resources:
limits:
memory: 128M # Keep in sync with OpenShift mem limits to catch OOM problems
command: ./run_celery_beat.sh
# TODO: add healthcheck
volumes:
- .:/opt/app-root/src:z
- /opt/app-root/src/venv/
corgi-celery-fast:
deploy:
resources:
limits:
memory: 1G # Keep in sync with OpenShift mem limits to catch OOM problems
container_name: corgi-celery-fast
image: corgi
env_file:
- .env
environment:
CORGI_DB_HOST: corgi-db
depends_on: ["corgi-celery-beat"]
command: ./run_celery_fast.sh
# TODO: add healthcheck
volumes:
- .:/opt/app-root/src:z
- /opt/app-root/src/venv/
corgi-celery-slow:
deploy:
replicas: 2
resources:
limits:
memory: 1G # Keep in sync with OpenShift mem limits to catch OOM problems
container_name: corgi-celery-slow
image: corgi
env_file:
- .env
environment:
CORGI_DB_HOST: corgi-db
depends_on: ["corgi-celery-beat"]
command: ./run_celery_slow.sh
# TODO: add healthcheck
volumes:
- .:/opt/app-root/src:z
- /opt/app-root/src/venv/
corgi-celery-cpu:
deploy:
replicas: 2
resources:
limits:
memory: 5G # Keep in sync with OpenShift mem limits to catch OOM problems
container_name: corgi-celery-cpu
image: corgi
env_file:
- .env
environment:
CORGI_DB_HOST: corgi-db
depends_on: ["corgi-celery-beat"]
command: ./run_celery_cpu.sh
# TODO: add healthcheck
volumes:
- .:/opt/app-root/src:z
- /opt/app-root/src/venv/
flower:
container_name: corgi-flower
deploy:
resources:
limits:
memory: 256M # Keep in sync with OpenShift mem limits to catch OOM problems
hostname: flower
image: corgi
env_file:
- .env
environment:
CORGI_DB_HOST: corgi-db
depends_on: ["redis", "corgi-db"]
command: ./run_celery_flower.sh
ports:
- "5555:9455"
volumes:
- .:/opt/app-root/src:z
- /opt/app-root/src/venv/
locust:
container_name: locust
image: docker.io/locustio/locust:2.20.1
ports:
- '9000:8089'
volumes:
- ${PWD}/perf:/mnt/locust:z
command: --class-picker -f /mnt/locust -H http://corgi-nginx:8080 --web-host 0.0.0.0 --modern-ui
volumes:
corgi-pg-data: