mirror of
https://github.com/profullstack/agentbbs.git
synced 2026-11-29 15:31:53 +00:00
feat: public /api/health served by the agentbbs process (#143)
Some checks failed
CI / build (push) Has been cancelled
deploy / deploy (push) Has been cancelled
test / test (push) Has been cancelled
Some checks failed
CI / build (push) Has been cancelled
deploy / deploy (push) Has been cancelled
test / test (push) Has been cancelled
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:
parent
e95f2a30c3
commit
6cdc352d97
4 changed files with 65 additions and 0 deletions
|
|
@ -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() }
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue