feat: public /api/health served by the agentbbs process

https://bbs.profullstack.com/ is Caddy's file_server, so a 200 there says
nothing about the BBS. /api/health is now answered by agentbbs itself on
its loopback HTTP listener (Caddy proxies it, like /verify) after a
`select 1` on the SQLite store with a 3s cap: 200 {"status":"ok","db":"ok"}
or 503 {"status":"error","db":"down"}, Cache-Control: no-store.

Adds Store.Ping. For status.profullstack.com.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Anthony Ettinger 2026-10-06 18:46:12 +00:00
parent e95f2a30c3
commit 46736484e0
4 changed files with 65 additions and 0 deletions

View file

@ -3,6 +3,7 @@
package store
import (
"context"
"database/sql"
"errors"
"fmt"
@ -235,6 +236,8 @@ type Store interface {
// SetFilesSetting writes a Files service setting. Idempotent upsert.
SetFilesSetting(key, value string) error
// Ping runs a trivial query, for the public health check.
Ping(ctx context.Context) error
Close() error
}
@ -1175,4 +1178,9 @@ func (s *sqliteStore) SetFilesSetting(key, value string) error {
return err
}
func (s *sqliteStore) Ping(ctx context.Context) error {
var one int
return s.db.QueryRowContext(ctx, "select 1").Scan(&one)
}
func (s *sqliteStore) Close() error { return s.db.Close() }