fix: use rust healthcheck for code queue mgr
This commit is contained in:
@@ -189,6 +189,32 @@ function unifiedLogRotationItem(): CheckItem {
|
||||
};
|
||||
}
|
||||
|
||||
function codeQueueMgrHealthcheckItem(): CheckItem {
|
||||
const composeText = readFileSync(rootPath("docker-compose.yml"), "utf8");
|
||||
const serviceStart = composeText.indexOf("\n code-queue-mgr:");
|
||||
const nextService = serviceStart >= 0 ? composeText.indexOf("\n todo-note:", serviceStart + 1) : -1;
|
||||
const serviceBlock = serviceStart >= 0
|
||||
? composeText.slice(serviceStart, nextService >= 0 ? nextService : undefined)
|
||||
: "";
|
||||
const dockerfileText = readFileSync(rootPath("src/components/microservices/code-queue-mgr/Dockerfile"), "utf8");
|
||||
const sourceText = readFileSync(rootPath("src/components/microservices/code-queue-mgr/src-rs/main.rs"), "utf8");
|
||||
const healthcheckUsesRustProbe = serviceBlock.includes("code-queue-mgr") && serviceBlock.includes("--healthcheck");
|
||||
const healthcheckReferencesBun = /\bhealthcheck:[\s\S]*?\bbun\b/u.test(serviceBlock);
|
||||
const binaryCopiedIntoRuntime = dockerfileText.includes("/usr/local/bin/code-queue-mgr");
|
||||
const binaryImplementsProbe = sourceText.includes("--healthcheck") && sourceText.includes("run_healthcheck");
|
||||
return {
|
||||
name: "docker-compose:code-queue-mgr-rust-healthcheck",
|
||||
ok: healthcheckUsesRustProbe && !healthcheckReferencesBun && binaryCopiedIntoRuntime && binaryImplementsProbe,
|
||||
detail: {
|
||||
healthcheckUsesRustProbe,
|
||||
healthcheckReferencesBun,
|
||||
binaryCopiedIntoRuntime,
|
||||
binaryImplementsProbe,
|
||||
expected: "code-queue-mgr Rust runtime healthcheck must use code-queue-mgr --healthcheck and must not depend on bun/curl/wget being present.",
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
function rustCheckItem(): CheckItem {
|
||||
if (process.env.UNIDESK_D601_RUST_CHECK !== "1") {
|
||||
return {
|
||||
@@ -216,6 +242,7 @@ export function runChecks(config: UniDeskConfig, options: CheckOptions = default
|
||||
{ name: "config:validated", ok: true, detail: { project: config.project.name, runtime: config.runtime } },
|
||||
commandItem("bun:version", ["bun", "--version"]),
|
||||
syntaxItem(),
|
||||
codeQueueMgrHealthcheckItem(),
|
||||
];
|
||||
if (options.files) {
|
||||
items.push(
|
||||
|
||||
Reference in New Issue
Block a user