update at 2026-10-12 15:14:13

This commit is contained in:
douboer
2026-10-12 15:14:13 +08:00
parent 7a225ff2b1
commit db63516781
12 changed files with 1012 additions and 43 deletions

31
deploy.sh Executable file
View File

@@ -0,0 +1,31 @@
#!/usr/bin/env bash
# deploy.sh —— 构建并部署展示网站到 chenxy.biboer.cn
# 用法:./deploy.sh 构建 + 上传 + nginx 检查
# ./deploy.sh local 仅同步 core 到 web/py(本地预览用)
set -euo pipefail
REMOTE_HOST="web" # ssh config 中的主机别名
SITE_DIR="/var/www/chenxy" # 服务器站点目录
DOMAIN="chenxy.biboer.cn"
echo "[1/4] 同步算法核心 fiber_delay_sim -> web/py/"
rsync -a --delete --exclude '__pycache__' --exclude 'tests' \
--exclude 'experiments' --exclude 'export' --exclude 'cli.py' \
fiber_delay_sim/ web/py/fiber_delay_sim/
if [ "${1:-}" = "local" ]; then
echo "[done] 本地预览:python3 -m http.server -d web 8765 → http://localhost:8765"
exit 0
fi
echo "[2/4] 上传 web/ -> ${REMOTE_HOST}:${SITE_DIR}/"
ssh "$REMOTE_HOST" "mkdir -p ${SITE_DIR}"
rsync -az --delete web/ "$REMOTE_HOST:${SITE_DIR}/"
echo "[3/4] 检查 nginx 站点配置(${DOMAIN})"
ssh "$REMOTE_HOST" "test -f /etc/nginx/conf.d/${DOMAIN}.conf && echo 'conf 存在' || echo 'conf 缺失'"
echo "[4/4] 验证站点"
sleep 1
curl -sI "https://${DOMAIN}" | head -5
echo "[done] 部署完成:https://${DOMAIN}"