fix: exclude infrastructure probes from API throttling
All checks were successful
CI/CD Pipeline / Quality Gate (pull_request) Successful in 49s
CI/CD Pipeline / Build and Push Images (pull_request) Successful in 1s
CI/CD Pipeline / Internal Notify (pull_request) Successful in 1s
CI/CD Pipeline / Deploy Dev via Compose (pull_request) Successful in 1s
CI/CD Pipeline / Quality Gate (push) Successful in 49s
CI/CD Pipeline / Build and Push Images (push) Successful in 0s
CI/CD Pipeline / Internal Notify (push) Successful in 1s
CI/CD Pipeline / Deploy Dev via Compose (push) Successful in 1s

This commit was merged in pull request #41.
This commit is contained in:
Aleksandr Meshchryakov
2026-09-16 09:39:56 +02:00
parent 66fcacc45c
commit fe1e5f79bd
7 changed files with 169 additions and 210 deletions

36
docs/health-probes.md Normal file
View File

@@ -0,0 +1,36 @@
# Health probes
`GET /health/live/` and `GET /health/ready/` are unauthenticated infrastructure
probes and do not consume API rate limits. Liveness reports the running process;
readiness checks the database and still returns HTTP 503 when it is unavailable.
The comprehensive `/health/` endpoint and ordinary API endpoints retain their
configured throttling.
## Internal-main health hotfix
The internal-main Docker probe runs every 10 seconds. Applying the shared
anonymous limit of 100 requests/hour to it causes false HTTP 429 failures.
Customer deployment workflows have been removed. Do not rerun historical
customer workflows: they execute the configuration from their original commit.
For this views-only fix, `docker/Dockerfile.health-hotfix` can build a web image
from the exact deployed `repository@sha256:digest`, preserving its dependencies,
startup command and all other application files. Before using this recipe,
verify that the base image matches the source baseline and that the application
diff contains only the probe changes in `src/apps/core/views.py`. Label the new
image with the committed source revision and publish an immutable digest.
The normal internal-main backend release requires `--refresh-data` and replaces
the database/media clone. It must not be used for this health-only fix. Instead,
under the existing release lock, verify that the candidate has no pending
migrations, keep a private copy of the current manifest, and change only
`MOSTOVIK_BACKEND_WEB_IMAGE`. Recreate only `mostovik-web` with `--no-deps` and the
already-pulled image. Accept the manifest atomically after HTTP probes and Docker
health succeed; restore the previous web image and manifest if they fail.
Preserve database/media selections, Redis state and every other service image.
Acceptance includes repeated probes beyond the anonymous request allowance,
database-failure regression coverage, and a control proving that ordinary
endpoints are still throttled. Do not disable throttling globally or clear Redis
to make the healthcheck pass.