fix(deploy): 修复组件版本解析和安装升级验收流程
Test deployment public URL (Linux) / test-linux (push) Waiting to run
Test start.ps1 (Windows) / test-windows (push) Waiting to run

This commit is contained in:
2026-10-18 00:18:00 +08:00
parent 895d92317e
commit b99eb849b4
30 changed files with 1579 additions and 270 deletions
+46 -6
View File
@@ -544,13 +544,51 @@ configure_http_nginx_proxy() {
start_services() {
echo ""
echo "🚀 启动 EasyAI 服务..."
. ./scripts/init-application-version-env.sh
. ./scripts/deployment-runtime.sh
plan_application_versions .env
apply_application_versions .env
init_deployment_release_source .env
init_deployment_docker_config .env
local compose="docker compose"
if ! docker compose version &>/dev/null; then compose="docker-compose"; fi
check_deployment_storage "$compose"
verify_application_version_images .env "$compose"
verify_deployment_images "$compose"
sudo ./scripts/check-redis-persistence.sh
if docker compose version &>/dev/null; then
sudo docker compose pull && sudo docker compose up -d
else
sudo docker-compose pull && sudo docker-compose up -d
if ! sudo $compose pull; then
echo '❌ 镜像拉取失败,尚未启动服务' >&2
return 1
fi
echo "🎉 EasyAI 应用启动成功"
verify_pulled_release "$compose"
if ! sudo $compose up -d; then
echo '❌ 容器启动失败,部署未完成' >&2
return 1
fi
wait_for_deployment_services "$compose" "${DEPLOY_HEALTH_TIMEOUT_SECONDS:-600}"
echo '✅ 应用服务健康检查通过,继续检查访问入口'
}
# Verify the host proxy too: healthy containers do not prove the public route.
verify_proxy_entry() {
case "$DEPLOY_MODE" in ip|domain) ;; *) return 0 ;; esac
local public_host response
if [ "$DEPLOY_MODE" = ip ]; then public_host="$DEPLOY_IP"; else public_host="$DEPLOY_DOMAIN"; fi
local curl_options=(--fail --silent --show-error --max-time 30)
local origin='http://127.0.0.1'
if [ "$DEPLOY_HTTPS" = true ]; then
curl_options+=(--resolve "${public_host}:443:127.0.0.1")
origin="https://${public_host}"
else
curl_options+=(-H "Host: ${public_host}")
fi
curl "${curl_options[@]}" "${origin}/" -o /dev/null || { echo '❌ 首页访问失败,部署未完成' >&2; return 1; }
response="$(curl "${curl_options[@]}" "${origin}/api/health/update-ready")" || return 1
if ! printf '%s' "$response" | python3 -c 'import json,sys; value=json.load(sys.stdin); sys.exit(0 if value.get("status")=="ok" and value.get("service")=="easyai-server-main" else 1)'; then
echo '❌ 后端公开入口尚未就绪,部署未完成' >&2
return 1
fi
echo '✅ 同机 Nginx 首页和后端入口检查通过'
}
# ==================== 执行 HTTPS 配置 ====================
@@ -563,7 +601,8 @@ run_https_setup() {
export EASYAI_PROXY_CONF="${DEPLOY_DOMAIN}.conf"
bash ./https.sh
else
echo "⚠️ 未找到 https.sh,请手动配置 HTTPS"
echo '❌ 未找到 https.sh,无法完成请求的 HTTPS 部署' >&2
return 1
fi
fi
}
@@ -675,6 +714,7 @@ main() {
configure_http_nginx_proxy
export DEPLOY_DOMAIN
run_https_setup
verify_proxy_entry
fi
echo ""