Answer image requests with 503 in maintenance mode (closes #71)
check / check (push) Successful in 3m29s

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, since the
image's Docker HEALTHCHECK and upaas read it; the login and URL
generator pages and /metrics keep working. Documented in README.md and
config.example.yml.

Model: opus-5-5
This commit is contained in:
2026-09-29 04:19:25 +00:00
parent 65cbf3f4f5
commit f70723ac4d
4 changed files with 67 additions and 9 deletions
+5
View File
@@ -12,6 +12,11 @@
# Server settings
port: 8080
debug: false
# While true, the image routes (/v1/image/ and /v1/e/) answer every request
# with 503 and a Retry-After header. The health check keeps answering 200 and
# reports maintenance_mode: the image's Docker HEALTHCHECK and upaas read it,
# and a 503 there would make upaas mark the deploy failed.
maintenance_mode: false
# Data directory for SQLite database and cache files