Concepts
The vocabulary cairn uses, and how the pieces relate. Read it once after getting started; the other pages assume it.
The picture
cairn.toml + image
| cairn deploy
v
+--------------- app "web" ($CAIRN_HOME/apps/web) -----------------+
| current release ----> machine 7K2... (a Firecracker microVM) |
| previous release - root disk, config disk |
| - console.log, firecracker.log |
| - supervisor (one per running VM) |
+---------+--------------------------+-----------------------------+
| joins | mounts
v v
network "web" volume "data"
(subnet, NAT, DNS, (survives redeploys)
egress allowlist)
|
v
published port: host 127.0.0.1:8080 --> guest port 80App
An app is a name (app = "web" in cairn.toml) and everything cairn keeps for it under $CAIRN_HOME/apps/<name>: its machines, its current release, its saved settings. You deploy, start, stop and destroy apps by name. App names are checked: a name the rule refuses is a usage error.
Machine
A machine is one microVM: a Firecracker process with its own kernel, a root disk built from the image, and a small config disk that tells the guest what to run. Each machine has a ten-character id (for example UY5DURWY3K). Its directory holds console.log (the guest's serial console, where your app's output appears), firecracker.log, and the records cairn uses to know what is true about it.
An app has one current machine. cairn ps shows each app's current machine and, while a deploy rolls back, its new machine. It lists only machines the records name; cairn doctor reports a Firecracker process of yours that no record names. cairn ps --apps shows one row per app.
The guest runs cairn-init as its first process. It mounts things, starts your workload, runs health checks, serves exec and console, and reports the workload's exit.
Release and deployment
A deploy builds a new machine while the old one runs, then stops the old one and starts the new one in its place: an app has one machine at a time. If the new machine never becomes ready, the deploy rolls back: the previous machine is the current one again and is started again. A release is therefore "the machine the app currently points at", and a rollback is pointing back at the previous machine and starting it.
A deploy writes its progress to apps/<app>/deploy.json before each step (building, stopping, starting, accepted, rolling-back) and removes it at the end. If the deploy is killed, the next cairn deploy, start, stop or destroy of the app settles it from that record: it deletes a new machine that never ran, rolls back one that was starting, or finishes an accepted one's cleanup. Settling never starts a machine, so after a deploy killed while it was stopping the old machine or starting the new one, the app stays down until cairn start or a new deploy (after a power loss too, once the new machine had been made current). Details: lifecycle.
Image and kernel
The workload comes from an OCI image, either pulled (image = "...") or built from a Dockerfile ([build]) with podman or docker. The VM boots a guest kernel that is not part of the image. By default that is the pinned 6.1.155, stored under $CAIRN_HOME/kernels/. See kernels.
Network
Every app joins a network, by default one of its own with the app's name. A network is a private subnet (10.100.0.0/24 style) with NAT to the host's uplink, a DNS setting and an optional egress allowlist. Apps that join the same named network reach each other as <app>.internal; see networking. Networks are separate objects: cairn destroy leaves the app's network defined, and cairn net manages them. Stopped apps that own their network release it automatically, which keeps you under the per-user network limit. See networking.
Published port
A [[services.ports]] entry forwards a host port to a guest port. By default it listens on 127.0.0.1 only; set bind = "0.0.0.0" or a host address to expose it. A guest cannot reach a published port through the host's address, not even its own app's. That is deliberate: published ports are for clients outside.
Volume
A volume is a persistent disk (an ext4 file) mounted into the guest at a path you choose. It belongs to the app, survives redeploys, and is kept when you destroy the app unless you pass --volumes. See volumes.
Launcher: systemd or direct
The launcher decides what starts the machine's supervisor.
- systemd: a unit in your user manager. This is the default when a user manager is available, and the only way a machine can start at boot (with linger on).
- direct: cairn starts the supervisor itself, outside systemd.
cairn deploy --launcher auto|systemd|direct picks; auto keeps the saved choice (and uses systemd on a first deploy when it can).
Supervisor
Each running machine has one supervisor process. It starts Firecracker inside the jail, watches the guest, applies the restart policy (on-failure by default, with backoff), records state changes (a pause included) in its run file, and runs the stop sequence. cairn ps and cairn status read the records first, then check whether the supervisor and the VMM they name are still alive, and the VMM's process state and cgroup freezer. They do not call the VMM or systemd. The full table is in lifecycle:
| State | Meaning |
|---|---|
running | The VM and workload are up. |
starting, stopping, restarting | A transition is in progress. |
paused / frozen | Paused with cairn pause, or its VMM stopped by a signal or a frozen cgroup. |
stopped | Stopped on purpose. |
exited | The workload ended and the policy did not restart it. |
crashed, failed | It died unexpectedly, or could not start. |
unsupervised, unknown | Nothing is watching the VMM, or cairn cannot tell. |
none | The app exists but has no machine yet. |
CAIRN_HOME
Everything of yours lives under $CAIRN_HOME, ~/.cairn by default: apps/, machines/, networks/, volumes/, kernels/, images/, build/, run/, providers/. It must be on a real disk (not tmpfs) and build/, apps/ and volumes/ must share one filesystem, because cairn renames rather than copies. cairn doctor checks both. The layout is in configuration.
The jail
Firecracker never runs as you directly. A small setuid program, cairn-jail, starts it through Firecracker's jailer: a chroot, its own namespaces, a throwaway uid, and seccomp. The jail is on by default (--jail require). The jail root is /var/lib/cairn/vmm, owned by root, which is why a directory writable by group or others above it is refused. Other privileged helpers configure networking: cairn-helper (a setuid service account with network capability) and cairn-netd (one user namespace per network). The cairn group decides who may call them. The trade-offs are in security, the processes in architecture.
cairn run apps
cairn run makes an ordinary app named run-<agent>-<folder>-<suffix> for an agent working on a local folder. It is an app like any other, with extra syncing rules. See run.