Repository navigation
Expand file tree
/
Copy pathdocker-compose.prod.yml
More file actions
105 lines (97 loc) · 2.9 KB
/
Copy pathdocker-compose.prod.yml
File metadata and controls
105 lines (97 loc) · 2.9 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
# Production stack.
#
# cp .env.production.example .env.production # then fill in the secrets
# docker compose --env-file .env.production -f docker-compose.prod.yml up -d --build
#
# --env-file feeds the ${...} values below (APP_BIND, APP_PORT); env_file only
# reaches the containers.
#
# The app container serves plain HTTP via FrankenPHP on internal port 8080,
# published on ${APP_BIND:-127.0.0.1}:${APP_PORT:-8080}: only a reverse proxy on
# this host (which terminates TLS) reaches it, so the forwarded client IP that
# TRUSTED_PROXIES accepts cannot be forged from outside.
# Containers that reuse the app image for a long-running command: the app
# container has already migrated, so they only warm their own caches.
x-worker: &worker
image: atrium-prod
env_file: .env.production
environment:
RUN_MIGRATIONS: "false"
RUN_OPTIMIZE: "true"
depends_on:
app:
condition: service_healthy
restart: unless-stopped
services:
app:
build:
context: .
dockerfile: docker/prod/Dockerfile
target: app
image: atrium-prod
env_file: .env.production
ports:
- "${APP_BIND:-127.0.0.1}:${APP_PORT:-8080}:8080"
volumes:
- storage-app:/app/storage/app
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
restart: unless-stopped
# Queue workers (Laravel Horizon). No HTTP here, so the image's web
# healthcheck is replaced by Horizon's own status.
horizon:
<<: *worker
command: php artisan horizon
volumes:
- storage-app:/app/storage/app
healthcheck:
test: ["CMD", "php", "artisan", "horizon:status"]
interval: 30s
timeout: 10s
retries: 3
# Pulse's server card (CPU, memory, disk) needs this long-running check.
pulse:
<<: *worker
command: php artisan pulse:check
healthcheck:
disable: true
# Runs routes/console.php (Horizon snapshots, retention clean-up).
scheduler:
<<: *worker
command: php artisan schedule:work
volumes:
- storage-app:/app/storage/app
healthcheck:
disable: true
postgres:
image: postgres:18-alpine
# POSTGRES_* values live in .env.production and must match DB_* there.
env_file: .env.production
# PostgreSQL 18+ keeps its data in a versioned folder under this path. A
# major upgrade needs a dump and restore (README "Deploying").
volumes:
- postgres-data:/var/lib/postgresql
healthcheck:
test: ["CMD-SHELL", "pg_isready -U $${POSTGRES_USER} -d $${POSTGRES_DB}"]
interval: 5s
timeout: 3s
retries: 10
restart: unless-stopped
redis:
image: redis:8-alpine
command: redis-server --appendonly yes
volumes:
- redis-data:/data
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 5s
timeout: 3s
retries: 10
restart: unless-stopped
volumes:
storage-app:
postgres-data:
redis-data: