feat: Add brew services integration#2
Merged
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
Adds Homebrew brew services support for running Roxy as a managed service, and refactors configuration/path handling so the daemon/CLI use explicit system paths (config, certs, logs, PID) rather than $HOME-relative defaults.
Changes:
- Introduce a Homebrew formula template + local test script, and update the release workflow to publish to the Homebrew tap after tagging a release.
- Consolidate path configuration into
RoxyPathsunder[paths]in config, threadConfig/paths through CLI and daemon instead of re-reading from disk in multiple places. - Adjust TLS SNI certificate resolution to fail cleanly (no fallback cert) for unknown domains.
Reviewed changes
Copilot reviewed 32 out of 33 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| src/main.rs | Adds global --config flag and threads loaded Config/RoxyPaths into CLI commands. |
| src/infrastructure/tracing.rs | Removes the old home-dir-based default log path helper. |
| src/infrastructure/pid.rs | Makes PID file location explicit via PidFile::new(path) and avoids unwrap() on parent(). |
| src/infrastructure/paths.rs | New: defines RoxyPaths with system-default locations and serde defaults. |
| src/infrastructure/mod.rs | Exposes the new paths module. |
| src/infrastructure/config/mod.rs | Adds paths: RoxyPaths to config; makes ConfigStore path-explicit and defaults config when missing. |
| src/infrastructure/certs/service.rs | Threads RoxyPaths into certificate operations (CA + cert generation paths). |
| src/infrastructure/certs/generator.rs | Removes home-dir defaults; makes generator path-explicit; simplifies save() return type. |
| src/infrastructure/certs/ca.rs | Removes home-dir defaults; makes CA base directory explicit. |
| src/domain/value_objects/route.rs | Renames RouteError variants to remove clippy suppression and improve naming consistency. |
| src/domain/value_objects/path_prefix.rs | Removes unused is_empty, keeps len() with clippy allow. |
| src/daemon/tls.rs | Removes fallback cert behavior; loads cert/key directly from configured certs dir; warns on unknown SNI. |
| src/daemon/server.rs | Server now takes Config and RoxyPaths; initializes AppState from in-memory registrations. |
| src/daemon/router.rs | AppState no longer reads config from disk; takes registrations via DI. |
| src/cli/unregister.rs | Uses explicit config path and RoxyPaths for cert service. |
| src/cli/uninstall.rs | Uses explicit config path and RoxyPaths; expands cleanup to PID/log dirs; improves kill check logic. |
| src/cli/stop.rs | Uses explicit PID file path from RoxyPaths. |
| src/cli/status.rs | Uses explicit config path and RoxyPaths for pid/config/certs queries. |
| src/cli/start.rs | Threads config/path into start; background start re-execs with --config; daemon logging uses configured log file. |
| src/cli/route.rs | Uses explicit config path for route mutations. |
| src/cli/restart.rs | Reloads config from disk before starting; uses explicit PID file path. |
| src/cli/reload.rs | Reloads config from disk before starting; uses explicit PID file path. |
| src/cli/register.rs | Uses explicit config path and RoxyPaths for cert service + config store. |
| src/cli/logs.rs | Reads/clears/follows logs via configured log file path. |
| src/cli/list.rs | Uses explicit config path and RoxyPaths for cert status checks. |
| src/cli/install.rs | Ensures data/certs/log dirs exist; writes default config if missing; uses path-injected cert service. |
| scripts/test-brew.sh | New: local Homebrew formula + brew services integration test helper. |
| scripts/formula.rb.template | New: Homebrew formula template with a service do block and fixed config/log paths. |
| docs/README.md | Updates docs for new filesystem layout, global --config, and brew services usage. |
| README.md | Adds Homebrew auto-start instructions and updates filesystem layout bullets. |
| Cargo.toml | Removes dirs dependency (no longer home-dir based). |
| Cargo.lock | Removes transitive dirs/dirs-sys deps. |
| .github/workflows/release.yml | Generates formula from template and pushes it to the Homebrew tap after release. |
💡 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
brew servicessupport for starting/stopping Roxy as a managed serviceCleanup
Code quality improvements made along the way:
PathsConfigandRoxyPathsinto a single typeConfigintoServer/AppStateinstead of re-reading from diskreload/restart.unwrap()inuninstall.rs, add context tocreate_dir_allerrorsRouteErrorvariants and fix clippy suppressions