Local clusters
Two local cluster modes run the real node services directly from your checkout’s anastrod binary,
so Rust changes deploy in seconds without rebuilding a full Nix image.
VM cluster (just cluster) |
KVM cluster (just kvm-cluster) |
|
|---|---|---|
| Topology | NixOS VMs from nix/clusters/<name> (single or ha) |
3 converged nodes (cp1–cp3) from nix/kvm-cluster/repo |
| Runtime | QEMU (Hypervisor.framework on macOS, KVM on Linux) |
Docker containers with /dev/kvm (via Colima on macOS) |
| Database | Standalone Postgres (single) or Patroni + etcd (ha) |
Patroni + etcd |
| Runs microVMs? | No (no /dev/kvm in macOS QEMU VMs) |
Yes, with workspaces stored on RustFS on cp1 |
| Best for | Failover, backups, config apply, node API | End-to-end threads, machines, and web UI |
VM cluster (just cluster)
Section titled “VM cluster (just cluster)”Requires an aarch64-linux Nix builder on macOS (nix-darwin’s nix.linux-builder), or KVM on
Linux.
just cluster up ha # or `up single` (`ha` is default)just cluster status # node ports and apid healthjust ctl node status # anastroctl over iroh to every node| Command | Action |
|---|---|
just cluster up [name] |
Validate repo, cross-build anastrod/anastroctl, boot VMs, unseal, wait for apid |
just cluster status |
Show node ports and apid health |
just cluster deploy |
Rebuild anastrod and restart machined, apid, and relay on every node |
just cluster ssh <node> [cmd] |
Open a root shell or run a command (e.g. just cluster ssh cp1 patronictl list) |
just cluster console <node> |
Tail a node’s serial console |
just cluster crash <node> |
Hard-kill a VM to test failover |
just cluster start <node> |
Boot a stopped VM |
just cluster down |
Power off VMs, keeping state |
just cluster destroy |
Power off and wipe all state |
just ctl <args> runs anastroctl from source pre-wired to the VM cluster’s client file and
config repo:
just ctl whoami # this computer is enrolled as first adminjust ctl node servicesjust ctl cluster apply --dry-runjust ctl cluster backup statusjust ctl account device listPorts and addresses
Section titled “Ports and addresses”Nodes are numbered alphabetically (cp1 → 1, etc.). Node n gets 192.168.1.n on the private VM
subnet (192.168.1.0/24) and maps to localhost as:
| Localhost port | Target on node n |
|---|---|
127.0.0.1:844n TCP |
apid HTTP (/healthz, /api/docs, UI) |
127.0.0.1:745n UDP |
iroh endpoint |
127.0.0.1:222n TCP |
Passwordless root SSH |
In ha mode, each node runs its relay on 192.168.1.n:3340. Your Mac talks to VMs directly; the
ha NixOS VM test exercises relay-only connections.
How up works
Section titled “How up works”- Cross-compiles
anastrodandanastroctl(*-linux-muslviacargo zigbuild) into.data/dev(mounted inside every VM at/anastro-dev), copyingweb/distif built. Only edits undernix/rebuild VM images. - Seeds each node’s initial config with
ANASTRO_CONFIG_SEED(later updates go throughjust ctl cluster apply), enrolls your computer’s device key as first admin, writes.data/cluster/anastroconfig.toml, and unseals nodes fromsecrets.ageusingnix/dev/age.key.
When adding new secrets to a dev cluster config:
cargo run -p anastroctl -- --identity nix/dev/age.key -C nix/clusters/<name> cluster bundle set <path>just ctl cluster unseal --identity nix/dev/age.key -C nix/clusters/<name>State lives in .data/cluster and .data/dev.
KVM cluster (just kvm-cluster)
Section titled “KVM cluster (just kvm-cluster)”Requires Docker with /dev/kvm (on macOS, Colima with vmType: vz and
nestedVirtualization: true) plus an aarch64-linux Nix builder.
just kvm-cluster up # build, boot cp1..cp3, unseal (or restart stopped nodes)just kvm-cluster ui # open web UI signed in as your computer| Command | Action |
|---|---|
just kvm-cluster up |
Build binaries, UI, and node system; boot and unseal cp1–cp3 |
just kvm-cluster status |
Node status and apid health |
just kvm-cluster ui |
Launch anastroctl ui against the KVM cluster |
just kvm-cluster dev |
Vite HMR on http://localhost:7482 against a node’s apid |
just kvm-cluster ctl <args> |
Run anastroctl against the cluster (e.g. ctl cluster host list) |
just kvm-cluster deploy |
Rebuild anastrod, anastroctl, web/dist, and sidecar; restart services without stopping machines |
just kvm-cluster shell <node> [cmd] |
Root shell or command inside a node container |
just kvm-cluster crash <node> / start <node> |
Hard-kill or start a container |
just kvm-cluster down / destroy |
Stop containers (keeping volumes) or wipe everything including .data/kvm-cluster |
Because Colima forwards TCP but not UDP, anastroctl reaches each node via its relay on
127.0.0.1:335n (apid HTTP is on 127.0.0.1:845n).
State lives in .data/kvm-cluster and Docker volumes (anastro-kvm-nix plus one /var/lib volume
per node). Re-running up after changes under nix/ updates the system while preserving state;
config updates to a running cluster go through just kvm-cluster ctl cluster apply. Each node fits
one default-sized machine (4 GiB RAM, 20 GiB disk). Because containers share Colima’s kernel,
Patroni’s hardware watchdog is disabled here.