Detect Python/Node/PM2 on deploy (install only if missing); uninstall removes /opt/eth_hedge_sim.

Keep .env and DB backup under /root/backups before deleting the install directory.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-07-26 23:08:51 +08:00
parent 2b348854fe
commit 4d331da962
6 changed files with 185 additions and 30 deletions
+16
View File
@@ -8,6 +8,13 @@ set -euo pipefail
ROOT="$(cd "$(dirname "$0")/.." && pwd)"
cd "$ROOT"
# 有 root 时:检测 Python / Node / PM2,缺则装、有则跳过
if [[ -f "$ROOT/deploy/lib/common.sh" ]] && [[ "$(id -u)" -eq 0 ]]; then
# shellcheck source=lib/common.sh
source "$ROOT/deploy/lib/common.sh"
ensure_system_deps
fi
echo "[比特骆驼] pull @ $ROOT"
if [[ -d "$ROOT/.git" ]]; then
git fetch --all --prune
@@ -25,7 +32,13 @@ if [[ ! -f "$ROOT/.env" ]]; then
echo "[比特骆驼] wrote .env — please review AUTH_* secrets"
fi
if ! command -v python3 >/dev/null 2>&1; then
echo "ERROR: python3 not found. 请用 manage.sh 一键部署自动安装。"
exit 1
fi
if [[ ! -d "$ROOT/.venv" ]]; then
echo "[比特骆驼] create venv"
python3 -m venv "$ROOT/.venv"
fi
# shellcheck disable=SC1091
@@ -45,7 +58,10 @@ fi
)
if ! command -v pm2 >/dev/null 2>&1; then
echo "[比特骆驼] install pm2"
npm install -g pm2
else
echo "[比特骆驼] pm2 already present, skip install"
fi
# 仅 reload 本项目进程,禁止 pm2 restart all