diff --git a/start/routes.ts b/start/routes.ts index 7eaa633..e797363 100644 --- a/start/routes.ts +++ b/start/routes.ts @@ -9,12 +9,20 @@ import { middleware } from '#start/kernel' import router from '@adonisjs/core/services/router' +import db from '@adonisjs/lucid/services/db' import { controllers } from '#generated/controllers' const ReleasesController = () => import('#controllers/releases_controller') const NewznabController = () => import('#controllers/newznab_controller') const SeedController = () => import('#controllers/seed_controller') +// Docker health checks (web, seed-api, seed-relay): the database answers, nothing more. They called +// /api/v1/stats every 30 s from five containers, and its query kept a core busy (LOG.md 2026-10-07 (5)). +router.get('/health', async () => { + await db.rawQuery('SELECT 1') + return { ok: true } +}) + // Newznab API for Prowlarr / Sonarr / Radarr ("Generic Newznab", API path /api). router.get('/api', [NewznabController, 'handle']) diff --git a/tests/functional/web_api.spec.ts b/tests/functional/web_api.spec.ts index d4995a7..00602cd 100644 --- a/tests/functional/web_api.spec.ts +++ b/tests/functional/web_api.spec.ts @@ -135,3 +135,11 @@ test.group('Web API', (group) => { assert.isTrue(row.par2Only) }) }) + +test.group('Health check', () => { + test('/health answers when the database does', async ({ client }) => { + const response = await client.get('/health') + response.assertStatus(200) + response.assertBody({ ok: true }) + }) +})