-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.prod.yml
More file actions
60 lines (54 loc) · 1.7 KB
/
Copy pathdocker-compose.prod.yml
File metadata and controls
60 lines (54 loc) · 1.7 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
# Production overlay — use with:
# docker compose -f docker-compose.yml -f docker-compose.prod.yml up -d
#
# To build from source instead of pulling published images:
# docker compose -f docker-compose.yml -f docker-compose.prod.yml up -d --build
#
# DNS required before first deploy:
# demo.alon.systems → <server public IP>
# api.demo.alon.systems → <server public IP>
services:
# ── Reverse proxy / TLS terminator ─────────────────────────────────────────
caddy:
image: caddy:2-alpine
networks:
sentinel_net:
ipv4_address: 172.28.0.10
ports:
- "80:80"
- "443:443"
volumes:
- ./caddy/Caddyfile:/etc/caddy/Caddyfile:ro
- caddy_data:/data
- caddy_config:/config
depends_on:
- admin
- api
restart: unless-stopped
# ── Remove public ports; enable trusted-proxy mode ─────────────────────────
# api stays on the default network (postgres, worker, init) and sentinel_net
# (caddy). TRUSTED_PROXY_IPS matches Caddy's fixed IP on sentinel_net.
api:
networks:
default: {}
sentinel_net: {}
ports: !reset []
environment:
COOKIE_SECURE: "true"
TRUST_PROXY_HEADERS: "true"
TRUSTED_PROXY_IPS: "172.28.0.10"
# admin only needs sentinel_net: caddy reaches it there, and its nginx
# proxy_pass to api:3000 resolves via sentinel_net as well.
admin:
networks:
sentinel_net: {}
ports: !reset []
networks:
sentinel_net:
ipam:
driver: default
config:
- subnet: "172.28.0.0/24"
volumes:
caddy_data:
caddy_config: