Add curl|bash manage.sh with deploy/uninstall/update menu.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Regular → Executable
+10
-5
@@ -1,14 +1,18 @@
|
||||
#!/usr/bin/env bash
|
||||
# 一键更新/部署:仅 git pull,禁止 scp 传代码。
|
||||
# 用法(服务器上): bash /opt/eth_hedge_sim/deploy/pull_and_restart.sh
|
||||
# 用法:
|
||||
# bash /opt/eth_hedge_sim/deploy/pull_and_restart.sh
|
||||
# 或通过 manage.sh 选 1/3
|
||||
set -euo pipefail
|
||||
|
||||
ROOT="$(cd "$(dirname "$0")/.." && pwd)"
|
||||
cd "$ROOT"
|
||||
|
||||
echo "[eth_hedge_sim] pull @ $ROOT"
|
||||
git fetch --all --prune
|
||||
git pull --ff-only
|
||||
if [[ -d "$ROOT/.git" ]]; then
|
||||
git fetch --all --prune
|
||||
git pull --ff-only
|
||||
fi
|
||||
|
||||
if [[ ! -f "$ROOT/.env" ]]; then
|
||||
echo "[eth_hedge_sim] missing .env — copy from example"
|
||||
@@ -17,6 +21,7 @@ if [[ ! -f "$ROOT/.env" ]]; then
|
||||
sed -i 's/^OKX_HTTP_PROXY=.*/OKX_HTTP_PROXY=/' "$ROOT/.env" || true
|
||||
sed -i 's/^API_PORT=.*/API_PORT=5155/' "$ROOT/.env" || true
|
||||
sed -i 's/^ENV_NAME=.*/ENV_NAME=test/' "$ROOT/.env" || true
|
||||
sed -i 's/^EXCHANGE=.*/EXCHANGE=okx/' "$ROOT/.env" || true
|
||||
echo "[eth_hedge_sim] wrote .env — please review AUTH_* secrets"
|
||||
fi
|
||||
|
||||
@@ -29,7 +34,7 @@ pip install -U pip
|
||||
pip install -r "$ROOT/requirements.txt"
|
||||
|
||||
if ! command -v npm >/dev/null 2>&1; then
|
||||
echo "ERROR: npm not found. Install Node.js 18+ first."
|
||||
echo "ERROR: npm not found. Install Node.js 18+ first (manage.sh 一键部署会自动装)."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
@@ -47,4 +52,4 @@ fi
|
||||
pm2 startOrReload "$ROOT/deploy/ecosystem.config.cjs" --update-env
|
||||
pm2 save
|
||||
|
||||
echo "[eth_hedge_sim] done. health: http://127.0.0.1:5155/health public: https://dc.hyf2.cc/health"
|
||||
echo "[eth_hedge_sim] done. health: http://127.0.0.1:5155/health"
|
||||
|
||||
Reference in New Issue
Block a user