GatewaySet up
Configure
Run the setup script, apply the database schema, and start the gateway services.
Run the setup script
The repository's setup script generates every service credential and signing key, prepares the database roles, and writes the configuration under /etc/chan-gateway/. Run it from a checkout of the same release:
$git clone --depth 1 --branch v0.133.0 https://github.com/fiorix/chan
sudo chan/packaging/gateway/scripts/configure.sh
Answer its questions like this:
| Question | Answer |
|---|---|
| Postgres user, password, database | chan, the password you chose, chan_gateway |
| Gateway public origin | https://gw.example.com |
| Proxy namespace origin | https://proxy.example.com |
| Tunnel ingress origin | Enter, for https://proxy.example.com |
| This proxy node id | Enter, for p1 |
| This proxy node origin | Enter, for https://p1.proxy.example.com |
| WireGuard ingresses | Enter, which leaves WireGuard enrollment off. WireGuard turns it on later. |
| GitHub OAuth Client ID and Client Secret | From the OAuth app. Enter skips Google and GitLab. |
An origin is http:// or https://, a host and an optional port, with no path and no trailing slash. An answer the script refuses stops it before it changes anything; run it again.
Details and limits
- The gateway public origin and the proxy namespace origin have no default.
- With the WireGuard agent's package installed, the script also asks Kernel WireGuard interface for the agent,
wg0by default. - It ends by printing each provider's callback URL and the names that need DNS records and certificates, to check against Plan.
- Every run asks every question again, generates new credentials and signing keys, and replaces each file whole, keeping the old one beside it as
<file>.bak.<date>-<time>, readable by root only. On a running gateway, edit the files instead. - The one value a run takes from the files it replaces is the default answer to the WireGuard address pool question.
- On a rerun, stop
chan-gateway-identityandchan-gateway-profilebefore restarting the schema unit, as the script's closing lines say. - An existing env file the script cannot read stops it before the first question.
What it writes
File in /etc/chan-gateway/ | Read by |
|---|---|
domain.env | identity, devserver-control and devserver-proxy: the public origins |
migrate.env | The schema unit: the database owner's credentials |
profile.env, identity.env | profile and identity, each with a database role of its own |
devserver-control.env, devserver-proxy.env | The controller and this proxy node |
admin.env | chan-gateway-admin; readable by root only |
wireguard-agent.env | The WireGuard agent; written only when its package is installed |
Start the services
Apply the database schema, then start the services:
$sudo systemctl restart chan-gateway-migrate
sudo systemctl enable --now chan-gateway-profile chan-gateway-identity \
chan-gateway-devserver-control chan-gateway-devserver-proxy
The schema unit runs once and must succeed before identity and profile start. Run it again after each upgrade, even when nothing changed.
Check them
Follow every service's log:
$journalctl -u 'chan-gateway-*' -fThe proxy admits devservers about 30 seconds after the controller comes up. Ask it, with the tunnel ingress name as the host:
$curl -s -o /dev/null -w '%{http_code}\n' -H 'Host: proxy.example.com' http://127.0.0.1:7002/readyz200
It answers 503 until it is ready, and 404 to any other host name.