The Immutable Hypervisor Pattern
Solène's seven-month rebuild targets one failure mode: risk accumulation in mutable state. A laptop with 16 GB RAM, NVMe SSD, and an ethernet port runs Incus OS...
The Immutable Hypervisor Pattern
Solène's seven-month rebuild targets one failure mode: risk accumulation in mutable state. A laptop with 16 GB RAM, NVMe SSD, and an ethernet port runs Incus OS—a thin disk image that does nothing but host Incus instances and VMs. Twenty Ubuntu system containers sit on top, each running a podman workload defined by quadlets (systemd units wrapping container images). Two dedicated VMs hold the highest-value data.
What matters isn't the stack but the boundaries. The hypervisor kernel is immutable; the instances are mutable; the runtime processes inside them are more mutable still. Each boundary defines a blast radius, and each layer enforces a different property. That triptych—immutability, isolation, automation—transfers to any self-hosted deployment that must survive compromise.
Immutable Infrastructure as Risk Elimination
Traditional servers accumulate configuration drift: packages upgraded ad hoc, daemons modified in place, config files hand-edited until `last reboot` becomes a guessing game. Solène flips the script with Incus OS, a read-only root filesystem where the only writable paths are `/var/lib/incus` (instance storage) and minimal ephemeral mounts. You don't SSH into the host and poke around; you can't. The attack surface is tiny:
- No interactive shell on the host unless explicitly enabled via console access
- No package manager (`apt`, `apk`, `dnf`) running atop the base image
- No cron jobs scheduled directly on the hardware—only in instances
That matches what enterprise teams get from Terraform plus immutable AMIs, with fewer moving parts. When an instance is compromised, you don't clean it—you destroy it and recreate from a known-good template. EC2 treats instances as cattle; here, the whole farm is cattle.
"This is a personal infrastructure running on a single machine at home, and it is probably totally overengineered for most people. If you just want to host a Nextcloud for your family, a lot of what follows is not needed."
But "overengineering" becomes under-engineering when recovery cost exceeds prevention cost. A machine that rebuilds from scratch in under an hour is more resilient than a cluster that needs runbook-based restoration.
Two Layers of Containerization: LXC vs Podman
The architecture stacks two orthogonal isolation boundaries. Layer 1 is LXC via Incus: kernel namespaces, cgroups, and seccomp. Layer 2 is Podman: rootless containers managed by systemd quadlets inside each LXC instance. This isn't redundancy; it's defense-in-depth with different failure domains.
Why both? LXC isolates at the host level—device passthrough, network virtualization, snapshots across all workloads. Podman isolates at the application level—rootless user namespaces, private `/tmp`, per-container volumes. An LXC boundary stops one service from reading another's memory; a Podman boundary stops a compromised app binary from escalating to the host kernel.
# Quadlet for a service inside an LXC instance
# /etc/containers/systemd/[email protected]
[Service]
Environment=PODMAN_SYSTEMD_UNIT=%n
ExecStart=/usr/bin/podman start postgres
ExecStop=/usr/bin/podman stop postgres
Restart=on-failure
[Install]
WantedBy=multi-user.target
# /etc/containers/systemd/[email protected]
[image]
Image=docker.io/library/postgres:17-alpine
Volume=postgres_data:/var/lib/postgresql/data
Port=5432:5432
Network=incus-net-private
The topology mirrors Kubernetes—a pod is one LXC, the containers inside are the workloads—without etcd, CNI plugins, or control-plane loops. Just `incus launch ubuntu://24.04`, `incus init`, `systemctl enable --now`. At homelab scale that trade hits the sweet spot.
Applying browser-port decomposition principles explains the gain: each LXC is owned by one service owner, each Podman container by its upstream maintainer, so a failure in one ownership layer doesn't require knowledge of the other.
Networking as a Multi-Zone Policy Engine
Instead of "allow everything," Solène defines three egress domains:
- Outgoing traffic: most containers reach the internet for updates and upstream APIs, scoped per-instance with `incus network add-profile` rules—no global firewall.
- Incoming public traffic: only public services get external addresses. Everything else sits behind a NAT gateway configured through `incus profile edit`, mirroring VPC public-subnet versus private-subnet design at the virtual switch.
- Private access through VPN: admin panels, database ports, and CI runners route through a WireGuard tunnel terminating on a bastion instance. Nothing is exposed from outside.
# Incus network profile for the private subnet
config:
ipv4.address: 10.100.0.1/24
ipv4.nat: true
ipv6.address: auto
description: Private network for backend services
devices:
eth0:
name: eth0
network: priv-net
type: nic
type: custom
This is Zero Trust applied at the segment level: nothing is trusted by default, each instance gets a static address via DHCP reservation, and firewall policy lives once in profile YAML instead of scattered across twenty hosts. Public services terminate at a reverse proxy routing by hostname, while internal names like `forgejo.home` resolve to `10.100.0.5` through a dnsmasq instance in its own LXC.
Secrets Management Without External Dependencies
The usual move is Vault or SOPS. Solène treats the host as the vault instead. Because Incus OS is immutable, the only writable path holding secrets is under `/var/lib/incus/projects/
"The secrets themselves live in encrypted volumes that are decrypted at boot time via a passphrase stored in a FIDO2 key."
That is a deliberate scope reduction: no separate secrets server with its own HA and backup obligations, and no automatic reboot of a sensitive instance without physical presence or WebAuthn. Availability loses to control—the correct trade for a homelab. The production analogue is HSM-backed key rotation, where a hardware token replaces the human and API keys replace the passphrase, but the principle holds: keep secrets next to the decryptor and make decryption expensive.
Automatic Updates and the Self-Healing Pipeline
Patching happens at two levels: Incus OS checks for releases weekly and applies them after a grace period, while each LXC runs a daily in-container upgrade and reports failures to a webhook that reaches Solène's Mastodon.
# Cron job inside each Ubuntu container
0 3 * * 1-5 root /usr/bin/apt-get update && /usr/bin/apt-get upgrade -y && /usr/bin/mail -s "Update Report" [email protected] <<EOF
$(cat /var/log/apt/history.log)
EOF
Failure handling is the interesting part: if a container fails to boot after an update, the snapshot system rolls it back within five minutes. That is a five-minute recovery bound enforced by tooling rather than by discipline, which is the only kind that survives contact with real schedules.
Key insight: automation doesn't mean "set and forget". Major version jumps (24.04 to 26.04) still get human review. Minor patches are delegated because false negatives are cheap and the reward of prompt security fixes is high.
Backup Strategy: Incremental Snapshots + Offsite Replication
Backups are baked into the lifecycle, not bolted on. Every LXC gets hourly snapshots retained 24 hours, daily retained 7 days, weekly retained 3 months, pushed offsite over `rsync`.
# Snapshot schedule on the Incus OS host
0 * * * * /usr/local/bin/incus-snapshot.sh --hourly --keep 24
0 0 * * 0 /usr/local/bin/incus-snapshot.sh --daily --keep 7
0 0 1 * * /usr/local/bin/incus-snapshot.sh --weekly --keep 90
ZFS does this natively through `send/receive`; the bash wrapper exists because Solène wants to see exactly what gets deleted and why. Retention is policy expressed as code—the `--keep` counts are the whole contract.
The offsite target is a headless OpenBSD Raspberry Pi with pubkey-only SSH and chroot jails. No shell, no sudo, only file transfer, so compromising the backup host yields nothing to pivot from. This is the same lesson as succession engineering: replicate the thing that cannot be regenerated, or a single failure becomes total loss.
Monitoring and Logging: Centralized Telemetry
A Loki plus Promtail stack in its own LXC receives logs over UDP from every container, while `node_exporter` on each instance feeds a Grafana dashboard showing uptime, CPU pressure, memory, and network throughput.
# Promtail scrape config
scrape_configs:
- job_name: 'incus-containers'
static_configs:
- targets:
- localhost:9090
labels:
job: 'container-logs'
__path__: '/var/log/incus/*.log'
Scalability is traded for simplicity: no Elasticsearch cluster, no alert pipeline. Queries are bounded to 1h, 24h, and 7d buckets, and retention reacts to disk pressure—at 80% of `/var/log`, old entries rotate to the backup volume. Alerts cover three modes with tuned thresholds:
- container restarts above 3/hour → crash loop
- disk write latency above 50 ms → storage contention
- ingress/egress ratio above 10:1 → possible exfiltration
Pages arrive as a Telegram webhook carrying a summary and a link to the Grafana panel, which is the whole on-call story for a one-person operation.
Security Model: Confidentiality, Integrity, Availability
Solène frames the model on the classic triad:
- Confidentiality: LUKS-encrypted volumes at rest, TLS everywhere with Let's Encrypt ACME validation for issuance.
- Integrity: read-only host rootfs, signed OCI manifests, and hooks that validate image hashes before an instance launches.
- Availability: automated backups, a second Incus node when CPU or RAM runs out, and quarterly drills that wipe the host and restore from backup.
# Image signature verification hook
#!/bin/bash
IMAGE_HASH=$1
EXPECTED_HASH=$(cat /var/lib/incus/signatures/${IMAGE_NAME}.sha256)
if [ "$IMAGE_HASH" != "$EXPECTED_HASH" ]; then
echo "ERROR: Image signature mismatch!" >&2
exit 1
fi
This is the OIDC artifact-attestation pattern moved to the launch path: an artifact must match a pre-approved hash or it does not start. Availability testing is equally concrete—deliberately kill the logging container and a database instance, then measure whether the cluster returns to service inside the five-minute target.
Challenges and the Costs That Stay
Solène lists three pain points: 16 GB RAM isn't enough for 20+ containers plus two VMs (mitigated with cgroup memory limits and resource quotas); hourly snapshots consume ~2 TB of storage after three months (mitigated with ZFS block sharing and weekly offsite rotation); and managing 20 separate systemd units plus Incus profiles is tedious (mitigated with Ansible generating `incus.yaml` from templates).
"I learned a lot along the way, especially about containers and cloud-init, and I am very happy with the result :)"
These mirror what large-scale distributed systems face: resource contention, storage efficiency, and operational toil. The difference is that here, the solutions are lightweight and tailored to the scale. No service mesh, no Istio sidecars, just careful tuning of existing primitives.
#!/bin/bash
# Query every instance, report failures, never assume health from `up`
for instance in $(incus list --format json | jq -r '.[].name'); do
echo "Checking $instance..."
incus exec "$instance" -- pg_isready -U postgres || echo "Database unhealthy!"
done
The four principles that survive translation to any toolchain: immutable infrastructure eliminates drift, defense-in-depth spans hypervisor to runtime to app, automation reduces cognitive load without removing oversight, and every layer must be independently recoverable because the boundary defines the blast radius. For a first self-hosted cluster, start with one Incus instance, one Podman service, one backup routine—then grow incrementally instead of building "production-grade" on day one.