Self-host the registry and relay
Minekube runs a registry and relays for every network. You can also run your own. Each part is in the open source repository, and Minekube deploys the same code.
The registry
Section titled “The registry”The registry is an Effect Cloudflare Worker in apps/registry. It keeps its state in Durable Objects: Directory maps every key to its network, Network holds one network’s instances, labels and revisions, and Accounts holds accounts and their sessions. Published bundles go to the R2 bucket Bundles.
Locally: in a checkout, mk registry runs it in workerd on http://localhost:4776, with local state and no Cloudflare account. mk server --network starts it for the dev network.
On Cloudflare: infra/network.run.ts deploys it with Alchemy, with DNS for registry.<domain> and *.<domain>. The Worker reads three values:
| Variable | What |
|---|---|
MINEKUBE_NETWORK_DOMAIN |
Where networks are reached: <network>.<domain> |
MINEKUBE_REGISTRY_DOMAIN |
The registry’s own host name |
MINEKUBE_OPERATORS |
The issuers whose short-lived tokens may act as a relay or an admin |
There are no static tokens. A relay or an admin shows a short-lived token of an issuer in MINEKUBE_OPERATORS, such as a Kubernetes service account token.
The relay
Section titled “The relay”The relay is a Rust program in apps/relay, with a Dockerfile. CI publishes its image as ghcr.io/. Each option is a flag and an environment variable:
| Variable | Default | What |
|---|---|---|
MINEKUBE_RELAY_LISTEN |
0.0.0.0:25565 |
Where Java players connect |
MINEKUBE_REGISTRY |
The registry to look up routes in and announce the relay to | |
MINEKUBE_REGISTRY_TOKEN_FILE |
A file with a short-lived token the registry trusts for relays, read before each request | |
MINEKUBE_NETWORK_DOMAIN |
localhost |
Networks are reached at <network>.<domain>; other hosts are refused |
MINEKUBE_RELAY_REGION |
local |
Where the relay runs, a label on the instances homed here |
MINEKUBE_RELAY_KEY |
relay.key |
The relay’s key, made on first start. Connectors recognize the relay by it. |
MINEKUBE_RELAY_TLS_DOMAIN |
Serve the iroh relay over HTTPS for this name, with a certificate from Let’s Encrypt that the relay renews itself. Needs port 443. | |
MINEKUBE_RELAY_TLS_CACHE |
acme |
Where the certificate is kept across restarts |
Locally, mk relay runs one against the local registry. Point your servers’ connector.json at your relay in relays and at your registry in directory.
Related
Section titled “Related”- Connector, relay and registry: what each part does and why.
- Open source: the license and what is in the repository.
Was this helpful?
Thanks for the feedback.