Runbooks
Commands below assume meroctl can reach the cluster and trusts it:
export CALIMERO_API=https://n1.eu1.example.com/export CALIMERO_TEE_PROFILES=<profile>export CALIMERO_OPS_TOKEN=<ops token>Add a node
Section titled “Add a node”A node that is not one of the founding --peers joins a running cluster as a
learner of the system group once it is registered.
-
Start it with the cluster’s settings (
--cluster, KMS identity, governance flags,--rp-id,--origins), its own--node-idand--public-url, and without--bootstrap. It waits. -
Register it:
Terminal window meroctl --operator-key-file operator.key ops add-node 4 https://n4.eu1.example.com/ [--zone eu1-b]Registering a node is an operator decision: the node answers
428 OPERATOR_SIGNATURE_REQUIREDand meroctl signs it with the operator key, as it does forops remove-node,ops moveandops set-quotas. Only the nodes in the first leader’s--peersare registered without it, at genesis. -
The system leader adds it as a learner; the log shows
a registered node joined the system group.meroctl ops statuslists it under the system group’s learners and innodes. -
New apps may now be placed on it (spread across zones, least-loaded first within that; see placement), and you can move existing ones onto it.
A learner holds the directory and can serve and host apps, but does not vote in the system group. While the system group has fewer than 3 voters, the system leader promotes caught-up learners to make exactly 3 (never 2), those in zones no voter is in first; a voter removed (below) is replaced the same way. It does not grow past 3 by itself.
Grow from one node
Section titled “Grow from one node”A cluster can start on one node (--bootstrap, --peers naming only itself)
and grow:
-
Until it has three voters the first node is a single point of failure: every system write and access check needs it. Apps created now get one replica.
-
Add two nodes as above, registering each with
--zonewhen they are in different zones. With only the second registered, the system group stays at 1 voter (2 voters would tolerate no failure); once both have caught up, the leader makes them voters in one change.meroctl ops statusshowssystem.voters[1, 2, 3]. -
Spread the apps placed while there was one node:
Terminal window meroctl ops placement # each app's replicas, each node's app countmeroctl ops move <app> --replicas 1,2,3mdma does this as its rebalancer: it reads
GET /ops/placementand sendsPOST /ops/apps/{app}/replicas, which answersunchanged: truewhen the app already has that set and409 MOVE_IN_PROGRESSwhile another move of the app runs. -
A fourth node and later ones stay learners of the system group;
ops placementlists them withapps: 0until a move puts apps on them.
Remove a node
Section titled “Remove a node”-
Move every app off it: for each app whose
replicasname the node,meroctl ops move APP --replicas ...with a set that leaves it out (run against the app’s leader). The node refuses to be removed while an app keeps a replica on it. -
Remove it, against the system leader (another node answers
421 NOT_LEADERwithdetails.leaderUrl):meroctl --ops-token T --operator-key-file F ops remove-node ID(DELETE /ops/nodes/{id}). It leaves the directory and the system group; a registered learner takes its vote while fewer than 3 voters are left. -
Stop the process and retire its data disk. Only a signed
ops add-nodebrings it back.
Move an app’s replicas
Section titled “Move an app’s replicas”-
Find the app’s group and its leader:
meroctl ops status(thegroupsentry for the app on a node that hosts it). -
Move it:
Terminal window meroctl ops move <app-or-context-id> --replicas 2,3,4meroctl sends it to the node you named; a follower answers
421 NOT_LEADERand meroctl retries at the leader’s URL. -
The leader hands the new nodes the app’s bundle and blobs, adds them as learners, waits, switches the voters to the new set, and records it. The answer is the group’s new status.
Refusals: TOO_FEW (fewer than min(3, nodes in the cluster) replicas),
DUPLICATE_REPLICA, UNKNOWN_NODE (an id not registered), 403 naming a node
whose release the app’s owner has not approved, NOT_HOSTED when the node
asked does not hold the app, or 409 MOVE_IN_PROGRESS while another move of
the app runs (retry once it answers). Repeating a move is safe: a move to the
set the app already has answers unchanged: true.
Back up app state
Section titled “Back up app state”With --backup-dir set, every node writes, every 60 seconds, a snapshot of
each app group it leads that has moved since its last one:
{backup-dir}/{app-id}/{index:020}.{group}.{snapshot-id}.snap. Force one now
on a node with meroctl ops backup (it answers { written }).
- Snapshots are the Raft snapshot files as written, sealed frame by frame under the cluster key K_c; only a node of the same cluster, on any release (or a tool holding K_c), opens them.
- Only leaders write, so collect
--backup-dirfrom every node; the newest file per app is the newest backup. - Copy them off the machine; the directory stands in for object storage.
Set quotas
Section titled “Set quotas”meroctl ops quotasmeroctl ops set-quotas '{"maxFileBytesPerOrg":50000000000}'set-quotas changes the limits it names (a field left out keeps its value). They
live in the system state, so every node enforces the same limits when commands
apply; refusals are 429 QUOTA_EXCEEDED. On a cluster whose sign-up is
open, maxAccounts is what bounds the cluster’s growth; see below for one
that is not.
Close sign-up
Section titled “Close sign-up”A cluster’s sign-up policy is open,
invite or closed. Start a new cluster with it (--sign-up invite,
MEROD_SIGN_UP, or sign-up = "invite" in config.toml; mero-tee and mdma
stamp it with the other genesis flags), or change an existing one with the
operator’s signature:
# 428 OPERATOR_SIGNATURE_REQUIRED answers the bytes to sign; send them back signedcurl ... -X POST /ops/sign-up -d '{"policy":"invite"}'Let people in on an invite or closed cluster with a sign-up invite: pick a
random token, issue it signed, and hand the token to the person (their
frontend sends it as invite at sign-up):
curl ... -X POST /ops/sign-up/invites \ -d '{"token":"sup_<random>","uses":1,"expiresAt":"2026-12-01T00:00:00Z"}'GET /ops/sign-up/invites lists the live ones (keys and terms, no tokens);
DELETE /ops/sign-up/invites/{inviteKey} withdraws one. On an invite
cluster an organization’s admins also bring people in with their organization
invites. Where the operator has named the cluster’s owner (--deployers owner), the owner runs all of this instead (/sign-up, passkey).
Upgrade the cluster’s release
Section titled “Upgrade the cluster’s release”A new merod reaches production as a new mero-tee release (a new image). An
app’s data moves only to nodes on a release approved for it.
-
Get the release approved. Where the operator holds release approvals:
Terminal window meroctl ops release <version>Where owners hold them (the default), each organization’s owner approves it with a passkey (
POST /orgs/{org}/releases;meroctl namespace approve-releaseon development clusters), and each account for its own apps. Until then, nodes on the new release get none of that owner’s data. -
Raise the peers’ floor only after every node runs the new release:
--peer-min-releaseon nodes,--min-releaseon clients. -
Start nodes on the new image and add them. Their K_r comes from the new release’s mero-kms and differs from the old nodes’; each new node waits, answering
/healthwith awaitingfield, until it is registered (/ops/nodes) and a peer delivers the cluster key K_c to its address, by attestation (up to 10 minutes; then it exits and is restarted) (The cluster key). -
Move each app onto nodes on the new release with
ops move. A move onto a node whose release the app’s owner has not approved is refused. -
Retire the old nodes once they host no app: stop them. They stay in the directory and the system group’s membership (see Add a node).
Upgrade apps
Section titled “Upgrade apps”Who upgrades depends on --app-upgrades.
-
Owner (default). The app’s owner, or for an org app anyone holding
MANAGE_APPLICATIONthere (the org owner, an admin, a team lead, or a member granted it), approves each upgrade with their own passkey:POST /apps/{app}/upgrade { version }, or an organization-wide runPOST /orgs/{org}/upgrade { package, version, team?, cascade? }approved once. Development clusters:meroctl context update,meroctl group upgrade trigger. -
Operator. Install the release the operator upgrades to, then upgrade:
Terminal window meroctl ops install com.example.kv@1.3.0meroctl ops upgrade <app-id> --version 1.3.0meroctl ops upgrade-namespace <org> --package com.example.kv --version 1.3.0 [--group <team> --cascade]meroctl group upgrade status <org> <run>
An upgrade plans its migration from the two bundles’ embedded ABIs: one state
version up runs the target’s #[app::migrate] edge (or the export named with
--migrate), the app’s migration check must pass, and a downgrade, a jump or a
missing edge is refused. A run upgrades its apps one at a time and records
each failure; POST /orgs/{org}/upgrades/{run}/retry runs the failed ones
again as a new run.
Rotate the ops token
Section titled “Rotate the ops token”The token is per node configuration, not cluster state.
- Make a new token and its hash (
openssl rand -hex 32, thensha256sum). - On each node:
merod --node nX config --ops-token-sha256 <new hash>(or the variable), then restart it. - Switch your tools to the new token; the old one fails with
403on each node as it restarts.
Session-signing keys are each node’s receipt key, kept in its data directory
(signing-key, wrapped under K_r) across restarts. A node replaced on a new
data directory gets a new one; the sessions it signed before answer 401 and
clients refresh. Removing a node ends the sessions it signed the same way.
A node is lost
Section titled “A node is lost”- App groups on it keep serving while a majority of each group’s replicas
answers; leaders move within seconds and forwarded calls retry at the new
leader. Move the lost node’s apps to healthy nodes with
ops moveto restore their margin. - The system group keeps working while a majority of its voters answers. If a majority of the founding voters is lost, sign-ins, installs and organization changes stop; there is no route to change the system group’s voters.
- Restarting a node with the same data directory and configuration resumes it: it catches up from the leaders.
Inspect a stopped node
Section titled “Inspect a stopped node”merod --node n1 inspect # the raw layout, sealed sizesmerod --node n1 inspect --storage-key-file k_r.hex # plus each group's vote, applied index, membershipStop the node first: inspect opens the store for writing. The key file holds
K_r as 64 hex characters, which only a development node gives you directly;
inspect unwraps the cluster key from <data-dir>/cluster-key with it.
Clean up a development cluster
Section titled “Clean up a development cluster”merod local --fresh # start overrm -rf .merod-local # or delete its state