Relay and nodes
When you want browsers on several machines, run one relay and any number of nodes. Nodes dial out to the relay, so they need no inbound port.
your services ──▶ relay (HTTPS, one replica) ◀── node (VPS) ◀── node (Raspberry Pi) ◀── node (laptop behind NAT)-
Make the secrets. One enrollment secret per node (or per group of nodes), and an API key.
Terminal window docker run --rm ghcr.io/degoke/browserbay secret laptopopenssl rand -base64 24 # the API keyThe
secretcommand prints two lines: the secret for the node, and thename:sha256entry for the relay. The node gets the secret. The relay gets only its hash.From a checkout,
node dist/cli.js secret laptopandnode dist/cli.js keydo the same afterpnpm build. -
Run the relay. It uses the
relayimage, which has no Chromium and is about 230 MB. Run exactly one replica, because the nodes’ sockets live in that process.Terminal window docker run -d --restart always -p 8788:8788 \-e BROWSERBAY_API_KEY=... -e BROWSERBAY_ENROLLMENT_SECRETS=laptop:<sha256> \ghcr.io/degoke/browserbay-relayServe it over HTTPS with WebSocket support, at the root of its own hostname or behind a proxy that strips a path prefix.
-
Run nodes anywhere, from the
browserbayimage with the commandnode.Terminal window docker run -d --restart always --init --stop-timeout 130 \-e BROWSERBAY_RELAY_URL=https://browsers.example.com -e BROWSERBAY_ENROLLMENT_SECRET=... \ghcr.io/degoke/browserbay nodeA node refuses a plain
http://relay unless the relay is on the same machine, because its enrollment secret travels to it. On a private network you trust you can opt in withBROWSERBAY_ALLOW_INSECURE_RELAY=true. It covers only private addresses: a relay on a public address must usehttps://.A node that cannot join says why in its log, whether an unreachable address, a wrong secret, an invalid id or slot count, or a duplicate id, and keeps trying.
-
Check it.
Terminal window curl https://browsers.example.com/healthcurl -H "Authorization: Bearer $BROWSERBAY_API_KEY" https://browsers.example.com/v1/nodes/healthdoes not say a node has joined. Look at/v1/nodesfor that.
Rotating an enrollment secret
Section titled “Rotating an enrollment secret”- Add the new
name:sha256toBROWSERBAY_ENROLLMENT_SECRETS. - Move the nodes to the new secret and restart them.
- Remove the old entry.
Upgrading
Section titled “Upgrading”The node and the relay each announce a protocol version. The relay closes a node that speaks another one (code 4426) and the node logs a warning. Upgrade the relay and the nodes together.