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
+39
View File
@@ -50,6 +50,9 @@ phase; sections for later phases say so.
| `internal/i18n` | go-i18n wrapper, locale aware formatting. |
| `internal/tg` | Narrow Bot API interface, error helpers, the fake Bot API server. |
| `internal/api` | HTTP server: health check, payment webhook, worker protocol, Mini App API. |
| `internal/widget` | The HTML widgets (status, invoice), their size limits, state encoding, the QR bitmap, the fallback breaker. |
| `internal/metrics` | Prometheus metrics of the core (read at scrape time where possible) and of the worker. |
| `cmd/loadtest` | Simulated users against a core on the fake Bot API. |
| `web/miniapp` | The Mini App front end (Vite, React, TypeScript) and its build, embedded with `go:embed`. |
| `locales` | Translation catalogs, embedded in the binary. |
@@ -404,6 +407,42 @@ The build writes a hash of its sources next to its output and a Go test
recomputes it, which catches a source change committed without a rebuild.
The Docker image rebuilds the front end from source.
## Live widgets
Widgets (Bot API 10.4 `sendWidget`) are an extra layer on top of the
ordinary messages, in `internal/bot/live.go`. Nothing else in the bot
knows about them:
- `setStatus` first offers the status to `liveStatus`. In a private chat,
the first status of a delivery is sent as a widget; if that works, the
card is deleted and the widget becomes the delivery's status message
(recorded in `widget_messages`). Later statuses change only the
widget's state (`editMessageWidgetData`), throttled like edits.
`finalStatus` writes the end state. If `sendWidget` fails, `setStatus`
edits the card as it always did.
- `sendInvoice` first tries `sendInvoiceWidget`. The widget message keeps
the ordinary invoice's caption (with the copyable BOLT11) and buttons;
paid and expired are shown by editing the caption as before, plus the
widget's state.
- The widgets' HTML is the same for every language. All texts, the
direction and the button label travel in the state, already
translated. The invoice QR is packed as a bitmap in the public data and
drawn on a canvas, because a QR library would not fit the 4 KB limit.
- The status widget's Cancel sends a request (`widget_query`). The bot
finds the delivery by the message, checks that the person tapping owns
it, cancels through the same path as `/cancel`, and answers.
- `widget.Breaker` pauses attempts after repeated failures, so a Bot API
server without widgets costs one failed call per pause, not one per
message.
## Metrics
`internal/metrics` registers counters that code increments (job outcomes,
errors per site, deliveries, widgets, updates), a histogram of queue wait
and, at scrape time, gauges read from the database and the services
(queue depth, running jobs, slots, worker heartbeats, cache, invoices,
Lightning, ledger check). Every method is a no-op on a nil `*Metrics`.
## Internationalization
Handlers never contain user-facing text. They call `i18n.Bundle` with a
+97
View File
@@ -770,3 +770,100 @@ Checked against https://core.telegram.org/bots/api (Bot API 10.4) on
chat only. This is the likely cause of the one Postgres failure of
`TestSkipTheQueueWithInvoice` reported in Phase 4, which uses the same
helper. The bot itself was right in both cases.
## Phase 8
### Verified widget facts
Checked on 2026-11-18 against https://core.telegram.org/bots/api (Bot API
10.4, released 2026-11-09), https://core.telegram.org/bots/widgets, and
telego v1.13.0, which has `SendWidget`, `EditMessageWidgetData`,
`AnswerWidgetQuery` and `Update.WidgetQuery`.
- `sendWidget` sends one HTML document: at most 32768 bytes, and at most
4096 bytes after zlib at level 9. It takes `chat_data` and
`public_data` (1024 bytes each), a caption, `allow_queries` and the
usual `reply_markup`.
- In production, widgets work only in the private chat with the bot, and
cannot be forwarded. Groups, inline mode and forwards are test server
only.
- The widget runs in a sandbox (QuickJS), not a browser: no network at
all, no logical CSS properties, no `color-mix()`, no form controls but
`<button>`, `copyText` up to 256 characters, `openLink` URLs up to 256.
The theme arrives as `--tg-theme-*` variables.
- Only the bot changes a widget's state, with `editMessageWidgetData`,
which counts against the bot's sending limits like a message. The
widget learns of it through `chatDataChanged` and `publicDataChanged`.
- A widget asks the bot with `TelegramWidget.request(data)` (1 to 64
bytes, on a tap). The bot gets a `widget_query` update (it must be in
`allowed_updates`) and must answer with `answerWidgetQuery` within 15
seconds. `from` cannot be forged.
- Apps without widget support show the message as unsupported media with
its caption.
### Design
- Both widgets are an extra layer. The ordinary messages are still built
the same way; a widget replaces one only after `sendWidget` succeeded.
Every failure leads back to the ordinary message: a refused
`sendWidget`, a state that does not fit, a widget message that is gone.
- Job card: status, a progress bar (moving when the size is unknown), and
a Cancel button inside the widget. "Skip the queue" stays a normal
button under it, because it leads to a payment. The caption is the
title. Once the widget is up, the card with the format buttons is
deleted, so the chat shows one message per download, as before.
- Invoice: product, amount, QR code, a countdown from the invoice's expiry
(the device's clock), and the paid or expired state. The caption is the
ordinary invoice text, including the BOLT11 string in `<code>`, where a
tap copies it: `copyText` is limited to 256 characters, shorter than an
invoice. The ordinary buttons (open in wallet, check payment, cancel)
stay under it.
- The QR code is drawn by the widget from a bitmap the bot packs into the
public data (one bit per module, low error correction). A 290-character
invoice is 53 modules, 598 bytes of state. If an invoice is ever too
long for that, the QR is left out and the caption still carries the
invoice. A browser test draws a real code with the widget's own script
and decodes it back.
- The widgets' HTML does not depend on the language. Every text comes in
the state, translated by the bot, with the text direction.
- After a failure the next message tries again. Three failures in a row
pause widgets for ten minutes; a 404 or "method not found" (a Bot API
server without widgets) pauses them for an hour.
- Widget messages are recorded in `widget_messages`, so a restart can
still update them. Rows older than a week are deleted.
- Widgets are on by default (`TELEGRAM_WIDGETS=true`). The automatic
fallback makes that safe.
### Metrics and load test
- Prometheus metrics with `prometheus/client_golang` v1.25.0. The core
serves `/metrics` on its HTTP port (`METRICS_ENABLED`, on by default);
each worker on its health port. Values that live in the database or in
the services (queue, heartbeats, cache, invoices, Lightning) are read
at scrape time; events are counted as they happen.
- Errors per site use the host name as a label. The number of series
grows with the number of distinct sites people use, which is bounded in
practice; there is no limit in the code.
- The ledger check (`dlbot_wallets_mismatched`) reads every ledger row,
so it runs at most every ten minutes, and logs an error when it finds
a mismatch.
- The load test drives the real core and workers through the fake Bot
API, with a yt-dlp stand-in that takes a set time per download. It
measures the bot, not the sites or Telegram's upload speed.
- The example Prometheus configuration, alert rules and the Caddyfile were
not run here. Downloading `promtool` to check the rules was refused by
this environment's sandbox.
### What could and could not be run here
- Widget sending, updates, cancel requests, the fallback on a failed or
unknown `sendWidget`, the pause, and groups without widgets: tested end
to end against the fake Bot API.
- The widgets' HTML: rendered in headless Chromium with a stand-in for
`TelegramWidget`. That is a browser, not Telegram's sandbox, so it shows
that the scripts run and draw the right things, not how a phone draws
them.
- Not seen in a real Telegram client, and not sent through the real Bot
API: this environment has no bot token.
- Load test: 90 of 90 and 240 of 240 requests delivered (embedded worker;
three remote workers). Numbers in [MONITORING.md](MONITORING.md).
+176
View File
@@ -0,0 +1,176 @@
# Deploying in under an hour
One path from nothing to a running bot with two download workers,
payments, the Mini App and monitoring. Each step says how long it takes
and how to check it worked. Later steps are optional; the bot works after
step 4.
The other documents go deeper: [OPERATIONS.md](OPERATIONS.md) (choices,
backups, updates), [WORKERS.md](WORKERS.md), [MONITORING.md](MONITORING.md).
## 0. What you need (5 minutes to gather)
- A Linux server with a public IP address: 2 CPU cores, 2 GB of memory and
20 GB of disk are plenty to start. Debian or Ubuntu are assumed below.
- A domain or subdomain pointing at it, for example `bot.example.com`
(an A record). Payments work without one, the Mini App does not.
- A Telegram account, and its numeric user ID (send any message to
@userinfobot, or leave `OWNER_IDS` empty for now and fill it in later).
- For payments: an LNbits wallet and its **invoice/read key** (not the admin
key). LNbits 0.12 or newer.
## 1. Create the bot (5 minutes)
In Telegram, talk to @BotFather:
1. `/newbot`, pick a name and a username. Copy the token.
2. Leave group privacy on. The bot only needs commands in groups, unless
a group wants pasted links fetched (see `/autodetect`).
The bot sets its own description, short description and command menus in
English, Spanish and Dutch when it starts.
## 2. Prepare the server (10 minutes)
```sh
# Docker with the compose plugin
curl -fsSL https://get.docker.com | sh
git clone <this repository> /opt/dlbot && cd /opt/dlbot
cp .env.example .env
```
Edit `.env`. This is enough for a first start:
```sh
BOT_TOKEN=123456789:AA... # from step 1
OWNER_IDS=111111111 # your Telegram user ID
WORKER_A_TOKEN=<openssl rand -hex 24>
WORKER_B_TOKEN=<openssl rand -hex 24>
```
Every other setting has a working default. `.env.example` explains each
of them; the limits and prices are near the top.
## 3. Start it (10 minutes, mostly the first build)
```sh
docker compose up -d --build
docker compose ps
```
All three services (`core`, `worker-a`, `worker-b`) should turn
`healthy` within a minute after the build.
```sh
curl -s localhost:8080/healthz # {"status":"ok"}
```
## 4. Check it in Telegram (5 minutes)
1. Open your bot, press Start. The welcome text appears.
2. Send a link to a video (any public video page). A card with formats
appears; pick one, and the file arrives.
3. Send `/workers`: both workers are listed as active.
4. Send `/stats`: users, the queue, "Books: ledger and balances agree".
If nothing answers: `docker compose logs core | tail -50`. A wrong token
shows as an error at startup.
From here the bot is in service, with the free tier only.
## 5. TLS and the public address (10 minutes)
Needed for instant payment confirmation, the Mini App and workers on other
machines.
```sh
sudo apt install -y caddy
sudo cp deploy/caddy/Caddyfile /etc/caddy/Caddyfile
sudo sed -i 's/bot.example.com/<your domain>/' /etc/caddy/Caddyfile
sudo systemctl reload caddy
curl -s https://<your domain>/healthz # {"status":"ok"}, with a valid certificate
```
Add to `.env`:
```sh
PUBLIC_URL=https://<your domain>
```
## 6. Payments (10 minutes)
Add to `.env`:
```sh
LNBITS_URL=https://<your lnbits>
LNBITS_INVOICE_KEY=<invoice/read key>
LNBITS_WEBHOOK_SECRET=<openssl rand -hex 16>
```
Then `docker compose up -d` (it restarts the core with the new settings).
Check: send `/buy`, pick the day pass, pay the invoice from any Lightning
wallet. Within seconds the invoice turns into "Paid" and `/account` shows
the pass. `/stats` shows "Lightning: reachable". Prices are in `.env`
(`PRICE_*`).
## 7. The Mini App (5 minutes)
Add `MINIAPP_ENABLED=true` to `.env` and `docker compose up -d`. In
@BotFather: `/mybots`, your bot, **Bot Settings**, **Configure Mini App**,
**Enable Mini App**, URL `https://<your domain>/app/`.
Check: send `/app` and press the button. The app opens on the Home tab.
## 8. Monitoring (10 minutes)
Point a Prometheus at the core's `/metrics`. On the same machine, as a
container on the compose network:
```sh
mkdir -p /opt/prometheus
cp deploy/prometheus/prometheus.yml deploy/prometheus/alerts.yml /opt/prometheus/
docker run -d --name prometheus --restart unless-stopped --network dlbot_default \
-v /opt/prometheus:/etc/prometheus -p 127.0.0.1:9090:9090 prom/prometheus
```
Check: `http://localhost:9090/targets` (through an SSH tunnel) shows the
core and both workers up. [MONITORING.md](MONITORING.md) lists the
metrics, dashboard panels and what the alerts mean.
## 9. More workers, elsewhere (10 minutes each, optional)
On the core: `docker compose exec core core worker add home-1` prints a
token. On the other machine, with Docker:
```sh
docker build -f deploy/Dockerfile --target worker -t dlbot-worker .
docker run -d --name dlbot-worker --restart unless-stopped \
-e CORE_URL=https://<your domain> -e WORKER_TOKEN=<token> \
-e WORKER_TAGS=residential dlbot-worker
```
`/workers` lists it within seconds. Sites that refuse datacenter
addresses can be routed to it with `SITE_TAGS`, see
[WORKERS.md](WORKERS.md).
## After the first hour
- **Backups:** the `core-data` volume holds the SQLite database and the
cached files; only the database matters. See [OPERATIONS.md](OPERATIONS.md#backups).
- **Updates:** `git pull && docker compose up -d --build`. Migrations run
at startup. yt-dlp updates itself on every worker daily, or now with
`/ytdlp update`.
- **Texts:** `/privacy`, `/terms` and `/support` are short templates in
`locales/*.toml`. Make them yours before going public.
- **Limits and prices:** `.env`, `FREE_*`, `PAID_*` and `PRICE_*`.
## What was and was not tried
Steps 2 to 4 and 6 to 7 are the same commands the automated tests and the
acceptance scripts run, with processes instead of containers: the Docker
images and the compose file were checked with `docker compose config` but
not built or started on the machine this was written on, which had no
Docker access. The Caddy and Prometheus snippets follow their
documentation and were not run either.
+156
View File
@@ -0,0 +1,156 @@
# Monitoring
The core and every standalone worker serve Prometheus metrics. Logs go to
standard output as JSON. `/healthz` answers for load balancers and
container health checks.
## Endpoints
| Process | Health | Metrics |
| --- | --- | --- |
| core | `GET /healthz` on `HTTP_LISTEN` (200 while the database answers) | `GET /metrics` on `HTTP_LISTEN` |
| worker | `GET /healthz` on `WORKER_HEALTH_LISTEN` (503 when the core is unreachable or the token is rejected) | `GET /metrics` on `WORKER_HEALTH_LISTEN` |
`METRICS_ENABLED=false` removes `/metrics` from the core. The metrics
contain no user IDs, links, titles or tokens, but keep them on the private
network all the same: when the core sits behind a public reverse proxy,
do not forward `/metrics`.
`deploy/prometheus/prometheus.yml` is a scrape configuration to start from
and `deploy/prometheus/alerts.yml` a set of alert rules. Neither was
loaded into a real Prometheus while writing them; check them with
`promtool check config` and `promtool check rules` before relying on them.
## Core metrics
| Metric | Type | Meaning |
| --- | --- | --- |
| `dlbot_queue_jobs{lane}` | gauge | Jobs waiting, `paid` and `free` |
| `dlbot_queue_oldest_wait_seconds` | gauge | How long the oldest waiting job has waited |
| `dlbot_queue_wait_seconds` | histogram | Time from queued to started, per job |
| `dlbot_jobs_running` | gauge | Jobs a worker is working on |
| `dlbot_worker_slots` | gauge | Download slots of all connected workers |
| `dlbot_worker_heartbeat_age_seconds{worker,state}` | gauge | Time since each remote worker last checked in; -1 for never |
| `dlbot_jobs_finished_total{outcome,lane}` | counter | `done`, `failed`, `cancelled`. Cache hits count as done |
| `dlbot_download_errors_total{site,code}` | counter | Failed downloads by host and error class |
| `dlbot_deliveries_total{via}` | counter | Files sent: `upload` (a fresh file) or `cache` (Telegram's copy) |
| `dlbot_cache_hits_total`, `dlbot_cache_misses_total` | counter | Cache lookups since the start |
| `dlbot_cache_bytes_saved_total` | counter | Download volume the cache saved |
| `dlbot_invoices_created_total`, `dlbot_invoices_settled_total` | counter | Lightning invoices since the start |
| `dlbot_lightning_up` | gauge | 1 when the last call to LNbits worked; absent with payments off |
| `dlbot_widgets_total{widget,outcome}` | counter | HTML widgets `sent`, and `fallback` to ordinary messages |
| `dlbot_updates_total{type}` | counter | Telegram updates handled |
| `dlbot_wallets_mismatched` | gauge | Wallets whose balance disagrees with their ledger, checked every 10 minutes. Always 0 unless something is badly wrong |
| `dlbot_scrape_errors{source}` | gauge | A source that could not be read during this scrape |
Plus the standard `go_*` and `process_*` metrics.
Counters restart at zero when the process restarts. Use `rate()` and
`increase()`, which handle that.
## Worker metrics
| Metric | Type | Meaning |
| --- | --- | --- |
| `dlbot_worker_active_jobs` | gauge | Downloads running now |
| `dlbot_worker_capacity` | gauge | `WORKER_CONCURRENCY` |
| `dlbot_worker_core_contact_age_seconds` | gauge | Time since the core last answered |
| `dlbot_worker_token_rejected` | gauge | 1 when the core refused the token |
| `dlbot_worker_jobs_total{outcome}` | counter | `done`, `failed`, `cancelled`, `handed_back`, `lease_lost` |
| `dlbot_worker_ytdlp_info{version}` | gauge | Always 1; the label is the yt-dlp version |
## Dashboard notes
One dashboard covers a deployment. Suggested rows and panels, with the
query for each:
**Service**
- Up: `up{job=~"dlbot-.*"}` (stat, per instance)
- Updates per minute: `sum by (type) (rate(dlbot_updates_total[5m])) * 60`
- Memory: `process_resident_memory_bytes{job="dlbot-core"}`
**Queue**
- Waiting jobs, stacked by lane: `dlbot_queue_jobs`
- Slots busy and total: `dlbot_jobs_running` and `dlbot_worker_slots` on
one graph. Busy at the top for long means more workers would help.
- Wait time p50 and p95:
`histogram_quantile(0.95, sum by (le) (rate(dlbot_queue_wait_seconds_bucket[10m])))`
- Oldest waiting job: `dlbot_queue_oldest_wait_seconds`
**Downloads**
- Finished per minute by outcome:
`sum by (outcome) (rate(dlbot_jobs_finished_total[5m])) * 60`
- Failure share: `sum(rate(dlbot_jobs_finished_total{outcome="failed"}[30m])) / sum(rate(dlbot_jobs_finished_total[30m]))`
- Errors by site, top 10 (table):
`topk(10, sum by (site, code) (increase(dlbot_download_errors_total[1h])))`.
A site whose errors jump is the first sign that yt-dlp needs
`/ytdlp update` or that the site blocks the workers' network (see tags
in [WORKERS.md](WORKERS.md)).
**Cache**
- Hit rate: `rate(dlbot_cache_hits_total[1h]) / (rate(dlbot_cache_hits_total[1h]) + rate(dlbot_cache_misses_total[1h]))`
- Volume saved per day: `increase(dlbot_cache_bytes_saved_total[1d])`
**Workers**
- Heartbeat age per worker: `dlbot_worker_heartbeat_age_seconds`
(anything over 30 s while `active` deserves a look; the lease is 30 s)
- Jobs per worker by outcome: `sum by (instance, outcome) (rate(dlbot_worker_jobs_total[15m]))`.
Many `lease_lost` on one worker means it is overloaded or its network
is unreliable.
- yt-dlp versions: `dlbot_worker_ytdlp_info` (table of the labels). Workers
on different versions is normal for a few hours after a release.
**Payments**
- Lightning reachable: `dlbot_lightning_up`
- Invoices created and settled per hour:
`increase(dlbot_invoices_created_total[1h])`, `increase(dlbot_invoices_settled_total[1h])`.
A settled share that drops to zero while invoices are still created
points at the webhook or LNbits itself.
**Widgets**
- `sum by (widget, outcome) (increase(dlbot_widgets_total[1h]))`. Fallbacks
are harmless; a steady stream of them says the Bot API refuses widgets
(an old local Bot API server, for example).
## Logs
JSON lines on standard output (`LOG_FORMAT=text` for people). The fields
to filter on: `level`, `msg`, `job_id`, `delivery_id`, `purchase_id`,
`chat_id`, `worker_id`. Tokens, the webhook secret and LNbits keys are
removed from every line. URLs are logged without user info, and query
values that look like credentials (tokens, signatures, keys) are blanked.
Worth an alert in your log system:
- `level=ERROR` at all: each one is something the bot could not handle.
- `msg="wallet balances disagree with the ledger"`: never expected. It is
checked when Prometheus scrapes, at most every 10 minutes, and shows in
`dlbot_wallets_mismatched` and in the owner command `/stats`.
- `msg="widget refused, using an ordinary message"` in bulk.
## Load test
`make loadtest` (or `deploy/loadtest/run.sh` with settings) starts the
fake Telegram, a real core and optionally real remote workers, with a
yt-dlp stand-in that takes `LOAD_TIME` seconds per download and never
touches the network. Simulated users send links, press a format and wait
for the file. It prints throughput and the time from link to card and
from link to file, then the core's queue metrics.
```sh
USERS=80 LINKS=3 WORKERS=3 SLOTS=4 deploy/loadtest/run.sh
```
Measured on the development machine (8 cores, SQLite, 2 MB files, 2 s
per download):
| Setup | Requests | Delivered | Files per minute | Link to card p50 | Link to file p95 |
| --- | --- | --- | --- | --- | --- |
| embedded worker, 4 slots, 30 users | 90 | 90 | 106 | 310 ms | 20 s |
| 3 remote workers x 4 slots, 80 users | 240 | 240 | 224 | 330 ms | 25 s |
Four slots at 2 s per file allow at most 120 files a minute, so the first
row runs close to that limit: the time on top of the download is the
queue, which is the point of the test. Use it to size a deployment: run
it with your expected peak of users and the worker count you plan, and
look at the queue wait. It does not measure the sites or Telegram's own
upload speed, which dominate in production.
+20 -2
View File
@@ -1,7 +1,8 @@
# Operations
How to deploy, scale and look after the bot. For workers see
[WORKERS.md](WORKERS.md).
How to deploy, scale and look after the bot. For a first production
setup, follow [DEPLOY.md](DEPLOY.md) from top to bottom. For workers see
[WORKERS.md](WORKERS.md), for metrics and alerts [MONITORING.md](MONITORING.md).
## Deploy with docker compose
@@ -133,6 +134,7 @@ Routes the proxy must pass through:
| `/app/...` | The Mini App and its API, opened by Telegram clients |
| `/worker/v1/...` | Remote workers. Allow long requests (30 s) and large uploads. |
| `/healthz` | Your monitoring |
| `/metrics` | Prometheus, over the private network only. `deploy/caddy/Caddyfile` blocks it |
Without `PUBLIC_URL` the bot still works: long polling for Telegram,
polling for payments, workers on the same network.
@@ -188,6 +190,22 @@ sent again when they change, because Telegram rate limits those calls.
- `I18N_PSEUDO=true` adds a test language for owners, see
[TRANSLATING.md](TRANSLATING.md).
## Live widgets
In private chats the download status and invoices are HTML widgets (Bot
API 10.4): a progress bar with its own Cancel button, and an invoice with
its QR code, a countdown and the paid state. Nothing needs setting up.
- Telegram shows widgets in private chats only, so groups keep ordinary
messages.
- If `sendWidget` fails, that message is sent the ordinary way. If it
fails three times in a row, or the Bot API server does not know the
method (an older local Bot API server), the bot stops trying for ten
minutes or an hour, then tries again. `dlbot_widgets_total` counts both.
- Apps too old for widgets show the caption: the title of the download,
or the invoice text with the copyable invoice and its buttons.
- `TELEGRAM_WIDGETS=false` turns them off.
## Health and logs
- `GET /healthz` on the core answers 200 while the database is reachable.
+1 -1
View File
@@ -92,7 +92,7 @@ eu-1 active 2 3s 2026.10.26 eu,residential
| `WORKER_TEMP_DIR` | `data/worker-tmp` | Scratch space. One per worker process. |
| `WORKER_PROBE_SLOTS` | `2` | Link lookups running next to the downloads. |
| `WORKER_HEARTBEAT` | `10s` | Must be well under the core's `QUEUE_LEASE`. |
| `WORKER_HEALTH_LISTEN` | `:8081` | Health endpoint, or `off`. |
| `WORKER_HEALTH_LISTEN` | `:8081` | `/healthz` and `/metrics`, or `off`. See [MONITORING.md](MONITORING.md). |
| `YTDLP_PATH` | `yt-dlp` | |
| `FFMPEG_PATH` | `ffmpeg` | `ffprobe` is expected next to it. |
| `YTDLP_EXTRA_ARGS` | none | Added to every yt-dlp call, for example `--proxy socks5://127.0.0.1:1080`. |