diff --git a/docs/install-profiles.md b/docs/install-profiles.md index 1a66be3..1ed7d7b 100644 --- a/docs/install-profiles.md +++ b/docs/install-profiles.md @@ -10,6 +10,15 @@ sudo bash install-business.sh sudo bash install-all.sh ``` +### After `git pull` (no full reinstall) + +刷新依赖、重建前端、重启 `live-console` 与 `live-edge`(**不要**为此再跑 `install-all.sh`,除非你要重做整机栈): + +```bash +cd /home/live/douyinyoutube # 或你的克隆路径 +sudo bash upgrade-live.sh +``` + ## What Each Script Does ### `install-hub.sh` diff --git a/scripts/linux/upgrade_live_console.sh b/scripts/linux/upgrade_live_console.sh new file mode 100644 index 0000000..9c022cb --- /dev/null +++ b/scripts/linux/upgrade_live_console.sh @@ -0,0 +1,56 @@ +#!/usr/bin/env bash +# 代码已更新(git pull)后执行:刷新 venv、重建 web-console、重启控制面与 Caddy 边缘。 +# 不需要也不应代替首次装机;不等价于 install-hub / install-business / install-all。 +set -euo pipefail + +SELF_DIR="$(cd "$(dirname "$0")" && pwd)" +INSTALL_TAG="upgrade" +. "$SELF_DIR/lib/common.sh" + +ensure_root "$@" +load_env + +# git pull 若以 root 执行,避免 live 用户无法写 venv / node_modules +chown -R live:live "$ROOT_DIR" || true + +log "Refreshing Python venv + requirements" +prepare_python_runtime + +log "Rebuilding web-console (npm)" +prepare_web_console + +log "Restarting live-console.service" +systemctl daemon-reload +systemctl restart live-console.service + +if [ "${ENABLE_LIVE_EDGE_PROXY:-1}" = "1" ]; then + log "Regenerating Caddyfile and restarting live-edge.service" + install_live_edge_proxy +else + log "ENABLE_LIVE_EDGE_PROXY is not 1 — skipping live-edge (direct :${PORT})" +fi + +ok=0 +for _ in 1 2 3 4 5 6; do + if curl -sf -m 6 "http://127.0.0.1:${PORT}/health" >/dev/null; then + ok=1 + break + fi + sleep 2 +done +if [ "$ok" = 1 ]; then + log "Health check OK on http://127.0.0.1:${PORT}/health" +else + log "WARN: health check failed — see: journalctl -u live-console.service -n 80 --no-pager" + exit 1 +fi + +cat <