fix(deploy): 升级后镜像验收与 verify 脚本修复
验收检查容器内 round6/7 特性;修复 host.docker.internal 引号;nx verify 与升级后自动验收。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -1217,6 +1217,14 @@ cmd_upgrade() {
|
||||
suggest_ops_cron "$NEXUS_ROOT"
|
||||
fi
|
||||
fi
|
||||
local vcname
|
||||
vcname="$(nexus_container_name)"
|
||||
if [[ -n "$vcname" ]] && nexus_container_has_install_lock "$vcname" \
|
||||
&& [[ -x "$NEXUS_ROOT/deploy/verify-1panel-install-wizard.sh" ]]; then
|
||||
step "升级后验收..."
|
||||
NEXUS_ROOT="$NEXUS_ROOT" bash "$NEXUS_ROOT/deploy/verify-1panel-install-wizard.sh" || \
|
||||
warn "验收脚本报告 FAIL — 见上方输出"
|
||||
fi
|
||||
}
|
||||
|
||||
cmd_check() {
|
||||
|
||||
@@ -270,6 +270,7 @@ menu_main() {
|
||||
[8] 重建镜像并启动(--build nexus)
|
||||
[9] 备份 MySQL
|
||||
[e] 安装巡检/备份 cron(health_monitor + db_backup)
|
||||
[v] 1Panel 安装/运维验收脚本
|
||||
|
||||
── 其它 ──
|
||||
[a] 检查 Git 是否有更新
|
||||
@@ -348,6 +349,11 @@ EOF
|
||||
ops_install_cron
|
||||
pause_enter
|
||||
;;
|
||||
v|V)
|
||||
require_root
|
||||
bash "${NX_DIR}/verify-1panel-install-wizard.sh"
|
||||
pause_enter
|
||||
;;
|
||||
a|A)
|
||||
require_root
|
||||
cmd_check
|
||||
@@ -413,6 +419,10 @@ nx_main() {
|
||||
require_root
|
||||
ops_install_cron
|
||||
;;
|
||||
verify)
|
||||
require_root
|
||||
bash "${NX_DIR}/verify-1panel-install-wizard.sh"
|
||||
;;
|
||||
-h|--help)
|
||||
cat <<EOF
|
||||
用法: nx [子命令]
|
||||
@@ -423,6 +433,7 @@ nx_main() {
|
||||
install-auto 非交互安装(默认 2c8g)
|
||||
health 健康检查
|
||||
cron 安装 health_monitor + db_backup crontab
|
||||
verify 运行 1Panel 验收脚本
|
||||
|
||||
god / ops 已合并进主菜单(兼容别名)
|
||||
|
||||
|
||||
@@ -299,9 +299,9 @@ import json,sys
|
||||
d=json.load(sys.stdin)
|
||||
print((d.get('docker_defaults') or {}).get('db_host',''))
|
||||
" 2>/dev/null || true)"
|
||||
if [[ -n "$db_host" && "$db_host" != host.docker.internal ]]; then
|
||||
if [[ -n "$db_host" && "$db_host" != "host.docker.internal" ]]; then
|
||||
pass "步骤 3 预填 db_host=$db_host"
|
||||
elif [[ "$db_host" == host.docker.internal ]]; then
|
||||
elif [[ "$db_host" == "host.docker.internal" ]]; then
|
||||
fail "步骤 3 仍预填 host.docker.internal"
|
||||
info "修复: nx update --no-cache(需 b25d079+)"
|
||||
fi
|
||||
@@ -315,6 +315,44 @@ print((d.get('docker_defaults') or {}).get('db_host',''))
|
||||
fi
|
||||
}
|
||||
|
||||
check_container_image_features() {
|
||||
[[ -n "${NEXUS_CONTAINER:-}" ]] || return 0
|
||||
local host_sha py_ok html_file html_ok host_root_ok
|
||||
host_sha="$(git -C "$NEXUS_ROOT" rev-parse --short HEAD 2>/dev/null || echo unknown)"
|
||||
pass "宿主机 Git: $host_sha"
|
||||
|
||||
if docker exec "$NEXUS_CONTAINER" grep -q '_host_deploy_root' /app/server/api/install.py 2>/dev/null; then
|
||||
pass "容器 install.py 含 host_deploy_root(round6+)"
|
||||
py_ok=1
|
||||
else
|
||||
warn "容器 install.py 较旧 — 需 nx update 重建镜像"
|
||||
fi
|
||||
|
||||
html_file="/app/web/app/install.html"
|
||||
if docker exec "$NEXUS_CONTAINER" test -f /app/web/app/install.html.bak 2>/dev/null; then
|
||||
html_file="/app/web/app/install.html.bak"
|
||||
fi
|
||||
if docker exec "$NEXUS_CONTAINER" grep -q 'install_ops_cron' "$html_file" 2>/dev/null; then
|
||||
pass "容器 install.html 含 Layer 3 cron 指引(round7+)"
|
||||
html_ok=1
|
||||
else
|
||||
warn "容器 install.html 较旧 — 需 nx update 重建镜像"
|
||||
fi
|
||||
|
||||
host_root_ok="$(docker exec "$NEXUS_CONTAINER" printenv NEXUS_HOST_ROOT 2>/dev/null || true)"
|
||||
if [[ -n "$host_root_ok" ]]; then
|
||||
pass "NEXUS_HOST_ROOT=$host_root_ok"
|
||||
else
|
||||
warn "容器未注入 NEXUS_HOST_ROOT — nx update 重建后可修复"
|
||||
fi
|
||||
|
||||
if [[ -n "${py_ok:-}" && -n "${html_ok:-}" ]]; then
|
||||
info "镜像与宿主机代码特性对齐(重建后验收)"
|
||||
else
|
||||
info "修复: cd $NEXUS_ROOT && sudo nx update"
|
||||
fi
|
||||
}
|
||||
|
||||
check_openresty_hint() {
|
||||
local domain code
|
||||
domain="$(grep -E '^NEXUS_API_BASE_URL=' "$ENV_PROD" 2>/dev/null | sed 's|.*https\?://||;s|/.*||' || echo api.synaglobal.vip)"
|
||||
@@ -376,6 +414,7 @@ main() {
|
||||
check_install_api || true
|
||||
check_ops_cron || true
|
||||
check_mysql_backup || true
|
||||
check_container_image_features || true
|
||||
check_openresty_hint || true
|
||||
print_next_steps
|
||||
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
# nx 上帝菜单巡检第八轮 — 镜像版本验收 + 生产 nx update
|
||||
|
||||
| 项 | 内容 |
|
||||
|----|------|
|
||||
| 日期 | 2026-06-06 |
|
||||
| 动机 | round6/7 改动在宿主机 git 已更新但容器镜像未重建;验收脚本 `host.docker.internal` 比较未加引号;缺升级后自动验收 |
|
||||
|
||||
## 变更摘要
|
||||
|
||||
1. **verify-1panel-install-wizard.sh**:修复 `host.docker.internal` bash 引号 bug;新增 `check_container_image_features`(install.py / install.html / NEXUS_HOST_ROOT)。
|
||||
2. **nexus-1panel.sh upgrade**:已锁定环境升级成功后自动跑验收脚本。
|
||||
3. **nx**:菜单 `[v]` / 子命令 `nx verify` 调用验收脚本。
|
||||
|
||||
## 涉及文件
|
||||
|
||||
- `deploy/verify-1panel-install-wizard.sh`
|
||||
- `deploy/nexus-1panel.sh`
|
||||
- `deploy/nx`
|
||||
|
||||
## 迁移 / 重启
|
||||
|
||||
- 需 `sudo nx update` 重建镜像以使 round6/7 容器内代码生效。
|
||||
|
||||
## 验证
|
||||
|
||||
```bash
|
||||
bash -n deploy/verify-1panel-install-wizard.sh
|
||||
sudo nx verify
|
||||
sudo nx update --no-backup # 重建后 check_container_image_features 应全 PASS
|
||||
```
|
||||
Reference in New Issue
Block a user