Files
pangolin/deploy/edge/pangolin-entrypoint.sh
T
wangjia 73e026a4df
deploy-pangolin / deploy (push) Has been cancelled
edge 容器自带证书续期(certbot in nginx 镜像)
- edge 改为自定义镜像:官方 nginx + certbot + dns-cloudflare 插件
- pangolin-entrypoint.sh:后台每12h certbot renew,续期后本容器内 nginx -s reload
- 不再需要宿主 cron / docker socket / 独立 certbot 服务做日常续期
- /etc/letsencrypt 改 rw 挂载,挂入 cloudflare.ini
- compose 去掉 build:(宿主 docker-compose 不支持 compose build),改脚本 docker build
- deploy.sh/cutover.sh: docker build -t pangolin-edge:local 后再 up

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-05-30 23:10:17 +08:00

22 lines
730 B
Bash

#!/bin/sh
# pangolin-edge 入口:前台跑 nginx,后台跑证书续期(续期后在【本容器内】热重载 nginx)。
# 续期 = certbot renew(DNS-01/Cloudflare),无需 docker socket / 宿主 cron / 跨容器信号。
set -e
# 后台续期循环:每 12h 检查一次;有证书续期则热重载,无则什么都不做。
(
# 启动后先等一会,避免与 nginx 启动抢资源
sleep 60
while true; do
if certbot renew --quiet --deploy-hook "nginx -s reload"; then
:
else
echo "[pangolin] certbot renew 失败,下个周期重试" >&2
fi
sleep 12h
done
) &
# 前台:沿用官方入口脚本(会执行 /docker-entrypoint.d/*)再启动 nginx
exec /docker-entrypoint.sh nginx -g 'daemon off;'