/up healthcheck passes while the database is unreachable #165
Labels
No labels
bug
devops
duplicate
enhancement
good first issue
layout
next major release
next minor release
question
research
testing
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: lvl0/fedi-feed-router#165
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
The container healthcheck reported
healthyfor 37 hours while every authenticated page returned HTTP 500, because the database container was absent (see #164).Dockerfile:70runscurl -f http://localhost:8000/up, andbootstrap/app.php:16configureshealth: '/up'. Laravel's built-in health endpoint dispatchesDiagnosingHealthand returns 200 without touching the database, so a missing DB reads as a healthy app.The result is a silent outage: no alert, no restart, no signal of any kind. The failure was found by loading a page by hand.
Fix
Register a
DiagnosingHealthlistener that verifies DB connectivity (e.g.DB::connection()->getPdo()), so/upfails when the database is unreachable and the healthcheck turns the container unhealthy.Note
A separate
/healthroute exists atroutes/web.php:44returning a static{"status":"ok"}. It is not what the healthcheck uses. Worth deciding whether to converge or remove it.Tests
/upreturns non-200 when the DB connection throws/upreturns 200 when healthySuperseded by #164, which now covers the healthcheck fix along with the exception-logging fallback and the startup/Horizon supervision defects from the same incident. Consolidating to keep the work in one ticket.