fix: Caddy bootstrap on fresh config + persist deploy history to SQLite#25
Merged
Merged
Conversation
Two bugs found during first real deployment on a clean VPS:
1. Caddy bootstrap failed on a fresh Caddy that has only the admin
endpoint configured. POSTing to config/apps/http/servers/slip returned
'invalid traversal path' because the apps.http tree did not exist yet.
Fix: fetch the full config, merge the slip server block in, and reload
atomically via POST /load — preserving existing config (e.g. admin).
This blocked EVERY fresh install.
2. Deploy history was stuck at 'accepted' in SQLite. The deploy state
machine's record_deploy only updated the in-memory cache, never SQLite —
only the initial 'accepted' write from the API handler was persisted.
GET /v1/deploys/{id} (which reads SQLite) never showed progress.
Fix: give DeploySharedState access to the Db and persist every state
transition. Verified live: deploys now progress accepted -> ... ->
completed and survive daemon restart.
Both verified end-to-end on a real Docker + Caddy VPS.
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.
Two bugs found during the first real deployment on a clean VPS (Ubuntu 24.04 + Docker + Caddy):
1. Caddy bootstrap failed on fresh install (critical)
A freshly-started Caddy has only the
adminendpoint configured — noapps.httptree. The old bootstrap POSTed toconfig/apps/http/servers/slip, which returnedinvalid traversal pathbecause the parent path didn't exist. This blocked every fresh install.Fix: fetch the full config, merge the slip server block in, and reload atomically via
POST /load— preserving existing config (e.g.admin).2. Deploy history stuck at 'accepted' (broke SLIP-70)
The deploy state machine's
record_deployonly updated the in-memory cache, never SQLite. Only the initial 'accepted' write (from the API handler) was persisted, soGET /v1/deploys/{id}never showed progress and history didn't survive restart — defeating the entire point of SLIP-70.Fix: give
DeploySharedStateaccess to theDband persist every state transition.Verification
Both verified end-to-end on a real Docker + Caddy VPS:
380 tests pass, clippy clean.