Skip to content

Cluster workflow

Realm manages a cluster in two steps. First realm plan turns the config file into a planned state, saved in a state file. Then realm start, realm update and realm stop apply that state to the nodes.

flowchart LR
config[config.yaml] -- realm plan --> state[realm.state]
state -- realm start / update / stop --> nodes[Nodes]

The state file holds the planned configuration of every node, including the loads assigned to it.

By default it is realm.state. It’s stored in data_path when data_path is set in the config file or through REALM_DATA_PATH, and in the current working directory otherwise. The --state <file> flag selects another file on any of the commands below.

Terminal window
realm plan

Computes the cluster state from the config, prints the differences from the current state file, and asks for confirmation before writing it.

Flag Description
--dry Show the differences without updating the state file
-y, --yes Update the state file without asking for confirmation

--dry and --yes are mutually exclusive. Without --yes, plan needs an interactive terminal to ask for confirmation.

Terminal window
realm start

Powers on the nodes, loads their planned configuration and starts their loads.

It aborts if the config file differs from the state file (run realm plan first), or if a running node already holds a configuration different from the planned one.

Terminal window
realm update

Rolls out planned changes to a running cluster: loads, timeouts and registries. Affected loads are stopped in dependency order, the new node configuration is loaded, and the loads are started again. If nothing changed, it reports the cluster is up to date.

Changes to a node’s URL, driver, driver config or cloud-init can’t be rolled out on a running node: the agent rejects them as a configuration mismatch.

Terminal window
realm stop

Stops all loads and powers off the nodes, after asking for confirmation. If any load fails to stop, the nodes are not powered off. Like start, it aborts if the config file differs from the state file.

Flag Description
--message <text> Wall message broadcast to logged-in users before shutdown
--time <minutes> Shutdown delay in minutes. 0 (default) shuts down now
-y, --yes Stop the cluster without asking for confirmation

To act on individual nodes or loads instead of the whole cluster:

Command Description
realm nodes state [node...] Show the state of nodes (--json for JSON output)
realm nodes config [--all | node...] Show the node configuration loaded on each agent
realm nodes discover Discover agents through mDNS (--timeout, default 2s)
realm nodes poweron|poweroff|restart|shutdown [--all | node...] Power management
realm loads state [--all | load...] Show the state of load deployments
realm loads start|stop|kill [--all | load...] Control loads
realm loads stdout|stderr <load> Read a load’s output
realm loads graph Print the load dependency graph
realm drivers List registered drivers (--json for JSON output)

nodes and loads can be shortened to n and l.