feat(proxy): kamal proxy cache CLI — stats and purge - #102
Merged
Conversation
## Summary kamal-proxy ships a full cache admin subsystem with zero gem surface - the docs pointed operators at raw proxy logs to find out why nothing was caching. `kamal proxy cache <stats|purge>` closes the gap: - `stats` (--count, --json) reports what the cache is holding - `purge` (--path-prefix) drops this app's cached responses, audited Both run on the layer that owns the cache per the layering contract: the loadbalancer when load balancing (registered under the bare service name), otherwise each proxy host (walking every proxied role's service). The docs' "when it is not caching" section now starts with the stats command instead of raw logs. ## Test Coverage - command shapes on Commands::Proxy and Commands::Loadbalancer, with and without flags - CLI routing: proxy hosts vs loadbalancer for both subcommands, flag passthrough, unknown-subcommand message ## Verification - [x] bundle exec rubocop --parallel passes - [x] unit suite passes Closes #99
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
The last F4 follow-up: kamal-proxy ships a full cache admin subsystem (
cache stats,cache purge) with zero gem surface — the docs pointed operators at raw proxy logs to find out why nothing was caching.kamal proxy cache stats— what the cache is holding;--countmeasures entries/bytes per service (walks a shared store's keyspace, per the proxy's own flag help),--jsonfor the raw reportkamal proxy cache purge— drops this app's cached responses,--path-prefix /assetsto narrow; audited via the usual auditor recordapp-web, …)kamal proxy cache stats, and a new "Administering it" paragraph replaces the raw-logs-only pointerCloses #99
Test plan
Commands::ProxyandCommands::Loadbalancer(with/without--count/--json/--path-prefix)bundle exec rubocop --parallelclean; full unit suite green (1311 runs)Deviations & judgment calls
kamal proxy cache purgewalksroles_on(host).select(&:running_proxy?). If accessory purging is wanted, it fits better as ankamal accessoryconcern later.Purged the response cache), matching the mutation/observation split elsewhere in the file.--path-prefixvalidation is left to the proxy (it rejects prefixes not starting with/in preRun) — one validator, one error message, no drift between the two.cachecommand for both subcommands (--count/--jsonare stats-only,--path-prefixpurge-only), matching howboot_confighandles its subcommand options.