← Back to all notes

2026-12-03 · 5 min

Why I Built a 30-Test Automated Quality Gate (pytest + testinfra) for My Own Homelab

Infrastructure as CodeAnsiblepytestZero-TrustData Engineering

Avoiding the "artisanal server" trap

Anyone operating production data platforms knows the artisanal server anti-pattern: manual package installs, ad-hoc firewall tweaks, untracked containers, and six months later nobody can reproduce the stack cleanly.

When building my personal lab for Data Engineering, Automation, and Local Applied GenAI, I treated it with the exact same architectural rigor expected in enterprise environments — locking down the foundation before deploying workloads.

Architecture decisions backed by ADRs

Every layer was designed incrementally with an explicit Definition of Done and versioned Architecture Decision Records (ADRs):

  1. Isolation by default: dedicated virtual network (KVM/libvirt + cloud-init), zero router port-forwarding, and private Let's Encrypt HTTPS over a WireGuard mesh VPN (Tailscale + Caddy).
  2. Idempotent automation: OS hardening (key-only SSH, UFW default deny), Docker Engine with log rotation and isolated address pools, reverse proxy, backups, and workloads are managed by Ansible roles required to converge with changed=0.
  3. Strict container boundaries: every core image uses pinned semantic tags (never :latest), and published ports bind strictly to 127.0.0.1 to prevent Docker's iptables rules from bypassing host firewall policies.
  4. Backups only count after a real restore: client-side encrypted restic snapshots using least-privilege OAuth (drive.file), consistent logical pg_dumpall dumps before snapshots, live Telegram failure alerts, and an end-to-end restore verified byte-for-byte with SHA-256.

The differentiator: executable verification

Drawing from my background in Software Engineering and test automation, I built a deterministic Python (pytest + testinfra) test suite across three layers:

Next step: Data + Applied GenAI + Graphs

With a verified foundation in place, the workload tier now runs PostgreSQL 17 + pgvector and n8n, powering local-first data pipelines for job market analytics, skill co-occurrence graphs, and on-demand GPU LLM experiments.

Reliable infrastructure is never accidental — it comes from explicit contracts, idempotent automation, and continuous verification.