Add Fleet control plane and split manage.sh deploy menu.

Strategy nodes gain fleet token APIs; control/ app for local ops; manage.sh offers strategy vs control one-click deploy.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-07-30 10:46:40 +08:00
parent 200702d066
commit da5eb4c18c
44 changed files with 4623 additions and 15 deletions
+3 -3
View File
@@ -1,5 +1,5 @@
#!/usr/bin/env bash
# deploy/lib/install.sh — 一键部署
# deploy/lib/install.sh — 一键部署策略机
set -e
set -u
if [ -n "${BASH_VERSION:-}" ]; then
@@ -13,7 +13,7 @@ source "${LIB_DIR}/common.sh"
run_pipeline() {
local root="$1"
REPO_ROOT="${root}"
step "构建并启动 (pull_and_restart.sh)"
step "构建并启动策略机 (pull_and_restart.sh)"
bash "${REPO_ROOT}/deploy/pull_and_restart.sh"
pm2_save_startup
verify_health || true
@@ -22,7 +22,7 @@ run_pipeline() {
install_fresh() {
require_root
step "一键部署 — 环境检测与依赖"
step "一键部署策略机 — 环境检测与依赖"
ensure_system_deps
step "克隆仓库 → ${INSTALL_ROOT}"
if [[ -d "${INSTALL_ROOT}" ]]; then
+2 -2
View File
@@ -13,10 +13,10 @@ source "${LIB_DIR}/common.sh"
main_update() {
require_root
if ! REPO_ROOT="$(resolve_repo_root)"; then
die "未找到安装目录 ${INSTALL_ROOT},请先执行「1) 一键部署」"
die "未找到安装目录 ${INSTALL_ROOT},请先执行「1) 一键部署策略机"
fi
if ! repo_ready "${REPO_ROOT}"; then
die "安装不完整,请先执行「1) 一键部署」"
die "安装不完整,请先执行「1) 一键部署策略机」"
fi
step "更新 — 环境检测 (缺则装,有则跳过)"
+31 -6
View File
@@ -182,9 +182,11 @@ show_banner() {
}
show_menu() {
echo " 1) 一键部署"
echo " 2) 一键卸载"
echo " 3) 更新"
echo " 1) 一键部署策略机"
echo " 2) 一键部署中控机"
echo " 3) 一键卸载"
echo " 4) 更新策略机"
echo " 5) 更新中控机"
echo " 0) 退出"
echo ""
}
@@ -205,6 +207,23 @@ cm_read() {
printf -v "${__var}" '%s' "${__line}"
}
# 中控:依赖已齐 + 仓库在位后跑 control/deploy/update.sh
deploy_control_node() {
require_root
if ! REPO_ROOT="$(resolve_repo_root)"; then
die "未找到安装目录 ${INSTALL_ROOT},请先执行「1) 一键部署策略机」或完成仓库自举"
fi
if [[ ! -f "${REPO_ROOT}/control/deploy/update.sh" ]]; then
die "缺少 control/deploy/update.sh,请先 git pull 更新仓库"
fi
step "一键部署中控机 — 环境检测 (缺则装,有则跳过)"
ensure_system_deps
step "部署中控 (git pull + 构建 + pm2 eth-hedge-control)"
bash "${REPO_ROOT}/control/deploy/update.sh"
echo ""
log "中控部署完成 → http://<本机IP>:5160 默认账号 admin / admin123"
}
main_menu() {
bootstrap_repo
# shellcheck source=lib/common.sh
@@ -215,23 +234,29 @@ main_menu() {
show_banner
show_menu
local choice=""
cm_read choice "请选择 [0-3]: "
cm_read choice "请选择 [0-5]: "
case "${choice}" in
1)
bash "${LIB_DIR}/install.sh"
;;
2)
bash "${LIB_DIR}/uninstall.sh"
deploy_control_node
;;
3)
bash "${LIB_DIR}/uninstall.sh"
;;
4)
bash "${LIB_DIR}/update.sh"
;;
5)
deploy_control_node
;;
0)
echo "再见."
exit 0
;;
*)
echo "无效选项,请输入 0-3"
echo "无效选项,请输入 0-5"
;;
esac
echo ""