Run a relay with Docker and Helm
By the end of this guide a relay runs from a container image you built, first on your own machine and then on a Kubernetes cluster, with a volume for its store, a name that clients use, and a limit on who may create rooms. A relay is a server that stores and forwards a room's entries so that agents on different machines can share it (Relays and homes).
This guide is for macOS and Linux. No image is published, so you build your own. The Dockerfile and the
Helm chart are in the Interlinked source tree: Dockerfile at its top, and the chart in
deploy/helm/il-relay. The maintainers have run the cluster install on a managed Kubernetes cluster
(GKE Autopilot, Kubernetes 1.36); the steps that need no cluster, the chart check and the room limit,
are run for real below.
Before you start
- Interlinked built and on your
PATH, as in Install, and the source tree it clones into a folder calledinterlinked. Itsilis what you use to check the relay. - Docker, to build the image, and a container registry you can push to.
- Helm 3 or newer, and for the install,
kubectland a Kubernetes cluster. - A way to reach the relay from outside the cluster, which step 6 explains.
1. Build the image
From the folder that holds interlinked:
cd interlinked
docker build -t registry.example.com/il-relay:0.1 .
Replace registry.example.com/il-relay:0.1 with a name in your registry. The first build takes about
five minutes on eight cores, because it compiles the relay inside the image. The image runs the relay
as the user 65532, so that it never runs as root, listens on port 4747, and keeps what it stores under
/var/lib/il-relay.
2. Try it on your machine
docker run --rm -p 4747:4747 registry.example.com/il-relay:0.1
The relay prints one line of JSON when it is ready. It names the address and port it listens on
(4747), says that TLS is on ("tls":true), and gives two values that identify it: pub, the relay's
public key, and cert_sha256, the hash of its self-issued certificate. Use pub for
--relay-key when you create the first room on this relay, as in
Run a relay on your machine with TLS.
From a second terminal, ask the relay how it is:
il relay status 127.0.0.1:4747 --tls
It prints the relay's status as JSON. Stop the container with Control-C. This container keeps its store inside itself, so everything is gone when it stops; the next steps use a volume.
3. Push the image and note its digest
docker push registry.example.com/il-relay:0.1
The last lines of the output include digest: sha256:.... Copy that value. A tag such as 0.1 can be
moved to a different image later, and a digest cannot, so the chart takes the digest, and you always
know exactly which image is running.
4. Limit who may create rooms
By default, anyone who can reach a relay can create rooms on it. The relay's --creator option limits
that to the keys you name, and you repeat it for each key. A key is the 64-character hex that
il id prints. Take alice's:
il init alice
{"address": "<alice address>", "home": "~/.interlinked", "launcher": "~/.interlinked/bin/il", "name": "alice", "project": "<project folder>"}
il init bob
{"address": "<bob address>", "home": "~/.interlinked", "launcher": "~/.interlinked/bin/il", "name": "bob", "project": "<project folder>"}
il --as alice id
(shortened: fields not discussed here are left out)
{"hex": "<alice public key, hex>"}
KEY=THE_HEX_VALUE_PRINTED_ABOVE
Start a relay with that key as its only creator. This one runs on your machine without TLS, only for the demonstration:
il-relay serve --store-dir relay-store --host 127.0.0.1 --port 7000 --no-tls --creator "$KEY"
{"address":"il://127.0.0.1:7000","cert_sha256":"","directory":"<address>","impl":"rust","port":7000,"pub":"<id-1>","tls":false}
alice can create a room on it, and bob, whose key is not on the list, is refused:
il --as alice room create team --no-e2ee --relay 127.0.0.1:7000
(shortened: fields not discussed here are left out)
{"name": "team", "relay": "at the relay"}
il --as bob room create nope --no-e2ee --relay 127.0.0.1:7000
{"detail": "the room was made here, but the relay at 127.0.0.1:7000 refused it: key may not create rooms on this relay", "error": "refused", "run": "ask the relay's operator to accept rooms from this key, then: il room relay nope 127.0.0.1:7000"}
Notice that bob's room was made in his own home but the relay refused it, so it is not on the relay. The message names what to do: ask the relay's operator to accept the key.
5. Write the chart values
Save this as values.yaml. Change the names to yours, and give --creator your own key, in quotes
(without quotes, YAML can read a key made only of digits as a number):
cat > values.yaml <<'EOF'
image:
repository: registry.example.com/il-relay
publicHost: relay.example.com
service:
port: 443
persistence:
storageClassName: standard
size: 5Gi
resources:
requests:
cpu: 250m
memory: 512Mi
extraArgs:
- --creator
- "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef"
EOF
What each value does:
| Value | What it does |
|---|---|
image.repository, image.digest | The image to run. Set the digest with --set, as in step 7 |
publicHost | The name clients use for the relay. The relay advertises it |
service.port | The port the relay listens on. At 443 the relay advertises il://host without a port, and current Kubernetes lets it bind 443 as a user that is not root |
persistence.storageClassName, persistence.size | The volume for the store. 5Gi was plenty |
resources | CPU and memory. 250m of CPU and 512Mi of memory are comfortable for a small relay |
extraArgs | More options for il-relay serve, such as --creator |
extraEnv | More environment, for settings or references to secrets |
service.annotations | Annotations for the load balancer |
The chart keeps the store in a folder the relay creates inside the volume (/var/lib/il-relay/store),
because the relay sets the folder's permissions to be readable only by its own user and cannot do that
to the root of a volume it does not own. The storage must honour the chart's fsGroup of 65532.
helm lint checks the chart with your values (the chart has no icon, which Helm only mentions):
helm lint interlinked/deploy/helm/il-relay -f values.yaml
==> Linting interlinked/deploy/helm/il-relay
[INFO] Chart.yaml: icon is recommended
1 chart(s) linted, 0 chart(s) failed
6. Render the chart and read the result
Rendering shows exactly what would be sent to the cluster, without installing anything. This prints the relay's arguments. The digest here is a placeholder; use yours:
helm template il-relay interlinked/deploy/helm/il-relay -f values.yaml --set image.digest=sha256:0000000000000000000000000000000000000000000000000000000000000000 --show-only templates/deployment.yaml | grep -A 14 "args:"
args:
- serve
- --store-dir
# A folder the relay creates and owns: it cannot set the mode of the volume root.
- /var/lib/il-relay/store
- --host
- 0.0.0.0
- --port
- "443"
- --public-host
- "relay.example.com"
- "--creator"
- "<id-1>"
ports:
- name: relay
Notice the relay's folder, its port 443, the public name, and your creator key (shown as a stand-in
for the key in your values).
7. Install it
helm upgrade --install il-relay interlinked/deploy/helm/il-relay \
--namespace relay --create-namespace \
-f values.yaml --set image.digest=sha256:YOUR_DIGEST
The chart makes one pod with one volume. It cannot run more than one copy, because the store belongs to one process.
8. Make it reachable
The relay speaks its own protocol over TLS, with its own certificate, on one port. So put a TCP (layer
4) load balancer in front of the chart's service: one that passes the connection through unchanged.
An HTTP (layer 7) load balancer does not work for the relay protocol. Point the name in publicHost
at the load balancer. A new cloud load balancer can take a few minutes before its address answers.
9. Check it
From outside the cluster:
il relay status relay.example.com
It prints the relay's status and key. The relay's key in hexadecimal is in the first line of the pod's
log (kubectl logs, the same pub as in step 2). Create the first room as one of your creator keys,
giving the relay's key, as in Run a relay on your machine with TLS:
il --as alice room create team --relay relay.example.com --relay-key RELAY_KEY
A key that is not a creator is refused with key may not create rooms on this relay, as in step 4.
Next
Serve the operator endpoint lets a person watch the relay's rooms from Claude.