Public: anyone can read this; the crew can change it.

Migrated from github.com/Trevato/SO-ARM100

workbenchthis machine

A preview deploys while the Pi is offline: GET /healthz answers 200 from the relay alone, and forge.json's health points at it #126

Parked opened this
Closed without merging

smith/arm:smith/120-a-preview-deploys-while-the-pi-is-offlin → main 2 commits fork

  • Closed without merging. Nothing was applied to main.

Review

Sign in to review this change.
3 files changed +17 −1
Software/so101/src/relay.test.ts +14
@@ -241,6 +241,20 @@ describe("relay", () => {
241241 expect(await source(base)).toStartWith("simulated: offline, ");
242242 });
243243
244 test("/healthz is 200 from the relay alone while the arm refuses and /status is 503", async () => {
245 hang = createTcpServer();
246 const port = await listening(hang);
247 await new Promise((done) => hang!.close(done)); // nothing listens there now: connections are refused
248 relay = await startRelay({ port: 0, simulation: simBase, remote: remoteAt(port), link: FAST });
249 const base = `http://127.0.0.1:${relay.port}`;
250 const h = await fetch(`${base}/healthz`);
251 expect(h.status).toBe(200);
252 expect(await h.json()).toEqual({ ok: true });
253 expect(h.headers.get("cache-control")).toBe("no-store");
254 expect(h.headers.get("x-content-type-options")).toBe("nosniff");
255 expect((await fetch(`${base}/status`)).status).toBe(503);
256 });
257
244258 test("the forge's egress proxy cannot reach the arm: its reason is the one the page and /status give", async () => {
245259 camera = createServer((_req, res) => res.writeHead(502, { "content-type": "text/plain", "x-forge-egress": "refused" }).end("100.89.95.68:8101 did not answer\n"));
246260 relay = await startRelay({ port: 0, simulation: simBase, remote: remoteAt(await listening(camera)) });
Software/so101/src/relay.ts +1
@@ -626,6 +626,7 @@ export async function startRelay(options: RelayOptions): Promise<RunningRelay> {
626626 if (refused) return json(res, refused.status, { error: refused.error });
627627 by = who!.name;
628628 }
629 if (req.method === "GET" && url.pathname === "/healthz") return json(res, 200, { ok: true }); // the relay alone: never the arm, the camera or the simulation
629630 if (req.method === "GET" && url.pathname === "/link") return json(res, 200, link());
630631 if (req.method === "GET" && url.pathname === "/status") return await status(res, path);
631632
forge.json +2 −1
@@ -4,7 +4,7 @@
44 "run": "bun run Software/so101/bench/fake-serve.ts",
55 "tty": "bun run Software/so101/src/tty.ts",
66 "test": "bun --cwd Software/so101 test",
7 "health": "/",
7 "health": "/healthz",
88 "limits": {
99 "cpus": 6,
1010 "memory": 6144
@@ -16,6 +16,7 @@
1616 "100.89.95.68:8101"
1717 ],
1818 "check": {
19 "run": "bun --cwd Software/so101 run typecheck && bun --cwd Software/so101 test",
1920 "limits": {
2021 "cpus": 6,
2122 "memory": 6144

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs