fix(boot): answer health probes during slow boots (VACUUM / integrity check)#571
Merged
Conversation
A boot running the one-time VACUUM (25 min measured on a 2.3 GB DB on SD) or a full integrity check left :8080 unbound the whole time; the Docker healthcheck failed and ftw-updater judged the v0.130.3 deploy failed and auto-rolled back mid-VACUUM. The port now binds before state.Open with a boot-phase handler (200 on /api/health with status=starting, 503 elsewhere) and the fully wired mux is swapped onto the same listener when ready — no port gap. Co-Authored-By: Claude Fable 5 <[email protected]>
…ypes) Co-Authored-By: Claude Fable 5 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Observed live tonight: the v0.130.3 deploy triggered the one-time boot VACUUM on a 2.3 GB database (25 minutes on the Pi's SD card). The API port stayed unbound throughout, the Docker healthcheck failed, and ftw-updater judged the deploy failed — auto-rolling back in the middle of the VACUUM. The rollback container then ran the same VACUUM outside the updater's watch window and completed fine, which is how the site recovered.
Fix: bind :8080 before
state.Open, serving a boot-phase handler —/api/healthanswers 200{"status":"starting","phase":"initializing state"}, everything else 503 + Retry-After. When wiring completes, the fully built mux is atomically swapped onto the same listener (no port gap, no failed probes at handoff). This also covers every other slow-boot path: post-crash full integrity check, snapshot heal, large migrations.Verified:
make verifygreen (vet + unit/integration + e2e).🤖 Generated with Claude Code