Skip to content

Latest commit

 

History

History
40 lines (30 loc) · 1.44 KB

README.md

File metadata and controls

40 lines (30 loc) · 1.44 KB

microvm

Scripts for running application tests inside Firecracker microVMs instead of containers.

These are developed on macOS but must be run on a Linux host with KVM (/dev/kvm). Copy this directory to that host (scp -r microvm/ user@host:) before running anything.

Usage (on the Linux/KVM host)

scripts/01-install-firecracker.sh      # one-time: installs firecracker + jailer
scripts/02-fetch-image.sh              # one-time: downloads a starter kernel + rootfs
scripts/03-run-vm.sh 1                 # boots microVM #1
ssh -i images/id_rsa root@172.16.1.2   # test your app inside it
scripts/04-stop-vm.sh 1                # tear it down

Each vm_id (1-254) gets its own tap device and 172.16.<vm_id>.0/24 subnet, so multiple microVMs can run concurrently:

scripts/03-run-vm.sh 1
scripts/03-run-vm.sh 2

Layout

  • scripts/ - setup and lifecycle scripts, run in numbered order
  • images/ - downloaded kernel/rootfs/ssh key (gitignored, created by 02-fetch-image.sh)
  • run/ - per-VM runtime state: writable rootfs copy, API socket, logs, pid (gitignored)

Notes

  • The rootfs downloaded by 02-fetch-image.sh is Firecracker's official CI test image (Ubuntu), meant as a quick starting point. Swap in your own rootfs by dropping an images/rootfs.ext4 built for your application.
  • 03-run-vm.sh sets up NAT so the guest has outbound internet access (useful for apt install while iterating on a test image).