Files
gsfdc/deploy/issue-cert.sh
T
wuzilongandCursor a8e2e741d1 feat(deploy): 在同一台机器上接入继续教育和 Dify
4 核 8G 同时跑协会站点、PlayEdu 和估价智能体,并让门户专家页底色透出页面背景。

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-11-23 14:12:18 +08:00

30 lines
1.1 KiB
Bash
Executable File
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/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" -d "$AI_DOMAIN" -d "$EDU_DOMAIN" -d "$EDU_H5_DOMAIN" -d "$EDU_ADMIN_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 里的站点地址和 DIFY_PUBLIC_URL 改成 https,dify/docker/.env 里的 CONSOLE_WEB_URL、APP_WEB_URL、GSREA_SSO_CONSOLE_WEB_URL 改成 https,NEXT_PUBLIC_SOCKET_URL 改成 wss,再执行 ./render-nginx.sh && ./up.sh --yes"