Phase 8: widgets and polish

- Live job card widget (progress bar, in-widget cancel via widget_query)
  and live invoice widget (QR drawn from a bitmap, countdown, paid state),
  Bot API 10.4 sendWidget, private chats only
- Automatic fallback to the ordinary message when sendWidget fails, with
  a breaker that pauses widgets after repeated failures or on servers
  without the method; TELEGRAM_WIDGETS
- Prometheus metrics on the core (/metrics) and on every worker: queue
  depth and wait, slots, heartbeats, job outcomes, errors per site,
  deliveries, cache, invoices, Lightning, ledger check, widgets
- Example Prometheus config and alert rules, Caddyfile, dashboard notes
- Load test: cmd/loadtest and deploy/loadtest (make loadtest)
- Browser check of the widgets' HTML, including decoding a drawn QR
- docs/DEPLOY.md (production in under an hour) and docs/MONITORING.md

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Michilis
2026-11-18 18:24:36 +00:00
co-authored by Claude Opus 5.5
parent f1f9c6156c
commit 3c153af97f
45 changed files with 3158 additions and 20 deletions
+9 -1
View File
@@ -115,11 +115,18 @@ type Telegram struct {
// description in every language from the catalogs (profile.*). Turn it
// off to keep what was set in @BotFather.
SetProfile bool `toml:"set_profile" env:"TELEGRAM_SET_PROFILE"`
// Widgets shows download status and invoices as live HTML widgets in
// private chats (Bot API 10.4). When sendWidget fails the bot falls
// back to ordinary messages by itself.
Widgets bool `toml:"widgets" env:"TELEGRAM_WIDGETS"`
}
// HTTP holds the settings of the embedded HTTP server.
type HTTP struct {
Listen string `toml:"listen" env:"HTTP_LISTEN"`
// Metrics serves Prometheus metrics at /metrics. They say nothing
// about users, but keep the path off the public internet anyway.
Metrics bool `toml:"metrics" env:"METRICS_ENABLED"`
}
// Database selects the SQL backend.
@@ -299,9 +306,10 @@ func Default() Config {
MaxUploadMB: 50,
UpdateWorkers: 8,
SetProfile: true,
Widgets: true,
},
ProbeMode: "auto",
HTTP: HTTP{Listen: ":8080"},
HTTP: HTTP{Listen: ":8080", Metrics: true},
Database: Database{Driver: "sqlite", DSN: "data/dlbot.db"},
Storage: Storage{Backend: "local", LocalDir: "data/files",
S3: S3{Region: "garage", UseSSL: true, PathStyle: true, Presign: true}},