- web/bot/watchdog heartbeats in settings (heartbeat:<service>) - watchdog checks bot+web, bot checks watchdog+web; quiet > 5 min → Telegram alert to platform admins via outbox (platform.admins, default allowlist), recovery message, hourly reminder, 15 min cooldown, deterministic dedupe; watchdog sends directly when the bot is down - GET /api/health (DB, version, services; 503 without DB) - peppa status, peppa platform admins - OpenSpec change pep-20-monitoring (archived), e2e monitor.test.ts Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
14 lines
494 B
TypeScript
14 lines
494 B
TypeScript
import { healthReport } from "@peppa/core";
|
|
import { db } from "@/lib/db";
|
|
|
|
export const dynamic = "force-dynamic";
|
|
|
|
/** Public health check (PEP-20): DB, version, service heartbeats. 503 if the DB is down. */
|
|
export async function GET() {
|
|
const r = await healthReport(db, {
|
|
version: process.env.NEXT_PUBLIC_PEPPA_VERSION,
|
|
commit: process.env.NEXT_PUBLIC_PEPPA_COMMIT || null,
|
|
});
|
|
return Response.json(r, { status: r.ok ? 200 : 503, headers: { "Cache-Control": "no-store" } });
|
|
}
|