Track HiveGrid Cloud planning reference
This commit is contained in:
1 parent
b3d5ea6764
commit
e341c5938a
5784 files changed
+1104929
-3
No files matched your search
@@ -0,0 +1,31 @@
|
||||
/**
|
||||
* Public `/api/status` resource route — mirrors the api+worker /status surface
|
||||
* so a single Statuspage / Uptime monitor can poll any one of the three apps.
|
||||
*
|
||||
* Returns the web service status plus a lightweight database readiness check.
|
||||
* High-frequency liveness probes should use `/healthz`; dependency-aware
|
||||
* readiness probes should use `/readyz`. This route is for status dashboards
|
||||
* that need one compact web-process + dependency signal.
|
||||
*/
|
||||
import { db } from "~/utils/db.server";
|
||||
|
||||
export async function loader(): Promise<Response> {
|
||||
let dbStatus: "ok" | "down" = "ok";
|
||||
try {
|
||||
await db.appConfiguration.count();
|
||||
} catch {
|
||||
dbStatus = "down";
|
||||
}
|
||||
const overall = dbStatus === "ok" ? "ok" : "down";
|
||||
return Response.json(
|
||||
{
|
||||
status: overall,
|
||||
service: "web",
|
||||
checks: { db: dbStatus },
|
||||
version: process.env.APP_REVISION?.trim() || "unknown",
|
||||
uptime_seconds: Math.round(process.uptime()),
|
||||
region: process.env.APP_REGION?.trim() || process.env.FLY_REGION?.trim() || "unknown",
|
||||
},
|
||||
{ status: overall === "ok" ? 200 : 503 },
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user