fix(deploy): 上帝菜单巡检第二轮 — 全新安装卷冲突与验收修正

FRESH 清除 nexus-state 旧锁;PENDING=1 时 entrypoint 不恢复旧 env;验收脚本已安装期望 404。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Nexus Deploy
2026-06-06 21:53:03 +08:00
parent baacdb0252
commit 687e059a86
5 changed files with 104 additions and 5 deletions
+32 -2
View File
@@ -437,7 +437,10 @@ rollback_compose_upgrade() {
warn "健康检查失败,回滚至上一镜像..."
docker tag nexus-prod-nexus:rollback nexus-prod-nexus:latest 2>/dev/null || true
compose_cmd "$root" up -d --no-build --remove-orphans
verify_nexus_1panel_network "$root" || true
if ! verify_nexus_1panel_network "$root"; then
error "回滚后仍未接入 1panel-network"
return 1
fi
return 0
fi
warn "无回滚镜像 nexus-prod-nexus:rollback,跳过自动回滚"
@@ -884,11 +887,34 @@ purge_legacy_bundled_services() {
done
}
reset_nexus_state_volume_for_fresh() {
local vol
vol="$(docker volume ls -q --filter name=nexus-state 2>/dev/null | head -1 || true)"
[[ -n "$vol" ]] || return 0
warn "全新安装:清除 nexus-state 卷内旧 .env / .install_locked"
docker run --rm -v "${vol}:/data" alpine:3.19 \
sh -c 'rm -f /data/.env /data/.install_locked' 2>/dev/null || true
}
restore_install_wizard_html_in_container() {
local cname="$1"
[[ -n "$cname" ]] || return 0
docker exec "$cname" sh -c '
rm -f /app/.install_locked
if [ -f /app/web/app/install.html.bak ] && [ ! -f /app/web/app/install.html ]; then
mv /app/web/app/install.html.bak /app/web/app/install.html
fi
' 2>/dev/null || true
}
compose_up() {
local root="$1"
local root="$1" cname
save_host_profile "$root"
purge_legacy_bundled_services "$root"
sync_1panel_service_hosts "$root"
if [[ "$FRESH_INSTALL" == true ]]; then
reset_nexus_state_volume_for_fresh
fi
if has_1panel_network; then
info "已接入 1panel-networkMySQL/Redis 使用 1Panel 容器名互联)"
fi
@@ -896,6 +922,10 @@ compose_up() {
info "构建并启动(首次约 1020 分钟)..."
compose_cmd "$root" up -d --build --remove-orphans
verify_nexus_1panel_network "$root" || return 1
if [[ "$FRESH_INSTALL" == true ]]; then
cname="$(nexus_container_name)"
restore_install_wizard_html_in_container "$cname"
fi
}
archive_install_wizard_in_container() {