-
Notifications
You must be signed in to change notification settings - Fork 12
/
docker-compose.yml
353 lines (335 loc) · 9.75 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
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
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
---
#
# Docker service definitions for the aurweb project.
#
# Notable services:
# - `sharness` - Run sharness test suites
# - `pytest-mysql` - Run pytest suites with MariaDB
# - `pytest-sqlite` - Run pytest suites with SQLite
# - `test` - Run sharness, pytest-mysql and pytest-sqlite
# - `mariadb` - `port 13306` - MariaDB server for docker
# - `ca` - Certificate Authority generation
# - `git` - `port 2222` - Git over SSH server
# - `fastapi` - hypercorn service for aurweb's FastAPI app
# - `nginx` - `port 8444 (FastAPI)
# - You can reach `nginx` via FastAPI at `https://localhost:8444/`.
# CGit can be reached via the `/cgit/` request uri on either server.
#
# Copyright (C) 2021 aurweb Development
# All Rights Reserved.
services:
aurweb-image:
build: .
image: aurweb:latest
ca:
image: aurweb:latest
init: true
entrypoint: /docker/ca-entrypoint.sh
command: /docker/scripts/run-ca.sh
healthcheck:
test: "bash /docker/health/ca.sh"
interval: 3s
volumes:
- step:/root/.step
redis:
image: aurweb:latest
init: true
entrypoint: /docker/redis-entrypoint.sh
command: /docker/scripts/run-redis.sh
healthcheck:
test: "bash /docker/health/redis.sh"
interval: 3s
ports:
- "127.0.0.1:16379:6379"
mariadb:
image: aurweb:latest
init: true
entrypoint: /docker/mariadb-entrypoint.sh
command: /usr/bin/mariadbd-safe --datadir=/var/lib/mysql
ports:
# This will expose mariadbd on 127.0.0.1:13306 in the host.
# Ex: `mysql -uaur -paur -h 127.0.0.1 -P 13306 aurweb`
- "127.0.0.1:13306:3306"
volumes:
- mariadb_run:/var/run/mysqld # Bind socket in this volume.
- mariadb_data:/var/lib/mysql
healthcheck:
test: "bash /docker/health/mariadb.sh"
interval: 3s
mariadb_init:
image: aurweb:latest
init: true
environment:
- AUR_CONFIG_IMMUTABLE=${AUR_CONFIG_IMMUTABLE:-0}
entrypoint: /docker/mariadb-init-entrypoint.sh
command: echo "MariaDB tables initialized."
volumes:
- mariadb_run:/var/run/mysqld
depends_on:
mariadb:
condition: service_healthy
mariadb_test:
# Test database.
image: aurweb:latest
init: true
environment:
- MARIADB_PRIVILEGED=1
entrypoint: /docker/mariadb-entrypoint.sh
command: /usr/bin/mariadbd-safe --datadir=/var/lib/mysql
ports:
# This will expose mariadbd on 127.0.0.1:13307 in the host.
# Ex: `mysql -uaur -paur -h 127.0.0.1 -P 13306 aurweb`
- "127.0.0.1:13307:3306"
volumes:
- mariadb_test_run:/var/run/mysqld # Bind socket in this volume.
healthcheck:
test: "bash /docker/health/mariadb.sh"
interval: 3s
git:
image: aurweb:latest
init: true
environment:
- AUR_CONFIG=/aurweb/conf/config
- SSH_CMDLINE=${SSH_CMDLINE:-ssh ssh://aur@localhost:2222}
- AUR_CONFIG_IMMUTABLE=${AUR_CONFIG_IMMUTABLE:-0}
entrypoint: /docker/git-entrypoint.sh
command: /docker/scripts/run-sshd.sh
ports:
- "2222:2222"
healthcheck:
test: "bash /docker/health/sshd.sh"
interval: 3s
depends_on:
mariadb:
condition: service_healthy
mariadb_init:
condition: service_completed_successfully
volumes:
- mariadb_run:/var/run/mysqld
smartgit:
image: aurweb:latest
init: true
environment:
- AUR_CONFIG=/aurweb/conf/config
entrypoint: /docker/smartgit-entrypoint.sh
command: /docker/scripts/run-smartgit.sh
healthcheck:
test: "bash /docker/health/smartgit.sh"
interval: 3s
depends_on:
mariadb:
condition: service_healthy
cgit-fastapi:
image: aurweb:latest
init: true
environment:
- AUR_CONFIG=/aurweb/conf/config
- CGIT_CLONE_PREFIX=${AURWEB_FASTAPI_PREFIX}
- CGIT_CSS=/static/css/cgit.css
entrypoint: /docker/cgit-entrypoint.sh
command: /docker/scripts/run-cgit.sh 3000
healthcheck:
test: "bash /docker/health/cgit.sh 3000"
interval: 3s
depends_on:
git:
condition: service_healthy
ports:
- "127.0.0.1:13001:3000"
volumes:
- git_data:/aurweb/aur.git
cron:
image: aurweb:latest
init: true
environment:
- AUR_CONFIG=/aurweb/conf/config
- AUR_CONFIG_IMMUTABLE=${AUR_CONFIG_IMMUTABLE:-0}
entrypoint: /docker/cron-entrypoint.sh
command: /docker/scripts/run-cron.sh
depends_on:
mariadb:
condition: service_healthy
mariadb_init:
condition: service_completed_successfully
volumes:
- ./aurweb:/aurweb/aurweb
- mariadb_run:/var/run/mysqld
- archives:/var/lib/aurweb/archives
fastapi:
image: aurweb:latest
init: true
environment:
- AUR_CONFIG=conf/config
- FASTAPI_BACKEND=${FASTAPI_BACKEND}
- FASTAPI_WORKERS=${FASTAPI_WORKERS}
- AURWEB_FASTAPI_PREFIX=${AURWEB_FASTAPI_PREFIX}
- AURWEB_SSHD_PREFIX=${AURWEB_SSHD_PREFIX}
- PROMETHEUS_MULTIPROC_DIR=/tmp_prometheus
- AUR_CONFIG_IMMUTABLE=${AUR_CONFIG_IMMUTABLE:-0}
entrypoint: /docker/fastapi-entrypoint.sh
command: /docker/scripts/run-fastapi.sh "${FASTAPI_BACKEND}"
healthcheck:
test: "bash /docker/health/fastapi.sh ${FASTAPI_BACKEND}"
interval: 3s
depends_on:
git:
condition: service_healthy
redis:
condition: service_healthy
cron:
condition: service_started
mariadb:
condition: service_healthy
mariadb_init:
condition: service_completed_successfully
tempo:
condition: service_healthy
volumes:
- archives:/var/lib/aurweb/archives
- mariadb_run:/var/run/mysqld
ports:
- "127.0.0.1:18000:8000"
nginx:
image: aurweb:latest
init: true
environment:
- AUR_CONFIG=conf/config
entrypoint: /docker/nginx-entrypoint.sh
command: /docker/scripts/run-nginx.sh
ports:
- "127.0.0.1:8444:8444" # FastAPI
healthcheck:
test: "bash /docker/health/nginx.sh"
interval: 3s
depends_on:
ca:
condition: service_healthy
cgit-fastapi:
condition: service_healthy
smartgit:
condition: service_healthy
fastapi:
condition: service_healthy
sharness:
image: aurweb:latest
profiles: ["dev"]
init: true
environment:
- AUR_CONFIG=conf/config.sqlite
- LOG_CONFIG=logging.test.conf
entrypoint: /docker/sharness-entrypoint.sh
command: /docker/scripts/run-sharness.sh
stdin_open: true
tty: true
depends_on:
mariadb_test:
condition: service_healthy
volumes:
- ./data:/data
- ./aurweb:/aurweb/aurweb
- ./migrations:/aurweb/migrations
- ./test:/aurweb/test
- ./templates:/aurweb/templates
pytest-mysql:
image: aurweb:latest
profiles: ["dev"]
init: true
environment:
- AUR_CONFIG=conf/config
- TEST_RECURSION_LIMIT=${TEST_RECURSION_LIMIT}
- PROMETHEUS_MULTIPROC_DIR=/tmp_prometheus
- LOG_CONFIG=logging.test.conf
entrypoint: /docker/test-mysql-entrypoint.sh
command: /docker/scripts/run-pytests.sh clean
stdin_open: true
tty: true
depends_on:
mariadb_test:
condition: service_healthy
tmpfs:
- /tmp
volumes:
- mariadb_test_run:/var/run/mysqld
- ./data:/data
- ./aurweb:/aurweb/aurweb
- ./migrations:/aurweb/migrations
- ./test:/aurweb/test
- ./templates:/aurweb/templates
test:
image: aurweb:latest
profiles: ["dev"]
init: true
environment:
- AUR_CONFIG=conf/config
- TEST_RECURSION_LIMIT=${TEST_RECURSION_LIMIT}
- PROMETHEUS_MULTIPROC_DIR=/tmp_prometheus
- LOG_CONFIG=logging.test.conf
entrypoint: /docker/test-mysql-entrypoint.sh
command: /docker/scripts/run-tests.sh
stdin_open: true
tty: true
depends_on:
mariadb_test:
condition: service_healthy
volumes:
- mariadb_test_run:/var/run/mysqld
- ./data:/data
- ./aurweb:/aurweb/aurweb
- ./migrations:/aurweb/migrations
- ./test:/aurweb/test
- ./templates:/aurweb/templates
grafana:
# TODO: check if we need init: true
image: grafana/grafana:11.1.3
environment:
- GF_AUTH_ANONYMOUS_ENABLED=true
- GF_AUTH_ANONYMOUS_ORG_ROLE=Admin
- GF_AUTH_DISABLE_LOGIN_FORM=true
- GF_LOG_LEVEL=warn
# check if depends ar ecorrect, does stopping or restarting a child exit grafana?
depends_on:
prometheus:
condition: service_healthy
tempo:
condition: service_healthy
ports:
- "127.0.0.1:3000:3000"
volumes:
- ./docker/config/grafana/datasources:/etc/grafana/provisioning/datasources
prometheus:
image: prom/prometheus:latest
command:
- --config.file=/etc/prometheus/prometheus.yml
- --web.enable-remote-write-receiver
- --web.listen-address=prometheus:9090
healthcheck:
# TODO: check if there is a status route
test: "sh /docker/health/prometheus.sh"
interval: 3s
ports:
- "127.0.0.1:9090:9090"
volumes:
- ./docker/config/prometheus.yml:/etc/prometheus/prometheus.yml
- ./docker/health/prometheus.sh:/docker/health/prometheus.sh
tempo:
image: grafana/tempo:2.5.0
command:
- -config.file=/etc/tempo/config.yml
healthcheck:
# TODO: check if there is a status route
test: "sh /docker/health/tempo.sh"
interval: 3s
ports:
- "127.0.0.1:3200:3200"
- "127.0.0.1:4318:4318"
volumes:
- ./docker/config/tempo.yml:/etc/tempo/config.yml
- ./docker/health/tempo.sh:/docker/health/tempo.sh
volumes:
mariadb_test_run: {}
mariadb_run: {} # Share /var/run/mysqld/mysqld.sock
mariadb_data: {} # Share /var/lib/mysql
git_data: {} # Share aurweb/aur.git
smartgit_run: {}
archives: {}
step: {}