fix(cutover): separate api health from gateway readiness
This commit is contained in:
@@ -72,11 +72,12 @@ function runFile(file: string, args: readonly string[]): Promise<string> {
|
|||||||
|
|
||||||
function authenticatedReady(port: 8788 | 8790, gatewayToken: string): Promise<boolean> {
|
function authenticatedReady(port: 8788 | 8790, gatewayToken: string): Promise<boolean> {
|
||||||
return new Promise((resolvePromise) => {
|
return new Promise((resolvePromise) => {
|
||||||
|
const path = port === 8790 ? '/healthz' : '/readyz';
|
||||||
const req = request(
|
const req = request(
|
||||||
{
|
{
|
||||||
host: '127.0.0.1',
|
host: '127.0.0.1',
|
||||||
port,
|
port,
|
||||||
path: '/readyz',
|
path,
|
||||||
timeout: 2_000,
|
timeout: 2_000,
|
||||||
headers: { [GATEWAY_AUTH_HEADER]: gatewayToken },
|
headers: { [GATEWAY_AUTH_HEADER]: gatewayToken },
|
||||||
},
|
},
|
||||||
@@ -364,7 +365,7 @@ export async function preflight(
|
|||||||
): Promise<void> {
|
): Promise<void> {
|
||||||
requireGatewayToken(gatewayToken);
|
requireGatewayToken(gatewayToken);
|
||||||
if (!(await system.ready(8790, gatewayToken)))
|
if (!(await system.ready(8790, gatewayToken)))
|
||||||
throw new Error('Authenticated API readiness preflight failed on 127.0.0.1:8790/readyz');
|
throw new Error('Authenticated API health preflight failed on 127.0.0.1:8790/healthz');
|
||||||
const indexPath = join(await realpath(plan.assetDir), 'index.html');
|
const indexPath = join(await realpath(plan.assetDir), 'index.html');
|
||||||
const asset = await lstat(indexPath);
|
const asset = await lstat(indexPath);
|
||||||
if (!asset.isFile()) throw new Error('assetDir/index.html must be a regular file');
|
if (!asset.isFile()) throw new Error('assetDir/index.html must be a regular file');
|
||||||
|
|||||||
Reference in New Issue
Block a user