aboutsummaryrefslogtreecommitdiffstats
path: root/README.md
diff options
context:
space:
mode:
Diffstat (limited to 'README.md')
-rw-r--r--README.md26
1 files changed, 26 insertions, 0 deletions
diff --git a/README.md b/README.md
index 3210c9e..10fceb1 100644
--- a/README.md
+++ b/README.md
@@ -124,6 +124,31 @@ from the store, so either can be kept or thrown away):
./result/bin/run-firecracker-vm --home ~/fc-home.img [--home-size 50G]
```
+For a faster development loop, a guest with nix can switch to a new
+build of its system without a reboot, with `layers/switch.nix` imported
+into a layer. Build the system with the same arguments as the guest,
+and switch to it:
+
+```sh
+sys=$(nix-build --no-out-link pkgs/run-firecracker-vm -A toplevel --arg layers '[ layers/nix.nix ./my-service.nix ]')
+ssh root@VM $sys/bin/switch-to-configuration test
+```
+
+The guest reads the new system from the host's store until it reboots.
+It's no longer what it booted, so for production, reboot it with the new
+run script instead. The kernel, its command line, Firecracker's
+configuration, new secrets, and adding or removing layers need a reboot
+anyway.
+
+A store path that the guest looked for before the host had it (say, a
+switch to a system that was still being built) stays missing in the
+guest's store, as the overlay remembers that it wasn't there, until the
+guest drops its caches (which takes seconds), as root:
+
+```sh
+echo 2 > /proc/sys/vm/drop_caches
+```
+
A layer that keeps its state in `/home` can make that disk mandatory,
so the state doesn't silently end up on the tmpfs:
@@ -299,6 +324,7 @@ the list its own VM uses.
- `base/systemd.nix`: a slimmer systemd, for `base`.
- `layers/nix.nix`: nix, as a layer.
- `layers/console.nix`: a shell on the serial console, to import into a layer.
+- `layers/switch.nix`: switching a running guest, to import into a layer.
- `modules/host/default.nix`: the host's side: network, DHCP/DNS, egress
proxy, `fc-egress`.
- `modules/host/egress.lua`: the egress policy, for the proxy (OpenResty).