2026年租用 Mac Mini 7×24 决策矩阵
certbot 证书自动续期、launchd 健康探测与夜间静默窗口参数清单
🔒💻 独立开发者在租用 Mac Mini上七乘二十四跑网关、反代与监控时,最怕 HTTPS 在无人值守时悄悄过期——certbot 续期日历漂移、renew-hook误杀进程、探针只看存活不看 notAfter。本文冻结决策矩阵、launchd/crontab 可执行片段与断电恢复 FAQ。内链 首页、launchd 与 pm2 进程守护对比、APFS 磁盘水位 FAQ;CTA 指向 购买页。
⚡痛点拆解
- 挑战漂移:迁移反代后八十端口关闭,HTTP-01 静默失败;DNS-01 令牌只活在交互 shell,续期无人值守即断。
- 重载半径:朴素
renew-hook重启整机服务,夜批中 OpenClaw 网关被连带踢下线。 - 探测盲区:健康探测 只看进程 PID,不看证书剩余天数,监控全绿但浏览器报 ERR_CERT_DATE_INVALID。
HTTP-01 与 DNS-01:certbot 挑战模式怎么选
每个主机名只选一种主模式;泛域名必须 DNS-01;单 IP 反代且公网可达八十/四四三时常用 HTTP-01。
- HTTP-01:nginx 暴露
/.well-known/acme-challenge/,适合租机单公网 IP。 - DNS-01:Cloudflare/Route53 插件;适合
*.gateway.example.dev与上游封 eighty 口。 - 预发:调试 plist 前先
certbot certonly --staging,避免 Let's Encrypt 限流。
# HTTP-01(nginx 插件示例)
sudo certbot certonly --nginx -d gateway.example.dev \
--deploy-hook /usr/local/bin/reload-proxy.sh
# DNS-01(令牌走钥匙串,勿提交仓库)
export CF_DNS_API_TOKEN="$(security find-generic-password -s certbot-cf -w)"
sudo -E certbot certonly --dns-cloudflare \
-d gateway.example.dev -d '*.gateway.example.dev'
七乘二十四 certbot 与 launchd 决策矩阵
| 控制项 | 起步值 | 说明 |
|---|---|---|
| 挑战模式 | HTTP-01 或 DNS-01 | 泛域名强制 DNS;端口矩阵写入跑册 |
| 续期日历 | 本地 03:17、15:17 | 与备份、夜批窗错峰 |
| 健康探测 | 60s curl + 7d 闸口 | 剩余 <14 天且非静默则页 |
| UTC 静默带 | 22:00–06:00+30分 | 续期噪声 Webhook 降级;P1 绕过 |
| 调度器 | launchd LaunchAgent | 实验室可用 crontab 见下节 |
| renew-hook | 仅重载反代 | 禁止重启 OpenClaw 守护 |
launchd 定时续期、renew-hook 与 crontab 备选
租机长跑优先 launchd StartCalendarInterval:日志路径固定、重启后仍加载。配对 renew-hook 先 nginx -t 再 HUP。
<?xml version="1.0" encoding="UTF-8"?>
<plist version="1.0"><dict>
<key>Label</key><string>com.runmini.certbot-renew</string>
<key>ProgramArguments</key><array>
<string>/opt/homebrew/bin/certbot</string>
<string>renew</string><string>--quiet</string>
<string>--deploy-hook</string>
<string>/usr/local/bin/reload-proxy.sh</string>
</array>
<key>StartCalendarInterval</key><array>
<dict><key>Hour</key><integer>3</integer><key>Minute</key><integer>17</integer></dict>
<dict><key>Hour</key><integer>15</integer><key>Minute</key><integer>17</integer></dict>
</array>
<key>StandardOutPath</key><string>/var/log/certbot-renew.log</string>
</dict></plist>
#!/bin/bash
# reload-proxy.sh — 仅反代,不碰 OpenClaw
nginx -t && kill -HUP "$(cat /usr/local/var/run/nginx.pid)"
17 3,15 * * * /opt/homebrew/bin/certbot renew -q \
--deploy-hook /usr/local/bin/reload-proxy.sh \
>> /var/log/certbot-renew.log 2>&1
加载:launchctl bootstrap gui/$(id -u) ~/Library/LaunchAgents/com.runmini.certbot-renew.plist。Node 网关叠部见 launchd 与 pm2 对比稿。
夜间静默窗口、健康探测与告警路由
把 certbot 续期 放进 UTC 静默窗,预期重载噪声不叫醒值班;另起六十秒 健康探测 区分 TLS 与上游故障。
#!/bin/bash
# com.runmini.tls-health — 证书天数 + /healthz
END=$(openssl s_client -connect 127.0.0.1:443 -servername gateway.example.dev 2>/dev/null \
| openssl x509 -noout -enddate | cut -d= -f2)
EPOCH=$(date -j -f "%b %e %T %Y %Z" "$END" "+%s")
DAYS=$(( (EPOCH - $(date +%s)) / 86400 ))
[ "$DAYS" -lt 14 ] && curl -fsS -X POST "$ALERT_URL" -d "{\"days_left\":$DAYS}"
curl -fsS --max-time 5 https://gateway.example.dev/healthz || exit 1
- 22:00–06:00 UTC 加三十分钟缓冲:抑制
tls_renew非 P1。 - 剩余 <7 天立即页;14 天内静默外仅记 warning。
- 标签区分
tls_renew与upstream_down,免 SSH 盲猜。
磁盘与日志水位:续期前的 APFS 闸口
磁盘满会导致 ACME 写失败与 certbot-renew.log 暴涨。对齐 APFS 水位 FAQ 再开无人值守 renew。
- 黄十五红十:黄线暂停新 renew 并清轮转日志;红线停 certbot 立即页。
/var/log/certbot-renew.log:128MB×7 天 newsyslog。- 续期与深窗备份错开,IO 公平见 launchd 节流专文。
落地步骤(六步)
可引用信息
- 续期日历:03:17、15:17 本地;探测周期 60s。
- 静默:22:00–06:00 UTC +30min;证书闸口 14d/7d。
- 磁盘:黄15% 红10%;certbot 日志 128MB×7。
断电恢复 FAQ
问:续期会不会打断 OpenClaw 夜批? 答:renew-hook 只 HUP 反代;网关保持 127.0.0.1 环回,勿 systemctl 式全量重启。
问:launchd 还是 crontab? 答:租机 7×24 托管 选 launchd;crontab 仅短期实验。
问:断电重启后做什么? 答:certbot certificates 核对有效期;APFS 高于黄线;幂等检查点回放后再开告警。详见 APFS FAQ。
把 certbot 续期、launchd 与健康探测写进同一跑册,网关才能在租机上真正七乘二十四可审计。回到 首页 查看节点与套餐。
租用 Mac Mini:七乘二十四 TLS 与 launchd 续期
需要苹果硅长跑节点承载反代与网关?先看 定价,经 免登录购买页 下单;对照 launchd 与 pm2 对比稿;连接见 帮助中心 SSH/VNC。