Repository navigation
Expand file tree
/
Copy pathdocker-compose.caddy.yml
More file actions
93 lines (89 loc) · 2.49 KB
/
Copy pathdocker-compose.caddy.yml
File metadata and controls
93 lines (89 loc) · 2.49 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
# Reverse proxy + brute-force ban layer for production. Kept in its own file
# so routine app work on docker-compose.prod.yml never has the proxy/security
# config in view. fail2ban is bundled here (not the app file) since it only
# watches Caddy's own log volume and depends_on: caddy.
#
# Always run together with the other prod files:
# docker compose -f docker-compose.prod.yml -f docker-compose.postgres.yml -f docker-compose.caddy.yml up -d --build
services:
caddy:
image: caddy:2-alpine
container_name: attendance-caddy
restart: unless-stopped
security_opt:
- no-new-privileges:true
cap_drop:
- ALL
cap_add:
- CHOWN
- DAC_OVERRIDE
- NET_BIND_SERVICE
- SETGID
- SETUID
read_only: true
tmpfs:
- /tmp
healthcheck:
test: ["CMD", "wget", "-q", "-O", "/dev/null", "http://localhost:2019/metrics"]
interval: 30s
timeout: 5s
retries: 3
start_period: 10s
deploy:
resources:
limits:
cpus: '1'
memory: 512M
ports:
- "80:80"
- "443:443"
volumes:
- ./Caddyfile.prod:/etc/caddy/Caddyfile:ro
- caddy_data:/data
- caddy_config:/config
- caddy_logs:/var/log/caddy
environment:
- DOMAIN=${DOMAIN:-xenkrypt.in}
depends_on:
- backend
- admin-frontend
- mentor-frontend
- student-frontend
- home-frontend
networks:
- web-net
# So Prometheus can scrape the metrics-only :2019 listener without
# Prometheus having to sit on web-net alongside the frontends.
- monitoring-net
# ponytail: only bans anything on a real Linux Docker host (needs the host
# firewall via DOCKER-USER) — inert but harmless on Docker Desktop dev.
# NET_ADMIN/NET_RAW + host networking are inherent to what fail2ban does
# (manipulating the host's iptables DOCKER-USER chain), so cap_drop: ALL
# isn't an option here — no-new-privileges still applies as defense in depth.
fail2ban:
image: crazymax/fail2ban:latest
container_name: attendance-fail2ban
restart: unless-stopped
network_mode: host
security_opt:
- no-new-privileges:true
cap_add:
- NET_ADMIN
- NET_RAW
environment:
- TZ=UTC
- F2B_LOG_TARGET=STDOUT
volumes:
- ./fail2ban:/data
- caddy_logs:/var/log/caddy:ro
depends_on:
- caddy
volumes:
caddy_data:
caddy_config:
caddy_logs:
networks:
monitoring-net:
external: true
web-net:
driver: bridge