postgres uptime

This commit is contained in:
Heidi
2026-05-14 21:16:06 +01:00
parent 11e076394b
commit e58adcc716
7 changed files with 466 additions and 59 deletions
+16
View File
@@ -67,6 +67,22 @@ API_RATE_LIMIT_WINDOW_MS=60000
API_RATE_LIMIT_MAX=120
```
## Uptime snapshots
The production server samples uptime every 30 minutes and exposes the history at
`/api/uptime`. Set `DATABASE_URL` or `UPTIME_DATABASE_URL` to persist snapshots
in Postgres:
```sh
DATABASE_URL=postgres://user:password@127.0.0.1:5432/tssbot
UPTIME_SAMPLE_INTERVAL_MS=1800000
UPTIME_HISTORY_LIMIT=336
```
The server creates the `uptime_snapshots` table automatically. Without a
database URL, uptime sampling still runs but only the latest in-memory snapshot
is available.
## GitHub webhook
The webhook process listens on port `3011` at `/github`. Configure GitHub to send