feat(health-checks): enhance health check functionality and add new routes
quality / commitlint (push) Skipped
CD / update-wiki (push) Failing after 8s
quality / changes (push) Successful in 5s
quality / docker-check (push) Skipped
quality / web (push) Successful in 50s
quality / api (push) Successful in 41s
CD / quality (push) Successful in 1m40s
CD / publish (push) Successful in 1m33s

- Introduced origin health check routes and integrated them into the application.
- Updated health check configuration to include success recovery thresholds.
- Expanded error handling with new error codes for health check failures.
- Added new service routes for managing health checks, including creation and listing.
- Improved health check service logic to track consecutive successes and failures.

This commit enhances the health check capabilities, providing better monitoring and management of service health.
This commit is contained in:
Denozordec
2026-08-19 12:26:12 +07:00
parent 9c00b268dc
commit 3f6f402872
64 changed files with 6356 additions and 360 deletions
+9 -3
View File
@@ -23,6 +23,7 @@ Manage Cloudflare zones, DNS records, domain groups, and TLS certificate expiry
| `HEALTH_CHECK_CRON` | Cron для health-check (default `*/30 * * * * *`) |
| `HEALTH_DEGRADED_FAILURES` | Ошибок подряд до `degraded` (default `1`) |
| `HEALTH_DOWN_FAILURES` | Ошибок подряд до `down` (default `2`) |
| `HEALTH_SUCCESS_RECOVERIES` | Успехов подряд для recovery `CHECKING → HEALTHY` (default `2`) |
| `HEALTH_LATENCY_WARN_MS` | Латентность-порог для `degraded` (default `1000`) |
## Load balancing & health checks
@@ -37,11 +38,16 @@ health-check работают на двух уровнях:
`(domain_id, service_id, hostname)`).
- **Привязка сервиса с multi-A** — режим LB и health-check настраиваются в карточке
сервиса для каждой привязки с несколькими IP; для IP задаются вес/приоритет.
- **Ноды** — first-class адреса сервиса (`nodes` + `binding_nodes`); IP-пулы
`service_ips` / `service_binding_ips` пишутся dual-write.
- **Change IP** — `POST /api/v1/service-bindings/:id/change-ip` (preview + PATCH DNS).
- **Change Domain** — перенос привязок между зонами `POST /api/v1/services/:id/change-domain`.
Режимы LB: `round_robin`, `failover`, `weighted`. В Cloudflare free `weighted`
работает как `round_robin` (одна A на IP), веса хранятся в БД для будущих расширений
и отображения в UI. Reconcile DNS запускается cron-задачей `health-check` при смене
статуса IP (`up` / `degraded` / `down` / `unknown`); `down`-IP убирается из A-записей.
работает как `round_robin` (одна A на IP). `unknown` **не** считается healthy и
не попадает в пул, пока нет успешных проб; восстановление — `UNHEALTHY → CHECKING → HEALTHY`
после `HEALTH_SUCCESS_RECOVERIES` (default 2). Reconcile DNS запускается cron-задачей
`health-check`. Cloudflare Health Checks — официальный API зоны, Workers не используются.
## Docker