Machines
A runy daemon owns one host. A machine is another runy daemon that yours, the hub, links to: one running inside a vm, or on a box you reach over ssh. Once linked, runy apply -m sandbox -f x.yaml applies resources there, runy ps lists the machine’s resources, and the console shows its workspaces, journals and actions. Both talk to the machine’s own daemon through a tunnel the hub opens on its link.
The remote daemon keeps its own resource files and applied documents. The hub does not sync documents to it; you address calls to it.
A machine is a one-way link from a hub to a daemon it drives. To reach another box’s published domains from your own proxy instead, pair the daemons in a mesh.
Declaring a machine
Section titled “Declaring a machine”Two kinds declare one:
kind: vmname: sandboxspec: driver: smolvm image: debian:bookworm-slim net: true workdir: /work/app daemon: true---kind: agentname: build-boxspec: workspaces: [~/src/app]A vm with daemon: true names the machine after the VM’s machine name (acme-sandbox). An agent names it spec.name, by default the resource’s name (build-box). A name held by another resource is an Error on the second one. A vm created from a pack is a machine of its own: it links under its own name and routes its own ports, whatever machine it was packed from.
The bridge
Section titled “The bridge”The hub runs a child process whose stdio is a byte stream to runy daemon bridge on the remote: the driver’s stdio exec for a VM (smolvm machine exec -i for smolvm), ssh -T for a box. The bridge makes sure a daemon of its own build runs there (it starts one, or upgrades it in place, like any CLI call), prints a banner with its version and then the hub talks gRPC to the remote daemon over that stream. The versions must be equal, otherwise the machine is incompatible. When the stream breaks the machine is disconnected and the hub reconnects, waiting 1 second at first and up to 30 seconds between tries.
The remote can call back three things only: a greeting that answers the hub’s version and host label, the value of a secret the machine’s vm grants with resource: true, and a request through the hub’s gateway for a secret the vm grants with proxy: true (an agent is granted none). The bridge keeps a Unix socket for this on the remote, hub.sock in the daemon’s cache folder (mode 0600, removed when the bridge exits). The hub serves only those calls there, never its own API, so nothing on the box can run runy apply or ps against the hub. The daemon on the box asks for a secret through it, and its proxy carries the gateway’s requests through it; any root process on the box can open the socket too.
| state | meaning |
|---|---|
connecting |
the link is being set up or provisioned |
connected |
the remote answers |
disconnected |
the stream ended; the reason is the bridge’s last stderr lines |
incompatible |
the remote’s runy is another version than the hub’s |
The remote follows the hub
Section titled “The remote follows the hub”The hub keeps the runy binary in a machine equal to its own. When the hub is upgraded in place, or a daemon starts cold and finds the machine already running, and the binary installed there differs from the one the hub resolves for the machine, the hub copies the new one in and links again; the new bridge, run from that binary, upgrades the remote daemon in place. A vm machine is not restarted and its create hooks do not run, and the processes the remote daemon runs keep running. An agent box gets the binary over ssh before the first bridge. The journal of the resource that declares the machine says runy in the machine: <old sha> → <new sha>; relinking. A failed copy or upload makes that resource Error and the link goes on with the binary that is there.
A vm prepares the machine in a fixed order before it links: the binary, the hooks.create, the hooks.start, the ssh keys and sshd, then the link. See start hooks.
Remote workspaces
Section titled “Remote workspaces”On every connect the hub registers each path of the resource’s workspaces on the remote. The remote resolves the root like the CLI does (the nearest .runy.* file upward, else the path itself) and names it <folder>-<hash>. The first path is the machine’s default workspace: a call with -m and no -w goes there. A vm’s paths default to its workdir. Without any, -m needs -w <name>:
machine sandbox has no default workspace; pass -w <name>Addressing a machine
Section titled “Addressing a machine”-m <machine> and -w <workspace> on apply, delete, get, start, stop, signal, ns, load, unload, sources and ps send the call to the machine’s daemon:
runy apply -m acme-sandbox -n demo -f service.yaml --enabledruny get -m acme-sandbox demo/process/apiruny ns disable -m acme-sandbox demoThe CLI asks its own daemon, the hub, for a tunnel to the machine’s API and runs the call over it, so the request is the one the machine’s daemon would get from a CLI running inside the machine. The tunnel goes through the hub’s API port, so it works when the hub’s proxy is not listening.
With -m the current directory is not consulted, as it is not a path on the machine: apply puts documents without namespace: at the top level unless -n is given, and load and unload take paths on the machine as given. A call that cannot reach the machine fails with exit code 1 and a message naming it:
| cause | message |
|---|---|
| no such machine | no machine named `x` |
| no such machine on that host | no machine named `x` on host `mini` |
| no such host | no daemon has the host label `h` |
| two computers hold one | machine x is held by more than one daemon: laptop (mesh peer l), mini (mesh peer m); pass --host <label> |
| the link is down | machine x: disconnected (<reason>) |
| another runy version | machine x: incompatible: <detail> |
| the link drops during the call | machine x: <error> |
A machine held by a mesh peer can be addressed from the other computer too, by the same name: -m reaches it through the peer, and without -w the CLI asks that peer for the machine’s default workspace. When two computers of the mesh each hold a machine of that name, add the holder’s host label:
runy get -m sandbox --host mini demo/process/apiA machine your daemon holds wins over a peer’s of the same name. --host alone sends the call to the peer’s own daemon rather than one of its machines (runy ns --host mini -w umka-2hx049km).
runy ps lists the hub’s resources, then asks each connected machine for its own and lists them with the machine in the workspace column (acme-sandbox:app-9xk2p), followed by a table of the machines. A machine that does not answer within 5 seconds gets one line on stderr, <machine>: no answer in 5s, and the rest is listed. runy ps --host mini does the same for the mesh peer mini, and runy ps -m <machine> lists one machine, yours or a peer’s. See the CLI reference.
Machine routes
Section titled “Machine routes”The hub’s proxy can serve the ports a machine runs, through the link it already holds. The machine’s daemon announces its running port resources and the hub names them, so no host port and no ports: mapping is needed:
| route | full name |
|---|---|
| a port in a namespace | <port>.<namespace>.<workspace>.<machine>.<host>.runy.localhost |
| a top-level port | <port>.<workspace>.<machine>.<host>.runy.localhost |
| sshd | ssh.<machine>.<host>.runy.localhost |
| the machine’s daemon API | api.<machine>.<host>.runy.localhost |
<machine> is the machine’s name, <host> the hub’s host label (mini), and <workspace> the full name of the machine’s workspace that runs the port (umka-2hx049km), so two workspaces of one machine can run the same port. The full name always works, on the hub and on its mesh peers. Every name also has a short form without <host> (app.notes.umka-2hx049km.sandbox.runy.localhost, ssh.sandbox.runy.localhost, api.sandbox.runy.localhost): a local route wins it, and when two daemons of a mesh hold a machine of the same name the other peers route only the full names. A port also has a shorter name with the workspace’s folder, with and without <host> (app.notes.umka.sandbox.runy.localhost), when no other workspace of the machine has that folder or is named like it. When two workspaces share a folder, neither gets the folder name and the declaring resource’s journal says so. Every name works, and the status and the console show the shortest one that is routed.
A machine may not be named like the hub’s host label or a mesh peer’s, since px0.umka.<machine>.runy.localhost and the hub’s own px0.umka.<host>.runy.localhost have one shape: the declaring resource is Error with a message naming the clash. The routes key of the vm or agent that declares the machine selects the ports: absent or true routes all, false routes none, and a list of <namespace>/<port> globs routes the matching ones (_ is the top level). A vm without daemon: true routes nothing. Changing routes keeps the machine and the link. sshd is routed for a vm with ssh and daemon: true whatever routes says.
The machine’s daemon API is routed for every linked machine, whatever routes and ssh say, while its link is connected. The bridge connects it to the address it reaches its own daemon at (127.0.0.1:4122 unless the machine’s daemon uses another port), never to one the machine announces. gRPC-Web, streaming calls included, passes through it, and the machine’s daemon answers browsers only for the consoles’ origins, as every daemon does. The pages a machine serves are not consoles: no daemon accepts a name routed into a machine as an origin, so a page of the machine’s ports cannot call your daemon’s API. On a mesh peer of the hub the same machine is api.<machine>.<hub host>.runy.localhost.
For each connection the hub opens a stream on the link and names an announced port; the bridge in the machine connects 127.0.0.1:<port> there, so a server listening on the machine’s loopback works. The hub never sends a port number.
The machine is treated as untrusted input, since anyone with root in it can replace its runy binary. The hub builds every name from parts it checks to be single lowercase DNS labels and skips an entry that fails, loses its name to a local route or to another machine, or is a top-level port called ssh, with one warning in the declaring resource’s journal. A machine that announces more than 256 ports routes none of them and the declaring resource is Error. At most 64 tunnels are open into one machine; a new one waits up to 10 seconds for a slot, then the request is a 502.
A machine that is not connected has no routes. The daemon inside a machine runs with the mesh off; a hub that is paired with peers announces its machine routes to them as its own.
In the console
Section titled “In the console”The console lists each machine in its Machines section under the host that holds it. Selecting one shows the machine’s workspaces with their namespaces and resources, read from the machine’s own daemon at api.<machine>.<host>.runy.localhost, and switches, menus, journals and metrics run on that daemon. A machine’s pages are at /~<machine>/workspace/<workspace>/.... Each routed HTTP name is a link.
The journals of what runs inside stay on the remote: open a resource under the machine to read its Output. The Output of the vm or agent resource that declares the machine has only that resource’s own lines: its lifecycle, hooks, the link and the bridge’s messages, and for a vm the machine’s console and metrics.
Limits
Section titled “Limits”- One level: a remote’s own machines are not shown on the hub.
- The hub does not manage the remote’s lifecycle beyond the link and the binary. Removing the resource, stopping it or stopping the hub closes the link; the remote daemon keeps running.
Upgrade,Terminateandversioncalls are local only. The hub keeps the remote’s binary current itself.- A box needs the same runy version as the hub. An
agentuploads it; a dev hub can reach a Mac box only through the published release of its version.

