Files
gsfdc/deploy/issue-cert.sh
T
wuzilongandCursor 9c7c80e194 feat: 把估价智能体和部署配置提交到主分支
门户估价对话、会员与智能体账号,以及生产 Docker 部署一直停在工作区,远端主分支还没有这些改动。

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-11-23 09:42:44 +08:00

30 lines
888 B
Bash
Executable File

#!/bin/bash
# 域名已经解析到这台机器、80 端口可从公网访问之后再执行。
set -euo pipefail
cd "$(dirname "$0")"
if [[ ! -f .env ]]; then
echo "缺少 .env"
exit 1
fi
set -a
# shellcheck disable=SC1091
source .env
set +a
if [[ -z "${CERTBOT_EMAIL:-}" ]]; then
echo "先在 .env 里填写 CERTBOT_EMAIL"
exit 1
fi
mkdir -p certs certbot
domains=(-d "$SITE_DOMAIN" -d "$FILES_DOMAIN")
apex="${SITE_DOMAIN#www.}"
if [[ "$apex" != "$SITE_DOMAIN" ]]; then
domains+=(-d "$apex")
fi
docker run --rm \
-v "$PWD/certs:/etc/letsencrypt" \
-v "$PWD/certbot:/var/www/certbot" \
certbot/certbot certonly --webroot -w /var/www/certbot \
--email "$CERTBOT_EMAIL" --agree-tos --no-eff-email \
"${domains[@]}"
echo "证书已写入 certs/live/${SITE_DOMAIN}/ 。接着修改 .env 里的站点地址为 https,再执行 ./render-nginx.sh && docker compose up -d"