fix: run cli core probes via frontend container

This commit is contained in:
Codex
2026-05-18 03:45:29 +00:00
parent c514b6ca9e
commit 54c32be901
4 changed files with 14 additions and 12 deletions
+6 -6
View File
@@ -24,7 +24,7 @@ async function readJson(url: string, init?: RequestInit): Promise<unknown> {
function coreInternalFetch(path: string, init?: { method?: string; body?: unknown }): unknown {
const code = `
const res = await fetch(${JSON.stringify(`http://127.0.0.1:8080${path}`)}, ${JSON.stringify({
const res = await fetch(${JSON.stringify(`http://backend-core:8080${path}`)}, ${JSON.stringify({
method: init?.method ?? "GET",
headers: init?.body === undefined ? undefined : { "content-type": "application/json" },
body: init?.body === undefined ? undefined : JSON.stringify(init.body),
@@ -34,7 +34,7 @@ function coreInternalFetch(path: string, init?: { method?: string; body?: unknow
try { body = text ? JSON.parse(text) : null; } catch { body = { text }; }
console.log(JSON.stringify({ ok: res.ok, status: res.status, body }));
`;
const result = runCommand(["docker", "exec", "unidesk-backend-core", "bun", "-e", code], repoRoot);
const result = runCommand(["docker", "exec", "unidesk-frontend", "bun", "-e", code], repoRoot);
if (result.exitCode !== 0) {
return { ok: false, exitCode: result.exitCode, stdoutTail: result.stdout.slice(-1200), stderrTail: result.stderr.slice(-1200) };
}
@@ -47,7 +47,7 @@ function coreInternalFetch(path: string, init?: { method?: string; body?: unknow
function coreDockerStatusSummary(): unknown {
const code = `
const res = await fetch('http://127.0.0.1:8080/api/nodes/docker-status');
const res = await fetch('http://backend-core:8080/api/nodes/docker-status');
const text = await res.text();
let body = null;
try { body = text ? JSON.parse(text) : null; } catch { body = { text }; }
@@ -77,7 +77,7 @@ function coreDockerStatusSummary(): unknown {
});
console.log(JSON.stringify({ ok: res.ok, status: res.status, body: { ok: body?.ok === true, dockerStatuses } }));
`;
const result = runCommand(["docker", "exec", "unidesk-backend-core", "bun", "-e", code], repoRoot);
const result = runCommand(["docker", "exec", "unidesk-frontend", "bun", "-e", code], repoRoot);
if (result.exitCode !== 0) {
return { ok: false, exitCode: result.exitCode, stdoutTail: result.stdout.slice(-1200), stderrTail: result.stderr.slice(-1200) };
}
@@ -90,7 +90,7 @@ function coreDockerStatusSummary(): unknown {
function coreSystemStatusSummary(): unknown {
const code = `
const res = await fetch('http://127.0.0.1:8080/api/nodes/system-status?limit=24');
const res = await fetch('http://backend-core:8080/api/nodes/system-status?limit=24');
const text = await res.text();
let body = null;
try { body = text ? JSON.parse(text) : null; } catch { body = { text }; }
@@ -114,7 +114,7 @@ function coreSystemStatusSummary(): unknown {
});
console.log(JSON.stringify({ ok: res.ok, status: res.status, body: { ok: body?.ok === true, systemStatuses } }));
`;
const result = runCommand(["docker", "exec", "unidesk-backend-core", "bun", "-e", code], repoRoot);
const result = runCommand(["docker", "exec", "unidesk-frontend", "bun", "-e", code], repoRoot);
if (result.exitCode !== 0) {
return { ok: false, exitCode: result.exitCode, stdoutTail: result.stdout.slice(-1200), stderrTail: result.stderr.slice(-1200) };
}