feat(health): /api/health/services (grouped+counts) + owner /check

Adds GET /api/health/services returning registry services grouped by
category with merged cached status and per-group healthy counts, and
POST /api/health/check (owner-only) that enqueues a health.check
pg-boss job. Registers the health_check worker in the jobs index.
This commit is contained in:
root
2026-06-02 22:56:50 +10:00
parent af0cac4e6b
commit 60273a6204
5 changed files with 64 additions and 1 deletions

View File

@@ -5,8 +5,9 @@ import * as blob from './workers/blob.js';
import * as embed from './workers/embed.js';
import * as karakeep from './workers/karakeep.js';
import * as speedtest from './workers/speedtest.js';
import * as healthCheck from './workers/health_check.js';
const WORKERS = [echo, url, blob, embed, karakeep, speedtest];
const WORKERS = [echo, url, blob, embed, karakeep, speedtest, healthCheck];
export async function registerWorkers() {
for (const w of WORKERS) {

View File

@@ -0,0 +1,8 @@
import { load } from '../../health/registry.js';
import { checkAll } from '../../health/checker.js';
import * as statusRepo from '../../db/repos/service_status.js';
export const NAME = 'health.check';
export async function handler(_job) {
const results = await checkAll(load());
for (const r of results) await statusRepo.upsert(r);
}