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", );