Answer image requests with 503 in maintenance mode (closes #71) #154

Merged
clawbot merged 2 commits from issue-71-maintenance-mode into next 2026-09-29 11:01:31 +02:00
2 Commits
Author SHA1 Message Date
clawbot c9e24be2e2 Answer image requests with 503 in maintenance mode (closes #71)
check / check (push) Successful in 3m52s
maintenance_mode was only reported by the health check; every request
was still served. One middleware in routes.go, applied to /v1/image/
and /v1/e/ only, now answers them with 503, a Retry-After of
MaintenanceRetryAfterSeconds and the JSON error body while it is on.
It calls Server.MaintenanceMode(), which had no caller.

The health check stays 200 and reports maintenance_mode: the image's
Docker HEALTHCHECK requests it, a 503 there would make the container
unhealthy, and upaas marks a deploy failed when its container is
unhealthy. The login and URL generator pages and /metrics keep working.
Documented in README.md and config.example.yml.

Model: opus-5-5
2026-09-29 08:50:16 +00:00
clawbot 9a57cdf454 Test that maintenance mode refuses image requests (closes #71)
Tests ahead of the change: with maintenance_mode on, both image routes
must answer 503 with a Retry-After header and the JSON error body, while
the health check keeps answering 200 and reporting maintenance_mode, and
the login page and /metrics keep answering 200; these fail until the next
commit. With it off, image requests must still reach the image handlers.
The test server now also builds the health check, which these tests
request.

Model: opus-5-5
2026-09-29 08:49:52 +00:00