-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
92 lines (88 loc) · 2.76 KB
/
Copy pathdocker-compose.yml
File metadata and controls
92 lines (88 loc) · 2.76 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
services:
db:
image: postgres:17-alpine
restart: unless-stopped
env_file: ${GOGGLES_ENV_FILE:-.env}
volumes:
- postgres-data:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U $$POSTGRES_USER -d $$POSTGRES_DB"]
interval: 10s
timeout: 5s
retries: 5
start_period: 10s
db-test:
image: postgres:17-alpine
profiles: ["test"]
environment:
POSTGRES_DB: goggles_test
POSTGRES_USER: goggles
POSTGRES_PASSWORD: goggles
tmpfs:
- /var/lib/postgresql/data
ports:
- "127.0.0.1:${GOGGLES_TEST_DB_PORT:-55432}:5432"
healthcheck:
test: ["CMD-SHELL", "pg_isready -U $$POSTGRES_USER -d $$POSTGRES_DB"]
interval: 2s
timeout: 5s
retries: 20
start_period: 5s
web:
build: .
init: true
restart: unless-stopped
# Keep a pathological request inside the Goggles cgroup instead of letting
# it exhaust host RAM and swap. Equal memory/swap limits disable additional
# swap allocation for this container.
mem_limit: ${GOGGLES_WEB_MEMORY_LIMIT:-16g}
memswap_limit: ${GOGGLES_WEB_MEMORY_LIMIT:-16g}
mem_swappiness: 0
cpus: ${GOGGLES_WEB_CPUS:-2.0}
pids_limit: ${GOGGLES_WEB_PIDS_LIMIT:-256}
env_file: ${GOGGLES_ENV_FILE:-.env}
depends_on:
db:
condition: service_healthy
volumes:
- static-assets:/app/staticfiles
ports:
- "127.0.0.1:8000:8000"
command: >
sh -c "python manage.py migrate --noinput &&
python manage.py collectstatic --noinput &&
exec gunicorn config.wsgi:application
--bind 0.0.0.0:8000
--workers $${GOGGLES_WEB_WORKERS:-3}
--threads $${GOGGLES_WEB_THREADS:-4}
--timeout $${GOGGLES_WEB_TIMEOUT_SECONDS:-300}
--max-requests $${GOGGLES_WEB_MAX_REQUESTS:-500}
--max-requests-jitter $${GOGGLES_WEB_MAX_REQUESTS_JITTER:-50}"
logging:
driver: json-file
options:
max-size: ${GOGGLES_WEB_LOG_MAX_SIZE:-20m}
max-file: ${GOGGLES_WEB_LOG_MAX_FILES:-5}
healthcheck:
test:
[
"CMD-SHELL",
"python -c \"import os, urllib.request; host = os.environ.get('DJANGO_ALLOWED_HOSTS', '127.0.0.1').split(',')[0].strip(); request = urllib.request.Request('http://127.0.0.1:8000/healthz/', headers={'Host': host}); urllib.request.urlopen(request, timeout=2).read()\"",
]
interval: 30s
timeout: 5s
retries: 3
start_period: 20s
static:
image: nginx:1.29-alpine
restart: unless-stopped
depends_on:
web:
condition: service_healthy
volumes:
- static-assets:/usr/share/nginx/html:ro
ports:
- "127.0.0.1:8001:80"
volumes:
postgres-data:
static-assets: