Refresh HiveGrid Cloud reference snapshot
This commit is contained in:
1 parent
5e99e14772
commit
7f88026f79
5955 files changed
+1177325
-188362
No files matched your search
@@ -11,6 +11,37 @@ const API_SYSTEM_ROUTES_PATH = "apps/api/src/routes/system-routes.ts";
|
||||
const WORKER_HEALTH_PATH = "apps/worker/src/health.ts";
|
||||
const WORKER_MANIFEST_PATH = "apps/worker/package.json";
|
||||
const DOCKERFILE_PATH = "Dockerfile";
|
||||
const WEB_DOCKER_HEALTHCHECK_PATTERN =
|
||||
/HEALTHCHECK[\s\S]*?(?:(?:\bcurl\b|\bnode\s+-e\b)[\s\S]*?127\.0\.0\.1:\$\{PORT\}\/healthz|hostname\s*:\s*["']127\.0\.0\.1["'][\s\S]*?port\s*:\s*process\.env\.PORT[\s\S]*?path\s*:\s*["']\/healthz["'])/;
|
||||
const WEB_RUNTIME_SERVICE_EXPRESSION = /runtimeSurface\s*===\s*["']portal["']\s*\?\s*["']hivegrid-portal["']\s*:\s*["']hivegrid-web["']/;
|
||||
const WEB_RUNTIME_SERVICE_HELPER_EXPRESSION = /getWebServiceName\(runtimeSurface\)/;
|
||||
|
||||
function loadsWebRuntimeIdentity(source) {
|
||||
return (
|
||||
/import\s*\{\s*loadWebConfig\s*\}\s*from\s*["']@hivegrid\/config["']/.test(source) &&
|
||||
/const\s*\{\s*(?=[^}]*\breleaseRevision\b)(?=[^}]*\bruntimeSurface\b)[^}]+\}\s*=\s*loadWebConfig\(\)\.config/.test(source)
|
||||
);
|
||||
}
|
||||
|
||||
function reportsWebRuntimeIdentity(source) {
|
||||
const inlineService = new RegExp(`service\\s*:\\s*${WEB_RUNTIME_SERVICE_EXPRESSION.source}`).test(source);
|
||||
const boundService =
|
||||
new RegExp(`const\\s+service\\s*=\\s*${WEB_RUNTIME_SERVICE_EXPRESSION.source}`).test(source) && /(?:\bservice\s*,|service\s*:\s*service\b)/.test(source);
|
||||
const importsServiceHelper =
|
||||
/import\s*\{\s*getWebServiceName\s*\}\s*from\s*["']\.\.\/\.\.\/build-surface["']/.test(source);
|
||||
const inlineHelperService =
|
||||
importsServiceHelper && new RegExp(`service\\s*:\\s*${WEB_RUNTIME_SERVICE_HELPER_EXPRESSION.source}`).test(source);
|
||||
const boundHelperService =
|
||||
importsServiceHelper &&
|
||||
new RegExp(`const\\s+service\\s*=\\s*${WEB_RUNTIME_SERVICE_HELPER_EXPRESSION.source}`).test(source) &&
|
||||
/(?:\bservice\s*,|service\s*:\s*service\b)/.test(source);
|
||||
|
||||
return (
|
||||
(inlineService || boundService || inlineHelperService || boundHelperService) &&
|
||||
/surface\s*:\s*runtimeSurface\b/.test(source) &&
|
||||
/revision\s*:\s*releaseRevision\b/.test(source)
|
||||
);
|
||||
}
|
||||
|
||||
function manifestPath(relativePath) {
|
||||
return relativePath.split(path.sep).join("/");
|
||||
@@ -124,16 +155,18 @@ export function checkWebHealthcheck(rootDir) {
|
||||
failures.push(`${WEB_HEALTHZ_PATH}: liveness route must not import or check db`);
|
||||
}
|
||||
|
||||
if (/revision\s*:\s*process\.env\.APP_REVISION\s*\|\|\s*["']unknown["']/.test(healthzSource)) {
|
||||
passes.push(`${WEB_HEALTHZ_PATH}: liveness route reports APP_REVISION`);
|
||||
if (loadsWebRuntimeIdentity(healthzSource)) {
|
||||
passes.push(`${WEB_HEALTHZ_PATH}: liveness route loads releaseRevision and runtimeSurface from loadWebConfig().config`);
|
||||
} else {
|
||||
failures.push(`${WEB_HEALTHZ_PATH}: liveness route must report APP_REVISION as revision`);
|
||||
failures.push(`${WEB_HEALTHZ_PATH}: liveness route must load releaseRevision and runtimeSurface from loadWebConfig().config`);
|
||||
}
|
||||
|
||||
if (/status\s*:\s*["']ok["']/.test(healthzSource) && /service\s*:\s*["']web["']/.test(healthzSource)) {
|
||||
passes.push(`${WEB_HEALTHZ_PATH}: liveness route reports ok web service identity`);
|
||||
if (/status\s*:\s*["']ok["']/.test(healthzSource) && reportsWebRuntimeIdentity(healthzSource)) {
|
||||
passes.push(`${WEB_HEALTHZ_PATH}: liveness route reports the dynamic web/admin/portal service, surface, and revision identity`);
|
||||
} else {
|
||||
failures.push(`${WEB_HEALTHZ_PATH}: liveness route must report status ok and service web`);
|
||||
failures.push(
|
||||
`${WEB_HEALTHZ_PATH}: liveness route must report status ok with dynamic hivegrid-web/core, hivegrid-admin/admin, or hivegrid-portal/portal identity and revision`
|
||||
);
|
||||
}
|
||||
} else {
|
||||
failures.push(`${WEB_HEALTHZ_PATH}: missing web /healthz liveness route`);
|
||||
@@ -143,11 +176,28 @@ export function checkWebHealthcheck(rootDir) {
|
||||
const readyzSource = readTextFile(rootDir, WEB_READYZ_PATH);
|
||||
passes.push(`${WEB_READYZ_PATH}: defines database-backed /readyz readiness route`);
|
||||
|
||||
if (/import\s+\{\s*db\s*\}\s+from\s+["']~\/utils\/db\.server["']/.test(readyzSource) && /db\.[\w$]+\.(?:count|findFirst|findMany)|db\.\$queryRaw|db\.\$executeRaw/.test(readyzSource)) {
|
||||
if (
|
||||
/import\s+\{\s*db\s*\}\s+from\s+["']~\/utils\/db\.server["']/.test(readyzSource) &&
|
||||
/db\.[\w$]+\.(?:count|findFirst|findMany)|db\.\$queryRaw|db\.\$executeRaw/.test(readyzSource)
|
||||
) {
|
||||
passes.push(`${WEB_READYZ_PATH}: readiness imports and checks db`);
|
||||
} else {
|
||||
failures.push(`${WEB_READYZ_PATH}: readiness route must import and check db`);
|
||||
}
|
||||
|
||||
if (loadsWebRuntimeIdentity(readyzSource)) {
|
||||
passes.push(`${WEB_READYZ_PATH}: readiness route loads releaseRevision and runtimeSurface from loadWebConfig().config`);
|
||||
} else {
|
||||
failures.push(`${WEB_READYZ_PATH}: readiness route must load releaseRevision and runtimeSurface from loadWebConfig().config`);
|
||||
}
|
||||
|
||||
if (reportsWebRuntimeIdentity(readyzSource)) {
|
||||
passes.push(`${WEB_READYZ_PATH}: readiness route reports the dynamic web/admin/portal service, surface, and revision identity`);
|
||||
} else {
|
||||
failures.push(
|
||||
`${WEB_READYZ_PATH}: readiness route must report dynamic hivegrid-web/core, hivegrid-admin/admin, or hivegrid-portal/portal identity and revision`
|
||||
);
|
||||
}
|
||||
} else {
|
||||
failures.push(`${WEB_READYZ_PATH}: missing web /readyz readiness route`);
|
||||
}
|
||||
@@ -359,8 +409,8 @@ export function checkDockerfileWebApiHealthchecks(rootDir) {
|
||||
const body = getDockerfileTargetBody(dockerfile, target);
|
||||
const expectedPattern =
|
||||
target === "api"
|
||||
? /HEALTHCHECK[\s\S]*?\bcurl\b[\s\S]*?127\.0\.0\.1:\$\{API_PORT:-\$\{PORT\}\}\/healthz/
|
||||
: /HEALTHCHECK[\s\S]*?\bcurl\b[\s\S]*?127\.0\.0\.1:\$\{PORT\}\/healthz/;
|
||||
? /HEALTHCHECK[\s\S]*?(?:\bcurl\b|\bnode\s+-e\b)[\s\S]*?127\.0\.0\.1:\$\{API_PORT:-\$\{PORT\}\}\/healthz/
|
||||
: WEB_DOCKER_HEALTHCHECK_PATTERN;
|
||||
if (!body) {
|
||||
failures.push(`${relativePath}: missing ${target} target`);
|
||||
} else if (expectedPattern.test(body)) {
|
||||
|
||||
Reference in new issue
Block a user