Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 8 additions & 32 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ name: Release
on:
push:
tags:
- "v*"
- "*.*.*"
- "v*.*.*"
workflow_dispatch:
inputs:
tag:
Expand Down Expand Up @@ -119,40 +118,17 @@ jobs:
run: |
VERSION="${{ steps.version.outputs.version }}"
SHA256=$(shasum -a 256 target/release/roxy-${VERSION}-macos-arm64.tar.gz | awk '{print $1}')
URL="https://github.com/rbas/roxy/releases/download/v${VERSION}/roxy-${VERSION}-macos-arm64.tar.gz"

git clone https://x-access-token:${HOMEBREW_TAP_TOKEN}@github.com/rbas/homebrew-roxy.git /tmp/homebrew-roxy
cd /tmp/homebrew-roxy

cat > Formula/roxy.rb << 'FORMULA'
class Roxy < Formula
desc "Local development proxy with custom .roxy domains and automatic HTTPS"
homepage "https://github.com/rbas/roxy"
license "MIT"
FORMULA

cat >> Formula/roxy.rb << FORMULA
version "${VERSION}"

on_macos do
if Hardware::CPU.arm?
url "https://github.com/rbas/roxy/releases/download/v${VERSION}/roxy-${VERSION}-macos-arm64.tar.gz"
sha256 "${SHA256}"
end
end
FORMULA

cat >> Formula/roxy.rb << 'FORMULA'

def install
bin.install "roxy"
end

test do
system "#{bin}/roxy", "--version"
end
end
FORMULA
sed -e "s|__VERSION__|${VERSION}|g" \
-e "s|__URL__|${URL}|g" \
-e "s|__SHA256__|${SHA256}|g" \
scripts/formula.rb.template \
> /tmp/homebrew-roxy/Formula/roxy.rb
Comment thread
rbas marked this conversation as resolved.

cd /tmp/homebrew-roxy
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add Formula/roxy.rb
Expand Down
49 changes: 0 additions & 49 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ anyhow = "1.0"
thiserror = "2.0"
serde = { version = "1.0", features = ["derive"] }
toml = "0.9"
dirs = "6.0"
rcgen = { version = "0.14", features = ["pem"] }
time = "0.3"

Expand Down
26 changes: 24 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,26 @@ roxy logs -f # Follow (like tail -f)
roxy logs -n 100 # Last 100 lines
```

## Auto-Start on Boot

If you installed Roxy via Homebrew, you can use `brew services` to start Roxy
automatically at boot:

```bash
# Start roxy now and auto-start at boot
sudo brew services start roxy
```

Roxy stores its configuration in `/etc/roxy/config.toml`, so it works
automatically when started by launchd at boot — no extra environment
variables needed.

To stop auto-start:

```bash
sudo brew services stop roxy
```

## How It Works

**Three steps, then forget about it:**
Expand All @@ -255,7 +275,9 @@ signed by your Root CA. WebSockets work transparently. DNS queries for

**Clean and contained:**

- All config, certs, and logs: `~/.roxy/`
- Config, certs, and CA: `/etc/roxy/`
- Logs: `/var/log/roxy/`
- PID file: `/var/run/roxy.pid`
- DNS configuration: `/etc/resolver/roxy` (macOS)
- Run `roxy uninstall` to remove everything cleanly

Expand Down Expand Up @@ -338,7 +360,7 @@ Roxy is ready for daily development use on macOS. Recent additions and future pl
- [ ] **Docker network DNS** — resolve `.roxy` domains inside containers
without `extra_hosts`
- [ ] **Wildcard subdomains** — support `*.myapp.roxy` patterns
- [ ] **Auto-start on boot** — launch daemon via launchd automatically
- [x] **Auto-start on boot** — launch daemon via launchd with `brew services`

Have a feature idea?
[Open an issue](https://github.com/rbas/roxy/issues) and let's discuss!
Expand Down
86 changes: 70 additions & 16 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ open https://myapp.roxy
| `sudo roxy install` | Initial setup |
| `sudo roxy uninstall [--force]` | Full cleanup |
| `sudo roxy register <domain> ...` | Register domain |
| `roxy unregister <domain>` | Remove domain |
| `sudo roxy unregister <domain>` | Remove domain |
| `roxy list` | Show all domains |
| `sudo roxy route add ...` | Add route to domain |
| `roxy route remove ...` | Remove route from domain |
Expand All @@ -42,7 +42,9 @@ open https://myapp.roxy
| `roxy status` | Show daemon status |
| `roxy logs [-n N] [-f]` | View or follow daemon logs |

**Note:** Commands that modify system configuration (CA certs, DNS) or control the daemon (runs on ports 80/443) require `sudo`.
**Note:** Commands that modify system configuration
(CA certs, DNS) or control the daemon (runs on ports
80/443) require `sudo`.

## Route Targets

Expand Down Expand Up @@ -87,16 +89,18 @@ roxy route list app.roxy
## Files and Directories

```text
~/.roxy/
/etc/roxy/
├── config.toml # Main configuration
├── roxy.pid # PID file (when daemon runs)
├── certs/
│ ├── ca.key # Root CA private key
│ ├── ca.crt # Root CA certificate
│ ├── <domain>.key # Per-domain private key
│ └── <domain>.crt # Per-domain certificate
└── logs/
└── roxy.log # Daemon log file
├── ca.key # Root CA private key
├── ca.crt # Root CA certificate
└── certs/
├── <domain>.key # Per-domain private key
└── <domain>.crt # Per-domain certificate

/var/run/roxy.pid # PID file (when daemon runs)

/var/log/roxy/
└── roxy.log # Daemon log file
```

macOS DNS resolver file (created by `roxy install`):
Expand All @@ -108,10 +112,29 @@ macOS DNS resolver file (created by `roxy install`):
This tells macOS to resolve all `*.roxy` domains through
the local DNS server.

All paths are configurable via the `[paths]` section in
`config.toml` (see [Configuration](#configuration)).

## Auto-Start with Homebrew

If you installed Roxy via Homebrew, use `brew services`
to start it automatically at boot:

```bash
# Start now and auto-start at boot
sudo brew services start roxy

# Stop auto-start
sudo brew services stop roxy
```

When managed by `brew services`, Roxy runs in foreground
mode and launchd handles process supervision.

## Daemon: Foreground vs Background

**Background** (default) — forks to the background,
writes a PID file, logs to `~/.roxy/logs/roxy.log`:
writes a PID file, logs to `/var/log/roxy/roxy.log`:

```bash
sudo roxy start
Expand Down Expand Up @@ -141,7 +164,7 @@ Change the log level (highest priority first):
`ROXY_LOG=debug sudo roxy start`
2. **CLI flag** — `sudo roxy start --verbose`
(sets debug level)
3. **Config file** — edit `~/.roxy/config.toml`:
3. **Config file** — edit `/etc/roxy/config.toml`:

```toml
[daemon]
Expand All @@ -152,9 +175,25 @@ Change the log level (highest priority first):

Available levels: `error`, `warn`, `info`, `debug`.

## Global Options

All commands accept these global flags:

| Flag | Default | Description |
| ---- | ------- | ----------- |
| `-c`, `--config <PATH>` | `/etc/roxy/config.toml` | Config file |
| `-v`, `--verbose` | off | Enable debug output |

Example using a custom config:

```bash
sudo roxy -c /opt/roxy/config.toml start
```

## Configuration

The configuration lives in `~/.roxy/config.toml`.
The configuration lives in `/etc/roxy/config.toml`
(override with `--config`).

### Daemon Section

Expand Down Expand Up @@ -190,6 +229,21 @@ target = "127.0.0.1:3001"
Domain names must end with `.roxy` and can contain
letters, numbers, hyphens, and dots (for subdomains).

### Paths Section

Override where Roxy stores its data:

```toml
[paths]
data_dir = "/etc/roxy"
pid_file = "/var/run/roxy.pid"
log_file = "/var/log/roxy/roxy.log"
certs_dir = "/etc/roxy/certs"
```

The values above are the defaults. You only need this
section if you want different locations.

## Using Roxy with Docker

Roxy runs on the host, so containers need to know how
Expand Down Expand Up @@ -265,8 +319,8 @@ sudo lsof -i :443
sudo lsof -i :1053
```

Stop the conflicting service or configure Roxy to use different ports
in `~/.roxy/config.toml`.
Stop the conflicting service or configure Roxy to use
different ports in `/etc/roxy/config.toml`.

### Backend Service Not Responding

Expand Down
42 changes: 42 additions & 0 deletions scripts/formula.rb.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
class Roxy < Formula
desc "Local development proxy with custom .roxy domains and automatic HTTPS"
homepage "https://github.com/rbas/roxy"
license "MIT"
version "__VERSION__"

on_macos do
if Hardware::CPU.arm?
url "__URL__"
sha256 "__SHA256__"
else
odie "Roxy currently only supports Apple Silicon (ARM64). Intel Macs are not yet supported."
end
end

def install
bin.install "roxy"
end

service do
name macos: "cz.rbas.roxy"
run [opt_bin/"roxy", "--config", "/etc/roxy/config.toml", "start", "--foreground"]
keep_alive true
require_root true
log_path "/var/log/roxy/roxy.log"
error_log_path "/var/log/roxy/roxy.log"
end
Comment thread
rbas marked this conversation as resolved.

def caveats
<<~EOS
Roxy requires a one-time setup before use:
sudo roxy install

To start roxy now and auto-start at boot:
sudo brew services start roxy
EOS
end

test do
system "#{bin}/roxy", "--version"
end
end
Loading