feat(health): деплоить probe-Worker из CFDM и опрашивать цели с edge
quality / changes (push) Successful in 9s
quality / commitlint (push) Skipped
quality / docker-check (push) Skipped
CD / update-wiki (push) Successful in 6s
quality / web (push) Successful in 1m4s
quality / api (push) Successful in 54s
CD / quality (push) Successful in 2m17s
CD / publish (push) Successful in 2m21s

Worker сам ходит на origin по Cron Trigger; CFDM кладёт цели в KV и забирает результаты без POST /probe.

Co-authored-by: Cursor <[email protected]>
This commit is contained in:
Denozordec
2026-08-19 17:22:07 +07:00
co-authored by Cursor
parent 2c92e78b24
commit 4c4908558b
38 changed files with 1941 additions and 555 deletions
+8 -28
View File
@@ -1,37 +1,17 @@
# CFDM health-probe Worker
Stateless edge probe for CFDM. **Not** Cloudflare Health Checks API (unavailable on Free).
Cron stays in CFDM — this Worker has no Cron Trigger.
Edge probe for CFDM. **Not** Cloudflare Health Checks API (unavailable on Free).
## Deploy
Production: CFDM creates this Worker via the Cloudflare API (KV mailbox + Cron Trigger).
You do not need `wrangler deploy`. Token needs **Account**: Workers Scripts Write and Workers KV Storage Write.
Local debug:
```powershell
cd workers/health-probe
npx wrangler login
npx wrangler secret put PROBE_TOKEN
npx wrangler deploy
npx wrangler dev
```
Paste the Worker URL (`https://cfdm-health-probe.<account>.workers.dev`) and the same token into **Настройки → Health-check**.
Worker reads KV `targets`, probes TCP (`cloudflare:sockets` + `opened`) or HTTP (`fetch` to IP + `Host`), writes KV `results`. Batch ≤ 48, concurrency 5.
Free Workers ≈ 100k requests/day. CFDM cron every 2 minutes × number of IPs must fit.
## API
`POST /probe` + `Authorization: Bearer <PROBE_TOKEN>`
```json
{
"type": "tcp",
"ip": "1.2.3.4",
"hostname": "app.example.com",
"port": 443,
"path": "/",
"expected_status": 200,
"timeout_ms": 3000,
"verify_tls": true,
"method": "GET"
}
```
Response: `{ "ok": true, "latencyMs": 42, "error": null, "colo": "AMS" }`.
`GET /` — liveness.