Files and directories
Where cairn keeps things, both in your home directory and on the host. You never need to edit these files. Use cairn's commands instead.
Your files: ~/.cairn
Everything cairn keeps for you lives in ~/.cairn, owned by you. Each user has their own.
~/.cairn/
apps/<app>/ one directory per app
app.json the app's current VM, network, published ports, and any hold
deploy.json only while a deploy is unfinished: how far it got
machines/<id>/ one directory per VM: its disks and logs (see below)
records/ cairn's records about each VM
sync/ for cairn run apps: the sync's record, report and log
volumes/<app>/ persistent volumes: <id>.ext4 and <id>.json for each one
networks/<name>.toml each network's definition
kernels/ the pinned kernel, and any custom kernels you deployed
templates/ cached disks that cairn run copies from
providers optional: your cairn run agent aliases
build/ scratch space for building images
run/ runtime state, rebuilt after a rebootInside a VM's directory
~/.cairn/apps/<app>/machines/<id>/ holds only what Firecracker needs:
| File | What it is |
|---|---|
rootfs.ext4 | The root disk, built from the image. |
config.ext4 | A small disk telling the VM what to run. |
vm.json | Firecracker's configuration. |
console.log | Everything the VM printed, including your app's output. |
firecracker.log | Firecracker's own log. |
volume-<name>.ext4 | A link to each volume the VM uses. |
Rules
~/.cairnmust be on a real disk, not a RAM-backed tmpfs.build/,apps/andvolumes/must be on the same filesystem, because cairn moves files between them, and links volumes into each VM's directory, rather than copying them.- Don't edit the records by hand. Every record is written so that a reader sees either the whole old version or the whole new one, never half of each.
run/is temporary. It's out of date after a reboot, and cairn rebuilds what it needs.
cairn doctor checks the first two rules.
The systemd units for apps that start at boot aren't in ~/.cairn. They're in your systemd user unit directory (~/.config/systemd/user by default), and each has an X-CairnHome= line naming the home it belongs to.
The full layout
~/.cairn/
apps/<app>/
app.json the app's current machine, its network membership, the
ports it publishes, and any hold on starting it
deploy.json only while a deploy or its cleanup is unfinished: the
attempt's state, which the next command settles
launch.json the machine and token of the latest launch attempt,
which the network's agent checks before it attaches
records/<id>.json the machine's record: pid, start time, boot id
records/<id>.spec.json the machine's spec (including its kernel digest)
records/<id>.run.json liveness and health the supervisor renews
records/<id>.supervisor.log what the supervisor said
records/<id>.control.json a pause or resume request, until the supervisor
answers it in the run file
machines/<id>/ only what the VMM needs: rootfs.ext4 (root disk), config.ext4
(config drive), vm.json, console.log, firecracker.log,
and volume-<name>.ext4 (hard link to a volume)
sync/ for `cairn run` apps: the sync's baseline, report, log, journal
volumes/<app>/ persistent volumes: <id>.ext4 and <id>.json per volume
networks/<name>.toml the network's definition (desired state); its members
are the apps whose app.json names it
kernels/ the pinned kernel and custom imports (see kernels.md)
templates/ cached root disks that `cairn run` clones from
providers optional: your [run] aliases (see run.md)
build/ scratch space for image builds
run/ runtime state, safe to lose after a reboot
net/<name>/ a network's agent: agent.sock, agent.lock, pending.json,
agent.log, egress.log
net/<name>.lock
deploy/ per-app and per-network deploy locks
supervise/<app>/ per-machine supervisor locks
volumes/<app>/ per-volume locks (the state is in volumes/<app>/<id>.json)
cairn-run/ `cairn run`: folder leases (roots.lock, roots/, folders/), and
apps/<app>/ with session.lock, sync.lock and session.sockWhy records/ is separate from machines/<id>/. A jailed Firecracker can write to its own machine directory, so cairn treats everything in it as untrusted. The records that decide which process cairn stop signals live in records/, out of Firecracker's reach.
Host-wide files
These belong to root, not to any user:
| Path | Owner | Contents |
|---|---|---|
/etc/cairn/net.conf, /etc/cairn/vmm.conf | root | The host's policy files. See Host admin. |
/var/lib/cairn/ | root | cairn's host state (mode 0755). |
/var/lib/cairn/net/ | cairn-helper (0700) | The network helper's record of every network and port, and the maintenance lock. |
/var/lib/cairn/vmm/ | root (0700) | The jails the VMs run in. |
/usr/libexec/cairn/ | root | cairn-helper, cairn-jail, cairn-netd, the jailer and Firecracker. |
See Architecture and Security for what each program does.