Files
Void-Homelab/lib/db/migrations/015_monitored_services.sql
root ce26895d8e feat: 2.0.0-alpha.11 — DB-backed service registry + LAN auto-discovery
- monitored_services table (mig 015) replaces config/services.json (now a boot seed)
- owner CRUD over /api/health/services; GET is DB-backed; cron+worker read the DB
- discover.lan worker: pure-Node TCP sweep + HTTP-title probe -> disabled 'discovered'
  candidates (never clobbers curated entries); POST /api/health/discover + GET .../discovered
- dashboard: Scan button + Discovered(N) section with one-click promote

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-04 07:55:08 +10:00

21 lines
1.0 KiB
SQL

-- 015_monitored_services.sql
-- DB-backed homelab service registry (replaces the hand-edited config/services.json).
-- Instance-wide (NOT space-scoped — these are infra services, not knowledge resources).
-- Live status stays in service_status, keyed by service_id = monitored_services.id.
CREATE TABLE monitored_services (
id text PRIMARY KEY, -- stable slug, e.g. 'gitea'
name text NOT NULL,
category text NOT NULL DEFAULT 'other',
host text,
url text NOT NULL,
icon text,
check_cfg jsonb NOT NULL DEFAULT '{}'::jsonb, -- {type:'http'|'tcp', path?:'/...'}
source text NOT NULL DEFAULT 'manual'
CHECK (source IN ('manual','discovered')),
enabled boolean NOT NULL DEFAULT true,
created_at timestamptz NOT NULL DEFAULT now(),
updated_at timestamptz NOT NULL DEFAULT now()
);
-- Discovery reconciliation looks up by url to avoid re-adding an existing service.
CREATE INDEX idx_monitored_services_url ON monitored_services (url);