NixOS/clan distributed-server spike (3 nodes + edge)
  • TypeScript 48.7%
  • Nix 40.5%
  • Shell 10.8%
Find a file
2026-11-22 08:05:16 -10:00
.claude/commands cloud: AUTOMATIC failover via Caddy lb_policy first + health checks (remove manual pin) 2026-07-22 22:30:37 -10:00
machines Consume the community library as a flake input 2026-07-28 20:51:19 -10:00
Plans docs: handoff for the clan-community split 2026-07-28 20:03:20 -10:00
scripts Consume the community library as a flake input 2026-07-28 20:51:19 -10:00
sops secrets: add machine node03 2026-07-02 17:58:04 -10:00
tests Gotcha #51: WAL-slot disk fill + etcd flapping; L1.37 disk, L1.38 slot checks; bump clan-community (etcd mesh timing) 2026-11-22 08:05:16 -10:00
vars vars: update stalwart-pg/db-password for machine edge 2026-07-20 14:34:05 -10:00
.drvpath-baseline Add the literal guard, and clean the prose it caught 2026-07-28 15:53:30 -10:00
.gitignore Initial commit: clan-mauke distributed-server spike 2026-07-02 14:07:22 -10:00
BOOTSTRAP.md G7: derive the test harness from the fleet, and document the fork path 2026-07-28 15:56:20 -10:00
clan-ip-addresses.md Phase 4 (community nodes): disko + Phase 5 eval-unblock 2026-07-04 08:47:00 -10:00
community.nix Consume the community library as a flake input 2026-07-28 20:51:19 -10:00
DEVLOG.md Gotcha #51: WAL-slot disk fill + etcd flapping; L1.37 disk, L1.38 slot checks; bump clan-community (etcd mesh timing) 2026-11-22 08:05:16 -10:00
flake.lock Gotcha #51: WAL-slot disk fill + etcd flapping; L1.37 disk, L1.38 slot checks; bump clan-community (etcd mesh timing) 2026-11-22 08:05:16 -10:00
flake.nix Consume the community library as a flake input 2026-07-28 20:51:19 -10:00
inventory.json inventory.json: update install time of node03 2026-07-04 14:56:01 -10:00
matou-infrastructure-map.md Initial commit: clan-mauke distributed-server spike 2026-07-02 14:07:22 -10:00
matou-to-clan-spec.md Initial commit: clan-mauke distributed-server spike 2026-07-02 14:07:22 -10:00
README.md Initial commit: clan-mauke distributed-server spike 2026-07-02 14:07:22 -10:00
SETUP-RUNBOOK.md docs+fix: DEVLOG branding entry, Gotcha #40, runbook fleet-deploy; targetHost→ssh alias 2026-07-19 09:55:08 -10:00
still-to-build.md mail: DMARC p=none -> p=reject (live, serial 2026072705); inbound external path verified 2026-07-27 10:56:02 -10:00

mauke — Mātou-style resilience stack on clan.lol

A four-machine, self-hosted resilience stack for mauke.network (new VPS + three community servers), modelled on the Mātou design but deployed declaratively with clan.lol instead of Ansible.

Full design rationale and the Mātou→clan mapping: matou-to-clan-spec.md.

Layout

flake.nix                          # fleet: machines + inventory (roles→tags)
machines/
  edge/configuration.nix           # new VPS: ingress, kanidm, mail, mesh controller+moon
  node01/configuration.nix         # workhorse: garage + pg/redis voter + active apps
  node02/configuration.nix         # active-active partner + relocate targets
  node03/configuration.nix         # quorum anchor: voter only, no frontends
modules/clan-services/
  pg-ha/                           # custom: HA Postgres (etcd+Patroni+HAProxy)
  redis-ha/                        # custom: HA Redis (Sentinel+HAProxy)
scripts/
  garage-layout.sh                 # one-time: 1 zone/node, RF=3
matou-to-clan-spec.md              # the spec
matou-infrastructure-map.md        # reference design (Mātou)

Roles at a glance

Machine Tags Runs
edge (VPS) edge zerotier controller+moon, Caddy, acme-dns, kanidm, Stalwart, borg client
node01 community voter frontend garage, pg/redis voter, Nextcloud+Forgejo+Mattermost+Collabora
node02 community voter frontend garage, pg/redis voter, Nextcloud+Collabora, relocate targets
node03 community voter garage, pg/redis voter (tiebreaker)

First deploy

# 0. dev shell with the clan CLI
nix develop            # or: nix run git+https://git.clan.lol/clan/clan-core#clan -- <cmd>

# 1. fill placeholders: EDGE_PUBLIC_IP (flake.nix), hardware-configuration.nix
#    per machine (generated by nixos-anywhere/disko at install), domains/TLS.

# 2. generate + encrypt secrets (DB pw, garage keys, DKIM, kanidm) via sops
clan vars generate

# 3. bootstrap each host
clan machines install edge   --target-host root@209.38.94.11   # mauke-edge (syd1)
clan machines install node01 --target-host root@<NODE01_LAN_IP>
clan machines install node02 --target-host root@<NODE02_LAN_IP>
clan machines install node03 --target-host root@<NODE03_LAN_IP>

# 4. one-time garage cluster layout (zones + RF=3)
./scripts/garage-layout.sh

# 5. thereafter, push changes to the whole fleet
clan machines update
clan vars list node01          # discover a machine's mesh (zerotier) IP

Status / what's stubbed

✅ wired = inventory role assigned (clan-native). 🔧 stub = NixOS config present as a TODO skeleton to fill in.

  • ✅ mesh (zerotier controller+moon+peer), garage, borgbackup, sshd/users/monitoring
  • 🔧 edge: Caddy wildcard routing, acme-dns container, kanidm clients/groups, Stalwart, oauth2-proxy fleet
  • 🔧 apps: Nextcloud (active-active), Forgejo+runner, Mattermost, Collabora container
  • 🔧🔧 pg-ha / redis-ha: role interface + module skeleton written; etcd/Patroni/Sentinel/HAProxy internals are TODO (the bulk of the work)

See matou-to-clan-spec.md → Recommended build order.

Caveats verified against clan.lol/docs/26.05

  • zerotier, garage, borgbackup role names/schema are confirmed for 26.05.
  • The clan-core.lib.clan flake output wiring and the clan.service authoring schema (roles.<name>.{interface,perInstance}) should be re-confirmed against the live docs before first build — the API is still stabilising.