Add idle service configuration for kamal-proxy - #1916
Open
komagata wants to merge 4 commits into
Open
Conversation
This was referenced Jul 20, 2026
komagata
marked this pull request as ready for review
July 21, 2026 06:16
Contributor
There was a problem hiding this comment.
Pull request overview
Adds opt-in configuration for kamal-proxy “idle services” (scale-to-zero) in Kamal, including passing idle timeouts to kamal-proxy and enabling Docker socket access only when idle mode is configured.
Changes:
- Introduces
proxy.idle.timeout/proxy.idle.wake_timeoutconfiguration and validation. - Extends generated proxy deploy/run commands to include idle flags and (when enabled) mount/configure the Docker socket for lifecycle operations.
- Updates documentation and adds tests covering the new configuration and command output.
Tip
If you aren't ready for review, convert to a draft PR.
Click "Convert to draft" or run gh pr ready --undo.
Click "Ready for review" or run gh pr ready to reengage.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
lib/kamal/configuration.rb |
Adds a helper to detect whether proxy idle mode is enabled anywhere in the config. |
lib/kamal/configuration/proxy.rb |
Adds idle? and wires idle options into proxy deploy flags; ensures proxy run config exists when idle is enabled. |
lib/kamal/configuration/validator/proxy.rb |
Validates idle timeout / wake timeout constraints. |
lib/kamal/configuration/proxy/run.rb |
Adds docker socket flag + mount/group wiring into proxy container run args when idle is enabled. |
lib/kamal/configuration/docs/proxy.yml |
Documents proxy.idle and proxy.run.docker_socket. |
test/configuration/proxy_test.rb |
Adds tests for parsing/validating idle configuration and deploy option output. |
test/configuration/proxy/run_test.rb |
Adds tests for selecting default/custom docker socket paths under idle mode. |
test/commands/proxy_test.rb |
Verifies proxy docker run command includes socket mount/group-add and socket arg only when idle is enabled. |
test/commands/app_test.rb |
Verifies deploy command includes idle flags when configured. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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
Add Kamal configuration for the opt-in idle service support in basecamp/kamal-proxy#228.
This continues the work started by @martijnenco in #1800. Thank you for providing the original configuration approach.
Behavior
Applications can configure idle shutdown and wake timeout in
deploy.yml:When at least one role enables idle mode, Kamal:
When idle mode is not configured, generated proxy run and deploy commands remain unchanged and the Docker socket is not mounted.
Direct Docker access is intentionally opt-in and grants powerful host-level container control. The tradeoff and possible restricted host-side lifecycle service were discussed in basecamp/kamal-proxy#222.
Validation
bin/test test/configuration/proxy_test.rb test/configuration/proxy/run_test.rb test/commands/proxy_test.rb test/commands/app_test.rbgit diff --check origin/main...HEADDetailed results and reproduction instructions: https://docs.komagata.org/6456