How servers get their bundles
The registry keeps what each server should run. A server gets that desired state every time it connects, so it never has to catch up on what happened while it was away.
- Bundles are stored by their SHA-256 on Cloudflare R2, readable only by the network’s servers. Revisions and assignments live in the network’s Durable Object.
- The server’s connector keeps a signed control channel to that object. When it connects, and whenever an assignment changes, the object works out the bundles for the server’s labels and platform and sends their names and hashes.
- The connector compares the hashes with the files in
plugins/Minekube/games/, downloads only what is missing or different, checks each hash and writes the file atomically. It removes bundles it wrote that are no longer assigned. It leaves files it did not write, such as whatmk devinstalled, alone. - The Minekube plugin sees the new file, loads it on a thread of its own and swaps it in on the server thread, as on the dev server. A bundle that fails to load never replaces the running one.
The bundles stay on the server’s disk, so a server starts with its last revision even when the registry is unreachable.
Why desired state
Section titled “Why desired state”- A server that was offline catches up by itself. It gets the current state when it connects, not a list of events it missed.
- A new server needs no setup. Its labels decide what it runs from the moment it joins.
- A rollback is the same operation as a publish. It changes the desired state, and every server converges to it.
Related
Section titled “Related”- Connector, relay and registry: the control channel and the registry, in Connect.
- Live swap: what the plugin does with a new bundle.
Was this helpful?
Thanks for the feedback.