Repository navigation
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
119 lines (112 loc) · 3.16 KB
/
Copy pathdocker-compose.yml
File metadata and controls
119 lines (112 loc) · 3.16 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
x-app: &app
image: fallout-rpg:local
build: .
init: true
restart: unless-stopped
environment: &app-environment
DJANGO_SETTINGS_MODULE: rpg.settings
DJANGO_CONFIGURATION: Prod
DJANGO_SECRET_KEY: ${DJANGO_SECRET_KEY:?Set DJANGO_SECRET_KEY in .env}
DJANGO_ALLOWED_HOSTS: ${DJANGO_ALLOWED_HOSTS:?Set DJANGO_ALLOWED_HOSTS in .env}
DJANGO_CSRF_TRUSTED_ORIGINS: ${DJANGO_CSRF_TRUSTED_ORIGINS:?Set HTTPS origins in .env}
DJANGO_CORS_ORIGIN_ALLOW_ALL: 'False'
DJANGO_REDIS_CACHE: redis://redis:6379/1
DJANGO_CELERY_BROKER_URL: redis://redis:6379/0
DJANGO_CELERY_RESULT_BACKEND: redis://redis:6379/2
DATABASE_URL: postgresql://fallout:${POSTGRES_PASSWORD:?Set a URL-safe POSTGRES_PASSWORD in .env}@postgres:5432/fallout
volumes:
- appdata:/var/lib/fallout
security_opt:
- no-new-privileges:true
cap_drop:
- ALL
services:
# One-shot initialization; failure prevents web/worker startup.
setup:
<<: *app
restart: 'no'
environment:
<<: *app-environment
FALLOUT_ADMIN_PASSWORD: ${FALLOUT_ADMIN_PASSWORD:-}
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
command:
- /bin/sh
- -ec
- |
fallout-rpg migrate --noinput
fallout-rpg bootstrap
fallout-rpg collectstatic --noinput
web:
<<: *app
depends_on:
setup:
condition: service_completed_successfully
redis:
condition: service_healthy
postgres:
condition: service_healthy
expose:
- '8000'
healthcheck:
test: ['CMD', 'python', '-c', 'import socket; socket.create_connection(("127.0.0.1", 8000), timeout=3).close()']
interval: 30s
timeout: 5s
retries: 3
start_period: 30s
worker:
<<: *app
depends_on:
setup:
condition: service_completed_successfully
redis:
condition: service_healthy
postgres:
condition: service_healthy
command: ['celery', '-A', 'rpg.celery:app', 'worker', '--loglevel=INFO', '--concurrency=2']
stop_grace_period: 60s
proxy:
image: nginx:1.28-alpine
restart: unless-stopped
depends_on:
web:
condition: service_healthy
ports:
- '127.0.0.1:${HTTP_PORT:-8080}:8080'
volumes:
- ./docker/nginx.conf:/etc/nginx/conf.d/default.conf:ro
- appdata:/var/lib/fallout:ro
security_opt:
- no-new-privileges:true
postgres:
image: postgres:17-bookworm
restart: unless-stopped
environment:
POSTGRES_USER: fallout
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:?Set POSTGRES_PASSWORD in .env}
POSTGRES_DB: fallout
volumes:
- pgdata:/var/lib/postgresql/data
healthcheck:
test: ['CMD-SHELL', 'pg_isready -U fallout -d fallout']
interval: 5s
timeout: 3s
retries: 20
redis:
image: redis:7.4-alpine
restart: unless-stopped
command: ['redis-server', '--appendonly', 'yes', '--maxmemory-policy', 'noeviction']
volumes:
- redisdata:/data
healthcheck:
test: ['CMD', 'redis-cli', 'ping']
interval: 5s
timeout: 3s
retries: 20
volumes:
appdata:
pgdata:
redisdata: