add --port flag

This commit is contained in:
leo committed 2026-11-23 00:05:50 +02:00
1 parent 2d564a1546
commit 9a818fce9f
10 files changed
+294 -14

No files matched your search

+23 -1
View File
@@ -183,7 +183,6 @@ proxdomain assign --vmid 101
# pick the name and backend port explicitly
proxdomain assign --name "web01" --subdomain app --port 8080
# a full name under another zone the token can read
proxdomain assign --vmid 101 --subdomain app.example.net
@@ -211,6 +210,28 @@ scripting around exit codes:
* `1` — the action failed (DNS, web server, or lookup)
* `2` — usage or configuration error
### Backend port
A guest is proxied to `http://<guest IP>:<port>`. The port is resolved in this
order, and `assign` prints which source won:
1. `--port` on the command line
2. `proxdomain-port=8080` in the guest's **Notes** field (Options → Notes), or a
`proxdomain-port-8080` tag — so a VM/CT carries its own port and automatic
assignment picks it up
3. the port already stored for that domain — re-running `assign` never resets a
custom port back to the default
4. `general.default_port`
```bash
proxdomain assign --vmid 101 --port 8080 # one-off, stored in state.json
proxdomain sync # re-reads Notes/tags, rewrites vhosts
```
Changing the port later is the same command, or edit the Notes field and run
`sync`; the vhost and the Cloudflare record do not need to be recreated. Ports
outside 1–65535 are refused before any file or DNS change.
## Automatic assignment for new guests
Tag a guest `proxdomain` in the Proxmox UI (or set `watch.tag`), then:
@@ -337,6 +358,7 @@ records every config/DNS/remove action with a UTC timestamp.
| Symptom | Cause / fix |
| --- | --- |
| `no usable IP address found` | Install and start `qemu-guest-agent` in the VM, set a static `ip=` in the guest/cloud-init config, or pass `--ip`. |
| Wrong port in the vhost | Check the `port` line of `assign`: `--port`, then the guest Notes/tag declaration, then the stored value, then `general.default_port`. |
| `401/403` from Proxmox | Token ACL or `--privsep`. Grant `VM.Audit VM.Monitor` on `/` (or at least `/vms`). |
| `token_secret_env ... must be the name of an environment variable` | The secret was pasted into the setting that should hold the variable name. Set `token_secret_env = "PROXDOMAIN_PVE_TOKEN"` and export the secret, or use `token_secret_file` / `token_secret`. |
| Secret reported as empty although it was set inline | `VAR=value && proxdomain ...` sets a variable and then runs an unrelated command. Use `export VAR=value` first, or `VAR=value proxdomain ...`. |