Rehearsal on a copy
How NeoRun tries a risky change on a throwaway copy of your real server, and measures what changed.
Some changes cannot be previewed by reading a plan: installing a package, editing nginx, enabling a service. What they do depends on what is already on the server. So NeoRun does not trust a plan. It runs the change on a throwaway copy of the real server and measures what happened.
Two lanes
Every change NeoRun makes to a server goes through exactly one of two lanes.
| Deploy lane | Infra lane | |
|---|---|---|
| For | Apps NeoRun deployed: new image, config, restart, rollback | Everything else on the server: installing Docker, proxy config, firewall, packages, systemd units, anything NeoRun did not create |
| How | A typed plan, previewed on an isolated network, health-checked, switched, verified, with automatic rollback | A rehearsal on a copy of the live server, the observed change, an approval bound to its hash, then apply exactly that change and verify |
| Gate | Automatic within policy | A person approves, out of band |
A change is deploy lane only if every resource it touches is owned by NeoRun (labelled neorun.managed=true
with this server's id) and every step has an automatic inverse. When in doubt, it is infra lane.
The first deploy to a fresh server is mostly infra lane: Docker, proxy integration, firewall. Every deploy after that should be deploy lane.
How a rehearsal works
The agent opens a rehearsal
The agent calls rehearsal_start with the server and a short description of what it wants. NeoRun boots a
disposable copy of the server. This takes about a minute.
The agent runs commands in it
With rehearsal_exec the agent runs commands one at a time, as it would in a shell, and reads the exit code and
output. A command that fails is a normal result: the agent reads it and tries something else. Nothing it runs
here can touch the real server.
NeoRun measures the change
When the agent is done it calls rehearsal_finish. NeoRun reads the copy and produces the delta: exactly
which files, packages, services and listening ports changed, and a hash of that delta. This is what you approve.
It is NeoRun's own measurement, not the agent's description of what it did.
The agent asks for it to be applied
With request_promotion the agent asks NeoRun to apply that delta and nothing else. See
Approvals. If the agent changes its mind it calls rehearsal_abort, and
nothing from that rehearsal can ever be approved or applied.
What the copy is
The rehearsal runs on your server, not on another machine. It is an overlay on the real filesystem, booted as a container, so it sees the server's actual current state but cannot write to the real disk.
- Files. An overlay (overlayfs) over the live
/. Writes land in the overlay, not on the disk. - Network. Its own network namespace, always. Outbound traffic goes only through a proxy run by NeoRun's probe inside it. The proxy refuses internal and cloud-metadata addresses and logs every request. Anything other than GET or HEAD sent in the clear is refused.
- Kernel. Commands run with the container's capability bounding set and a seccomp filter, never as root on the host.
- Docker. Docker, Compose and published ports work inside the rehearsal. The server's own containers are not started in it.
- Units that act on the outside world (cron, apt timers, cloud-init, k3s) are masked.
This was tested early on: a sandbox that only isolated the filesystem let ufw enable lock the real server's
firewall. That is why the network is always separate.
What NeoRun refuses to rehearse
Some things cannot be rehearsed honestly. NeoRun says "I can't safely rehearse this" and nobody can approve or apply the change, at any safety level:
- The kernel, its modules and boot configuration.
- The server's own network configuration. A rehearsal has its own network.
- Mounts and other configuration that takes effect at reboot.
- Effects on other hosts: a rehearsal that tried to reach a host it may not, or sent anything but GET or HEAD in the clear.
Known gaps
- NeoRun cannot see inside HTTPS. The HTTPS hosts a rehearsal contacted are listed for you to read, not refused.
- The kernel can load a module for the rehearsal, for example a new network device type. This cannot be blocked per container, so NeoRun detects it and reports it with the delta.
Raw commands
Arbitrary commands run only inside a rehearsal. On the real server, NeoRun runs only typed operations or an approved delta. There is no raw shell tool and no raw SQL tool for a real server, ever.