Auto-start Colima and recover services on daemon boot#49
Merged
munezaclovis merged 2 commits intomainfrom Mar 27, 2026
Merged
Conversation
When the daemon starts and services are registered, launch a background goroutine that boots the Colima VM and recovers stopped service containers. This ensures services come back automatically after a macOS reboot without user intervention. - Runs in background so DNS + FrankenPHP start immediately - Only triggers when Colima is installed AND services exist - Retries once after 10s if Colima fails to start - Logs warnings on failure, daemon keeps running for PHP/DNS
…ervation - Add cancellable context so goroutine stops on daemon shutdown - Use ctx in sleep (select on timer vs ctx.Done) and all Docker calls - Check ctx.Err() between steps to bail early on shutdown - Reload registry inside goroutine instead of sharing stale pointer - Preserve original error in retry message so both are visible - Add descriptive "Starting Colima VM" message on auto-start
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.
Summary
When the pv daemon starts (e.g. after macOS reboot via launchd), it now automatically boots the Colima VM and recovers stopped service containers — so services come back without user intervention.
Before: Daemon starts DNS + FrankenPHP. Colima stays down. Services dead until user runs
pv service:start.After: Daemon starts DNS + FrankenPHP immediately, then boots Colima in the background and recovers containers. Services come up ~15s after daemon start.
Test plan
go test ./...passesgo vet ./...cleanpv service:add redis, restart daemon, verify redis recovers