fix: 完善部署回滚健康检查
This commit is contained in:
1 parent
47a24e0d53
commit
d2ca528543
2 files changed
+18
-9
No files matched your search
@@ -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
|
||||
|
||||
@@ -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",
|
||||
);
|
||||
|
||||
Reference in new issue
Block a user