fix idempotency in app.sh, service.sh and nginx reload in cert handler

This commit is contained in:
2026-04-07 15:56:59 -04:00
parent fcc720ee7b
commit d2b9d0bce9
3 changed files with 57 additions and 26 deletions
+2 -1
View File
@@ -23,13 +23,14 @@ server {
}
NGINXCONF
trap 'git -C /opt/hantim restore "docker/nginx/conf.d/$APP.conf" 2>/dev/null || rm -f "/opt/hantim/docker/nginx/conf.d/$APP.conf"' EXIT
trap 'git -C /opt/hantim restore "docker/nginx/conf.d/$APP.conf" 2>/dev/null || rm -f "/opt/hantim/docker/nginx/conf.d/$APP.conf"; docker exec nginx nginx -t && docker exec nginx nginx -s reload' EXIT
docker exec nginx nginx -t && docker exec nginx nginx -s reload
certbot certonly --webroot -w /opt/hantim/docker/nginx/certbot/www \
--non-interactive --agree-tos -m timothykim@fastmail.fm \
--cert-name "$APP" -d "$APP" -d "www.$APP"
git -C /opt/hantim restore "docker/nginx/conf.d/$APP.conf" 2>/dev/null || rm -f "/opt/hantim/docker/nginx/conf.d/$APP.conf"
trap - EXIT
docker exec nginx nginx -t && docker exec nginx nginx -s reload
echo "Certificate issued for $APP"
exit 0
fi