GatewayRun
Operate
Run the gateway day to day: the admin CLI, more proxy nodes, upgrades, health checks and logs.
The admin CLI
chan-gateway-admin is the operator's view of the whole gateway. Run it as root, with the admin credentials the setup script wrote:
#set -a; . /etc/chan-gateway/admin.env; set +a| Command | Does |
|---|---|
overview --since 24h | Accounts, devservers and OAuth2 sign-ins at a glance. |
tunnel ps, proxy ps | Live devservers and proxy nodes. tunnel watch and proxy watch follow them. |
tunnel kill alice <devserver-id> | Force one devserver offline. It may dial again. |
policy set alice --enabled --max-connected-devservers 3 | Limit one account's connected devservers. |
policy suspend alice, policy resume alice | Disconnect an account's devservers and refuse new ones, keeping its tokens and its limit; then lift that. |
user block alice@example.com --reason "..." | Revoke every token of the account and refuse its sign-ins. |
user audit alice@example.com | The account's sign-ins, refusals and blocks. |
token list alice@example.com, token revoke <token-uuid> | An account's access tokens. |
session oauth ps --user alice | The account's signed-in browser sessions. |
fleet pause --drain, fleet resume | Cut every session and tunnel at once, then admit again. fleet status shows which. |
Add --json to any command for scripts. The exit code is 0 for success, 1 for an upstream or network error, 2 for a bad argument, and 3 for not found.
Details and limits
- An account is found by its uuid, its email, or its username, tried in that order.
user unblocklets an account sign in again; its tokens stay revoked.- Deleting an account, with
user deleteor by its holder on the account page, also disconnects its devservers. - The controller caps every account at 100 connected devservers,
MAX_DEVSERVERS_PER_USERindevserver-control.env; a policy limit applies within that. admin.envpoints at loopback. On another layout, set eachCHAN_ADMIN_*_URLto the service's internal address.- The admin README lists every command.
More proxy nodes
Point proxy.example.com at every node, through DNS or a TCP pass-through balancer, so that every devserver keeps the same tunnel URL. A balancer that terminates TLS carries every tunnel byte. A second node, p2, needs:
| What | Where |
|---|---|
DNS, a certificate and an edge for *.p2.proxy.example.com, as on The edge proxy | On p2 |
devserver-proxy, with DEVSERVER_PROXY_ID=p2, DEVSERVER_PROXY_BASE_URL=https://p2.proxy.example.com and a DEVSERVER_PROXY_TOKEN of its own | On p2 |
p2=<its token> added to DEVSERVER_PROXY_CREDENTIALS, with ; between entries, then a restart of devserver-control | devserver-control.env |
A path to identity's internal listener, 7004, and the controller's proxy listener, 7101 | Between p2 and the first server |
Details and limits
- The other values of
p2'sdevserver-proxy.env, such as the verifying keys andIDENTITY_INTERNAL_TOKEN, are the first node's. - The controller expands each node id into its origin with
DEVSERVER_PROXY_BASE_URL_TEMPLATE, and refuses a node whoseDEVSERVER_PROXY_BASE_URLdiffers. - Every internal listener binds loopback. A bind on another address needs
CHAN_GATEWAY_INTERNAL_TRANSPORT=protected-overlay, which asserts that an authenticated, encrypted network carries the traffic. - With WireGuard, each node also gets an interface and an agent. See WireGuard.
Upgrades
Every gateway service runs the same release, so upgrade them together.
-
Set the release's database markers
migrate.env,identity.envandprofile.enveach carryEXPECTED_SQLX_MIGRATIONandDATABASE_ROLE_POLICY_VERSIONlines. Set them to the values the new release'sconfigure.shwrites: the packages refuse to install over any other. -
Stop identity and profile, and install
$sudo systemctl stop chan-gateway-identity chan-gateway-profile sudo apt install ./chan-gateway-profile_*.deb ./chan-gateway-identity_*.deb \ ./chan-gateway-devserver-control_*.deb ./chan-gateway-devserver-proxy_*.deb \ ./chan-gateway-admin_*.deb -
Apply the schema and restart
$sudo systemctl restart chan-gateway-migrate sudo systemctl restart chan-gateway-profile chan-gateway-identity \ chan-gateway-devserver-control chan-gateway-devserver-proxy
Details and limits
- Restart the schema unit even when the release changes nothing in the database: a finished one-shot does not run again by itself.
- Where identity and profile run on separate hosts, upgrade profile with the schema step, before identity or together with it.
- The controller and the proxy nodes check at connect that they run the same release.
- On each WireGuard node, install the agent package of the same release and restart
chan-gateway-wireguard-agent.
Health and logs
| Check | Command | Healthy |
|---|---|---|
| Every service's log | journalctl -u 'chan-gateway-*' -f | |
| identity answers | curl http://127.0.0.1:7000/healthz | ok |
| profile answers | curl http://127.0.0.1:7001/healthz | ok |
| The controller is ready | curl http://127.0.0.1:7003/readyz | ready; warming until it is |
| The proxy admits devservers | curl -s -o /dev/null -w '%{http_code}\n' -H 'Host: proxy.example.com' http://127.0.0.1:7002/readyz | 200; 503 until it does |
| Proxy nodes connected | chan-gateway-admin proxy ps | One row per node |
| Fleet admission | chan-gateway-admin fleet status | Not paused |
Details and limits
- After a start, the controller refuses admissions and admin reads for about 30 seconds while the proxy nodes report in.
- A proxy that loses the controller for longer than a grace period closes every tunnel and browser session; devservers dial again once it is back.
pool timed out while waiting for an open connection, with Postgres reachable, means Postgres ran out of connection slots: restart it withsudo systemctl restart postgresql.
The gateway README covers every service and its settings, and the gateway design the system.