Something went wrong. Try again.
forked from tangled.org/core
Something went wrong. Try again.
README.md
# spindle microVM engine
This document describes the architecture of the microvm engine for spindle. In
short it allows the spindle to spin up microvm guests, and implements a guest
[agent protocol](../../agentproto) for communicating with those guests (via the
[shuttle](../../../shuttle) implementation of that proto). It implements some
fairly simple resource budgeting and optionally sets up cgroups for better
enforcing resource limits, and hardens the VM network access. It has Nix cache
integration for any paths built in the VM, those will get pushed to a Nix cache
by the spindle (if one is configured). The runner is abstracted behind an
interface; right now only the QEMU microVM impl is supported, but others (e.g.
firecracker) can slot in later.
Currently two kinds of images are supported:
- NixOS images: these allow configuration such as `dependencies`, `services`,
`virtualisation`, `registry`, `substituters` in the workflow file itself. The guest
agent will build (or if it's cached, spindle will send the store path for
realization) and activate it before any workflow steps are ran.
- Non-NixOS: this is just Alpine & AlmaLinux for now, but can be anything else.
Workflow-level configuration like NixOS aren't supported while using these. If
Nix exists inside the image (like in our Alpine image) it will still be able
to make use of the spindle cache.
(For testing, you can run `bash spindle/engines/microvm/test-spindle-microvm.sh`
from repo root. These test Alpine, AlmaLinux, and NixOS, and features like if Docker
works, public internet is reachable, and so on.)
## Image builds
Image builds right now are done via Nix:
- For NixOS, we use [microvm.nix](https://github.com/microvm-nix/microvm.nix),
and layer our own configs on-top, see [here](../../../nix/microvm).
- For Alpine and AlmaLinux we have a small-ish Nix definition that includes
fetching the kernel, initrd, kernel modules; setting up the init system that
configures the VM proper; copying dependencies (like `nix` or `git`) into a
…