Files
gitlab-instance-0a899031_sh/d2ypp2/scripts/linux/upgrade_live_console.sh
eric 78e1308063 ss
2026-05-19 06:47:07 +00:00

63 lines
1.7 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.
#!/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
ensure_runtime_dirs_owned_by_live
log "Refreshing Python venv + requirements"
prepare_python_runtime
log "Rebuilding web-console (npm)"
prepare_web_console
log "Refreshing Neko LAN IP watcher unit"
install_neko_ip_watch_service
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
ensure_runtime_dirs_owned_by_live
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 <<EOF
Upgrade done. Open:
http://${HOSTNAME_ALIAS}.local/ (port 80, if live-edge active)
http://${HOSTNAME_ALIAS}.local:${PORT}/ (direct)
Next time after git pull, run: sudo bash upgrade-live.sh
(No need for install-all.sh unless you change OS-level stack or first install.)
EOF