Repository navigation
Expand file tree
/
Copy pathdocker-compose.prod.yml
More file actions
282 lines (270 loc) · 8.95 KB
/
Copy pathdocker-compose.prod.yml
File metadata and controls
282 lines (270 loc) · 8.95 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
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
# Pale Server — production Docker Compose stack
#
# Prerequisites:
# 1. ./scripts/generate-secrets.sh
# 2. Edit .env with public hostnames (all required below):
# PALE_PUBLIC_HOSTNAME=pale.example.com
# PALE_SIP_EXTERNAL_ADDR=pale.example.com:5060
# PALE_SIP_TLS_EXTERNAL_ADDR=pale.example.com:5061
# PALE_TURN_SERVER=turn:pale.example.com:3478
# TURN_EXTERNAL_IP=<public IPv4>
# NATS_TOKEN=<from generate-secrets or openssl rand -hex 32>
# 3. Place TLS certs under ./certs/ (fullchain.pem + privkey.pem)
# or set CERTS_DIR to an absolute path with those filenames.
#
# Start:
# docker compose -f docker-compose.prod.yml up -d
#
# Optional profiles:
# --profile proxy Caddy reverse proxy on 80/443
# --profile meetings LiveKit SFU for multi-party A/V
# --profile atp ClamAV malware scanning (set PALE_CLAMAV_HOST=clamav:3310)
# --profile storage MinIO S3-compatible object storage
#
# See docs/deploy/PRODUCTION.md
name: pale-prod
services:
postgres:
image: postgres:16-alpine
container_name: pale-postgres
restart: always
environment:
POSTGRES_DB: pale
POSTGRES_USER: pale
POSTGRES_PASSWORD: "${POSTGRES_PASSWORD:?Set POSTGRES_PASSWORD}"
volumes:
- pale-pgdata:/var/lib/postgresql/data
# Not published on the host — reach only via the pale-internal network.
healthcheck:
test: ["CMD-SHELL", "pg_isready -U pale"]
interval: 10s
timeout: 5s
retries: 5
networks:
- pale-internal
nats:
image: nats:2-alpine
container_name: pale-nats
restart: always
command:
- "-js"
- "-m"
- "8222"
- "--auth"
- "${NATS_TOKEN:?Set NATS_TOKEN (openssl rand -hex 32)}"
# Not published on the host.
healthcheck:
test: ["CMD", "wget", "-qO-", "http://localhost:8222/healthz"]
interval: 10s
timeout: 5s
retries: 5
networks:
- pale-internal
coturn:
image: coturn/coturn:latest
container_name: pale-coturn
restart: always
network_mode: host
volumes:
- ./turnserver.conf:/etc/turnserver.conf:ro
command:
- "-c"
- "/etc/turnserver.conf"
- "--static-auth-secret=${TURN_SECRET:?Set TURN_SECRET}"
- "--realm=${PALE_TURN_REALM:-pale.local}"
- "--external-ip=${TURN_EXTERNAL_IP:?Set TURN_EXTERNAL_IP to the public IPv4 of this host}"
- "--listening-ip=0.0.0.0"
- "--relay-ip=0.0.0.0"
- "--fingerprint"
- "--no-multicast-peers"
- "--no-cli"
- "--no-tlsv1"
- "--no-tlsv1_1"
healthcheck:
test: ["CMD", "turnadmin", "-l"]
interval: 30s
timeout: 5s
retries: 3
pale-server:
build:
context: .
dockerfile: Dockerfile.pale-server
container_name: pale-server
restart: always
depends_on:
postgres:
condition: service_healthy
nats:
condition: service_healthy
ports:
- "8090:8080"
- "5060:5060/tcp"
- "5061:5061/tcp"
environment:
PALE_HTTP_ADDR: "0.0.0.0:8080"
PALE_SIP_ADDR: "0.0.0.0:5060"
PALE_DATA_DIR: "/data"
PALE_DATABASE_URL: "host=postgres user=pale password=${POSTGRES_PASSWORD:?Set POSTGRES_PASSWORD} dbname=pale"
PALE_PG_MAX_CONNECTIONS: "20"
PALE_SERVER_TOKEN: "${PALE_SERVER_TOKEN:?Set PALE_SERVER_TOKEN (min 24 chars)}"
PALE_ADMIN_PASSWORD: "${PALE_ADMIN_PASSWORD:?Set PALE_ADMIN_PASSWORD (min 24 chars)}"
PALE_STORAGE_KEY: "${PALE_STORAGE_KEY:?Set PALE_STORAGE_KEY (min 24 chars)}"
PALE_ADMIN_USERNAME: "${PALE_ADMIN_USERNAME:-admin}"
PALE_SIP_BACKEND: "udp-parser"
PALE_SIP_TCP: "true"
PALE_SIP_UDP: "false"
PALE_SIP_SRTP: "true"
PALE_SIP_TLS: "true"
PALE_SIP_TLS_CERT: "/certs/fullchain.pem"
PALE_SIP_TLS_KEY: "/certs/privkey.pem"
PALE_SIP_TLS_PORT: "5061"
PALE_SIP_EXTERNAL_ADDR: "${PALE_SIP_EXTERNAL_ADDR:?Set PALE_SIP_EXTERNAL_ADDR (host:5060)}"
PALE_SIP_TLS_EXTERNAL_ADDR: "${PALE_SIP_TLS_EXTERNAL_ADDR:?Set PALE_SIP_TLS_EXTERNAL_ADDR (host:5061)}"
# Prefer TLS at Caddy/Ingress (profile proxy). Set these only if pale-server
# should terminate HTTPS itself (then healthcheck must use https).
PALE_HTTP_TLS_CERT: "${PALE_HTTP_TLS_CERT:-}"
PALE_HTTP_TLS_KEY: "${PALE_HTTP_TLS_KEY:-}"
PALE_ICE: "true"
PALE_STUN_SERVERS: "${PALE_STUN_SERVERS:-}"
PALE_STUN_IGNORE_FAILURE: "false"
PALE_TURN_SERVER: "${PALE_TURN_SERVER:?Set PALE_TURN_SERVER (e.g. turn:pale.example.com:3478)}"
PALE_TURN_TRANSPORT: "udp"
PALE_TURN_USERNAME: "pale"
PALE_TURN_PASSWORD: "${TURN_SECRET:?Set TURN_SECRET}"
PALE_TURN_REALM: "${PALE_TURN_REALM:-pale.local}"
PALE_MAX_UPLOAD_BYTES: "${PALE_MAX_UPLOAD_BYTES:-104857600}"
PALE_RETENTION_ENFORCEMENT_INTERVAL_SECS: "${PALE_RETENTION_ENFORCEMENT_INTERVAL_SECS:-86400}"
PALE_RETENTION_ENFORCEMENT_RUN_ON_STARTUP: "${PALE_RETENTION_ENFORCEMENT_RUN_ON_STARTUP:-false}"
PALE_LOG_JSON: "true"
NATS_URL: "nats://:${NATS_TOKEN:?Set NATS_TOKEN}@nats:4222"
PALE_LIVEKIT_URL: "${PALE_LIVEKIT_URL:-}"
PALE_LIVEKIT_API_KEY: "${PALE_LIVEKIT_API_KEY:-}"
PALE_LIVEKIT_API_SECRET: "${PALE_LIVEKIT_API_SECRET:-}"
# When true, conference join fails if LiveKit is missing (no silent signaling-only).
PALE_LIVEKIT_REQUIRED: "${PALE_LIVEKIT_REQUIRED:-false}"
# Malware scanning (enable with --profile atp and PALE_CLAMAV_HOST=clamav:3310)
PALE_CLAMAV_HOST: "${PALE_CLAMAV_HOST:-}"
PALE_ATP_REQUIRED: "${PALE_ATP_REQUIRED:-false}"
# Object storage (enable with --profile storage)
PALE_S3_BUCKET: "${PALE_S3_BUCKET:-}"
PALE_S3_REGION: "${PALE_S3_REGION:-us-east-1}"
PALE_S3_ENDPOINT: "${PALE_S3_ENDPOINT:-}"
PALE_S3_ACCESS_KEY: "${PALE_S3_ACCESS_KEY:-}"
PALE_S3_SECRET_KEY: "${PALE_S3_SECRET_KEY:-}"
RUST_LOG: "${RUST_LOG:-info}"
volumes:
- pale-data:/data
- "${CERTS_DIR:-./certs}:/certs:ro"
healthcheck:
test: ["CMD", "curl", "-sf", "http://localhost:8080/health"]
interval: 30s
timeout: 5s
retries: 3
start_period: 20s
networks:
- pale-internal
- pale-edge
clamav:
image: clamav/clamav:1.4
container_name: pale-clamav
restart: always
profiles: ["atp"]
networks:
- pale-internal
# First boot downloads signatures; allow a long start window.
healthcheck:
test: ["CMD-SHELL", "clamdscan --version || exit 1"]
interval: 60s
timeout: 15s
retries: 10
start_period: 180s
minio:
image: minio/minio:latest
container_name: pale-minio
restart: always
profiles: ["storage"]
command: ["server", "/data", "--console-address", ":9001"]
environment:
MINIO_ROOT_USER: "${PALE_S3_ACCESS_KEY:-paleminio}"
MINIO_ROOT_PASSWORD: "${PALE_S3_SECRET_KEY:?Set PALE_S3_SECRET_KEY for MinIO (min 8 chars)}"
volumes:
- minio-data:/data
networks:
- pale-internal
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:9000/minio/health/live"]
interval: 30s
timeout: 5s
retries: 3
minio-init:
image: minio/mc:latest
container_name: pale-minio-init
profiles: ["storage"]
depends_on:
- minio
entrypoint: >
/bin/sh -c "
sleep 3;
mc alias set pale http://minio:9000 $${MINIO_ROOT_USER} $${MINIO_ROOT_PASSWORD};
mc mb --ignore-existing pale/$${PALE_S3_BUCKET:-pale};
exit 0;
"
environment:
MINIO_ROOT_USER: "${PALE_S3_ACCESS_KEY:-paleminio}"
MINIO_ROOT_PASSWORD: "${PALE_S3_SECRET_KEY:?Set PALE_S3_SECRET_KEY for MinIO}"
PALE_S3_BUCKET: "${PALE_S3_BUCKET:-pale}"
networks:
- pale-internal
caddy:
image: caddy:2-alpine
container_name: pale-caddy
restart: always
profiles: ["proxy"]
ports:
- "80:80"
- "443:443"
environment:
PALE_PUBLIC_HOSTNAME: "${PALE_PUBLIC_HOSTNAME:?Set PALE_PUBLIC_HOSTNAME for Caddy}"
volumes:
- ./deploy/caddy/Caddyfile:/etc/caddy/Caddyfile:ro
- caddy-data:/data
- caddy-config:/config
- "${CERTS_DIR:-./certs}:/certs:ro"
depends_on:
- pale-server
networks:
- pale-edge
livekit:
image: livekit/livekit-server:latest
container_name: pale-livekit
restart: always
profiles: ["meetings"]
command: ["--config", "/etc/livekit.yaml"]
ports:
- "7880:7880"
- "7881:7881"
- "7882:7882/udp"
volumes:
- ./deploy/livekit/livekit.yaml:/etc/livekit.yaml:ro
environment:
# Required when using --profile meetings (set both in .env).
LIVEKIT_KEYS: "${PALE_LIVEKIT_API_KEY:-devkey}:${PALE_LIVEKIT_API_SECRET:-secret-change-me-in-production-32chars}"
networks:
- pale-internal
- pale-edge
networks:
pale-internal:
driver: bridge
pale-edge:
driver: bridge
volumes:
pale-pgdata:
driver: local
pale-data:
driver: local
caddy-data:
driver: local
caddy-config:
driver: local
minio-data:
driver: local