From d2ca5285439faf0974c2be151b1e356d46cf1f74 Mon Sep 17 00:00:00 2001 From: que01 Date: Tue, 13 Oct 2026 15:05:02 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=AE=8C=E5=96=84=E9=83=A8=E7=BD=B2?= =?UTF-8?q?=E5=9B=9E=E6=BB=9A=E5=81=A5=E5=BA=B7=E6=A3=80=E6=9F=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/ci.yml | 8 ++++---- deploy/install-release.mjs | 19 ++++++++++++++----- 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index da0ba63..ec08637 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -20,7 +20,7 @@ jobs: version: 9.15.0 - uses: actions/setup-node@v4 with: - node-version: 22 + node-version: 24 cache: pnpm - run: pnpm install --frozen-lockfile - run: pnpm check @@ -37,7 +37,7 @@ jobs: version: 9.15.0 - uses: actions/setup-node@v4 with: - node-version: 22 + node-version: 24 cache: pnpm - run: pnpm install --frozen-lockfile - run: pnpm build:admin:preview @@ -74,7 +74,7 @@ jobs: version: 9.15.0 - uses: actions/setup-node@v4 with: - node-version: 22 + node-version: 24 cache: pnpm - run: pnpm install --frozen-lockfile - run: pnpm --filter @personal-brand/api test:integration @@ -90,7 +90,7 @@ jobs: version: 9.15.0 - uses: actions/setup-node@v4 with: - node-version: 22 + node-version: 24 cache: pnpm - run: pnpm install --frozen-lockfile - run: pnpm --filter @personal-brand/taro exec playwright install --with-deps chromium diff --git a/deploy/install-release.mjs b/deploy/install-release.mjs index 7b2b500..7a4609c 100644 --- a/deploy/install-release.mjs +++ b/deploy/install-release.mjs @@ -91,6 +91,18 @@ async function installAdminService(release) { run("systemctl", ["--user", "restart", adminServiceName]); } +async function waitForAdminHealth() { + const url = "http://127.0.0.1:" + (process.env.ADMIN_STATIC_PORT ?? "3010") + "/admin/"; + for (let attempt = 0; attempt < 20; attempt++) { + try { + const response = await fetch(url, { signal: AbortSignal.timeout(2000) }); + if (response.ok) return; + } catch {} + await new Promise((resolve) => setTimeout(resolve, 500)); + } + throw new Error("Admin static health check failed"); +} + function verifyTraefikAdmin() { const result = spawnSync( "docker", @@ -314,11 +326,7 @@ try { run("pm2", ["startOrRestart", path.join(release, "deploy/ecosystem.config.cjs"), "--update-env"]); await installAdminService(release); await waitForHealth(); - const staticResponse = await fetch( - "http://127.0.0.1:" + (process.env.ADMIN_STATIC_PORT ?? "3010") + "/admin/", - { signal: AbortSignal.timeout(5000) }, - ); - if (!staticResponse.ok) throw new Error("Admin static health check failed"); + await waitForAdminHealth(); verifyTraefikAdmin(); await writeTraefikRoute(); routeUpdated = true; @@ -342,6 +350,7 @@ try { "--update-env", ]); await waitForHealth(); + await waitForAdminHealth(); console.error( "application and route rollback completed; database migrations were not reversed", );