-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
82 lines (78 loc) · 2.46 KB
/
docker-compose.yml
File metadata and controls
82 lines (78 loc) · 2.46 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
services:
# PostgreSQL Database
db:
image: postgres:16-alpine
restart: unless-stopped
environment:
POSTGRES_DB: sefaria_status
POSTGRES_USER: sefaria
POSTGRES_PASSWORD: ${DB_PASSWORD:-changeme}
volumes:
- postgres_data:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U sefaria -d sefaria_status"]
interval: 10s
timeout: 5s
retries: 5
# Django Web Application (Status Page)
web:
build:
context: .
dockerfile: Dockerfile
restart: unless-stopped
expose:
- "8000"
environment:
- DJANGO_SETTINGS_MODULE=config.settings.production
- SECRET_KEY=${SECRET_KEY}
- DEBUG=False
- ALLOWED_HOSTS=${ALLOWED_HOSTS:-status.sefaria.org,localhost}
- DATABASE_URL=postgres://sefaria:${DB_PASSWORD:-changeme}@db:5432/sefaria_status
- SLACK_WEBHOOK_URL=${SLACK_WEBHOOK_URL}
- SLACK_CHANNEL=${SLACK_CHANNEL:-sefaria-down}
- STATUS_PAGE_URL=${STATUS_PAGE_URL:-https://status.sefaria.org}
depends_on:
db:
condition: service_healthy
command: >
sh -c "python manage.py migrate --noinput &&
gunicorn --bind 0.0.0.0:8000 --workers 2 --threads 2 config.wsgi:application"
# Health Check Scheduler (Background Service)
scheduler:
build:
context: .
dockerfile: Dockerfile
restart: unless-stopped
environment:
- DJANGO_SETTINGS_MODULE=config.settings.production
- SECRET_KEY=${SECRET_KEY}
- DEBUG=False
- DATABASE_URL=postgres://sefaria:${DB_PASSWORD:-changeme}@db:5432/sefaria_status
- SLACK_WEBHOOK_URL=${SLACK_WEBHOOK_URL}
- SLACK_CHANNEL=${SLACK_CHANNEL:-sefaria-down}
- STATUS_PAGE_URL=${STATUS_PAGE_URL:-https://status.sefaria.org}
- HEALTH_CHECK_INTERVAL=${HEALTH_CHECK_INTERVAL:-60}
depends_on:
db:
condition: service_healthy
web:
condition: service_started
command: python manage.py run_checks
# Retention Cleanup (Runs daily via cron-like schedule)
cleanup:
build:
context: .
dockerfile: Dockerfile
restart: "no"
environment:
- DJANGO_SETTINGS_MODULE=config.settings.production
- SECRET_KEY=${SECRET_KEY}
- DATABASE_URL=postgres://sefaria:${DB_PASSWORD:-changeme}@db:5432/sefaria_status
depends_on:
db:
condition: service_healthy
command: python manage.py cleanup_old_checks
profiles:
- maintenance
volumes:
postgres_data: