---
name: caddy-manager
description: Manage Caddy reverse proxy sites for dev web apps. Add, list, and remove HTTPS sites on *.dev.apps.symph.co with automatic port allocation (3001-3100). Auto-reloads Caddy after changes. Use when deploying web apps for preview/testing.
---

# Caddy Manager

Manage the Caddyfile to add/remove HTTPS reverse proxy sites for dev web apps.

**Domain:** `*.dev.apps.symph.co`  
**Port Range:** 3001-3100 (auto-allocated)

## Commands

### List all configured sites
```bash
bash {baseDir}/scripts/caddy-manager.sh list
```

### Add a new site (auto-allocate port)
```bash
bash {baseDir}/scripts/caddy-manager.sh add <subdomain>
```

### Add a new site (specific port)
```bash
bash {baseDir}/scripts/caddy-manager.sh add <subdomain> <port>
```

**Examples:**
```bash
# Add todo.dev.apps.symph.co → auto-allocated port
bash {baseDir}/scripts/caddy-manager.sh add todo

# Add api.dev.apps.symph.co → localhost:3005
bash {baseDir}/scripts/caddy-manager.sh add api 3005
```

### Remove a site
```bash
bash {baseDir}/scripts/caddy-manager.sh remove <subdomain>
```

### Check port allocation
```bash
bash {baseDir}/scripts/caddy-manager.sh ports
```

### Show Caddyfile contents
```bash
bash {baseDir}/scripts/caddy-manager.sh show
```

### Reload Caddy (after manual edits)
```bash
bash {baseDir}/scripts/caddy-manager.sh reload
```

## Workflow

When creating a new web app:

1. Create and start your app
2. Run: `bash {baseDir}/scripts/caddy-manager.sh add myapp`
3. Note the auto-allocated port (e.g., 3000)
4. Start your app on that port
5. App is live at `https://myapp.dev.apps.symph.co`

Or specify the port if your app already runs on one:
1. App running on localhost:3005
2. Run: `bash {baseDir}/scripts/caddy-manager.sh add myapp 3005`
3. App is live at `https://myapp.dev.apps.symph.co`

## Notes

- Caddyfile location: `/etc/caddy/Caddyfile`
- Port state tracked in: `/home/aria/.openclaw/workspace/agency/infra/caddy-ports.json`
- Requires sudo for Caddyfile edits
- Caddy auto-handles SSL via Let's Encrypt
- DNS wildcard `*.dev.apps.symph.co` points to this server

## External State (not in workspace)

Port allocation is stored outside the workspace to avoid repo bloat:

```
/home/aria/.openclaw/workspace/agency/infra/caddy-ports.json
```

Structure:
```json
{
  "allocated": {
    "storygen": 3001,
    "dashboard": 3001
  }
}
```
