-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdocker-compose.https.yml
More file actions
53 lines (50 loc) · 1.74 KB
/
docker-compose.https.yml
File metadata and controls
53 lines (50 loc) · 1.74 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
# ── Warden HTTPS override ─────────────────────────────────────────────────────
# Extends docker-compose.yml with Let's Encrypt TLS termination.
#
# Prerequisites:
# 1. Set WARDEN_DOMAIN and CERTBOT_EMAIL in .env
# 2. Run ./init-letsencrypt.sh once to provision the first certificate
# 3. Then start with: docker compose -f docker-compose.yml -f docker-compose.https.yml up -d
#
# Cert renewal runs automatically inside the certbot container every 12 hours.
# nginx reloads its config every 24 hours to pick up renewed certificates.
services:
ui:
ports:
- "80:80"
- "443:443"
volumes:
# The .template file is processed by envsubst on container start;
# ${WARDEN_DOMAIN} is substituted from the environment variable below.
- ./nginx.https.conf.template:/etc/nginx/templates/default.conf.template:ro
- certbot_conf:/etc/letsencrypt:ro
- certbot_www:/var/www/certbot:ro
environment:
- WARDEN_DOMAIN
# Reload nginx every 24 h to pick up renewed certificates
command: >
/bin/sh -c "
while :; do
sleep 24h &
wait $${!};
nginx -s reload;
done &
nginx -g 'daemon off;'
"
certbot:
image: certbot/certbot:latest
volumes:
- certbot_conf:/etc/letsencrypt
- certbot_www:/var/www/certbot
# Attempt renewal every 12 hours; certbot skips if cert is not due yet
entrypoint: >
/bin/sh -c "
trap exit TERM;
while :; do
certbot renew --webroot --webroot-path=/var/www/certbot --quiet;
sleep 12h & wait $${!};
done
"
volumes:
certbot_conf:
certbot_www: