docs: add deployment playbooks and templates
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
import { serve } from "bun";
|
||||
|
||||
const subsystems = ["discord"] as const;
|
||||
type Subsystem = (typeof subsystems)[number];
|
||||
|
||||
const readiness = Object.fromEntries(subsystems.map((e) => [e, false])) as Record<Subsystem, boolean>;
|
||||
|
||||
serve({
|
||||
port: 7000,
|
||||
routes: {
|
||||
"/healthz": new Response("ok"),
|
||||
"/readyz": () => {
|
||||
const ok = subsystems.every((key) => readiness[key]);
|
||||
return Response.json({ ready: ok, subsystems: readiness }, { status: ok ? 200 : 503 });
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
export function setReady(key: Subsystem, ready = true) {
|
||||
readiness[key] = ready;
|
||||
}
|
||||
Reference in New Issue
Block a user