|
|
||
|---|---|---|
| .claude | ||
| backup | ||
| docs | ||
| nixos | ||
| vps | ||
| .gitignore | ||
| AGENTS.md | ||
| BACKLOG.md | ||
| README.md | ||
| RETIRED.md | ||
| retirer | ||
selfhosted
README.md is a symlink to this file: the one entry point for people and agents.
The project
Docker compose stacks and Caddy configs for the user's self-hosted services, on a headscale tailnet, laid out
by machine: the tree is the source of truth for what runs where. vps/ and nixos/ each hold one
directory per stack that machine runs, the machine's caddy (<machine>/caddy/) and its host-level units; list
a machine's directory to see what runs on it. A stack that moves to another machine moves with git mv, in
the same commit as its Caddy block and DNS record; a stack that stops running is deleted and gets a row in
RETIRED.md, both by ./retirer <stack>, which also says what the user runs on the machine.
backup/ holds the stale backup scripts. Details: docs/guides/network-and-caddy.md.
Where you are running. If you are reading this, you are inside agentvm-repos (192.168.122.51 on
virbr0), a microVM on a physical NixOS host, defined in the separate nixed repo (microvms/projects.nix,
project repos). /workspace is a virtiofs mount of the host's ~/repos; this checkout is one directory in it.
Confirm with ip addr / hostname if in doubt. The microVM has no tailscale client: tailnet nodes reach it
through the host's approved subnet route for 192.168.122.0/24, so a container here bound to 0.0.0.0 is at
192.168.122.51:<port> for any node with --accept-routes.
| Machine | Caddy | Tailnet address | Deployed by |
|---|---|---|---|
| The VPS (public IP; also headscale) | vps/caddy/ |
100.64.0.2 |
the user |
| The physical NixOS host (rootless podman) | nixos/caddy/; nixos/ is the default for new stacks |
100.64.0.5 |
the user |
| This microVM (docker) | none: it hosts no stacks (RETIRED.md) |
192.168.122.51 |
— |
The traps
- Agents don't deploy to the host or the VPS. Nothing here can run
nixos-rebuild(only the user, fromnixed, on the host), and editingvps/headscale/config/(config.yaml,acl.hujson) does nothing until the user redeploys headscale on the VPS. Agents edit and test here; the user deploys. - Never run
vps/caddy/here, orcompose upnixos/caddy/docker-compose.yaml: the first needs the VPS's public 80/443, the second's./datais the host caddy's live state. Test with a temporary caddy instead (docs/guides/network-and-caddy.md, Caddy conventions, "Testing a nixos service"). - Bring down only what you started. ethaae's containers run here long-term, and another session may be testing its own stack (the same bullet of the guide).
backup/setup.sh(backup/restore) andbackup/sync.sh(the laptop's rclone sync) are stale (backup/README.md), due for a rewrite: don't treat them as current operational guidance or extend them without flagging that first.
Read when
| File | Read when |
|---|---|
docs/guides/network-and-caddy.md |
you touch vps/caddy/, nixos/caddy/, vps/headscale/, a stack's compose file or a DNS record, or test a service in this microVM: the tailnet, headscale's DNS, which caddy runs where, the test recipe |
docs/guides/architecture-and-recovery.md |
you touch backups, rclone, the StorageBox or backup/, or a disk, key or machine is lost: the machines, disks, remotes, where each key lives, the /mnt/data restore |
nixos/plane/README.md, nixos/ente/README.md |
you work on Plane or Ente |
docs/repo-layout-design.md, docs/ente-https-design.md |
you move or retire a stack, or work on Ente over https: the designs, approved by the user |
Working here
- Never commit secrets:
.envfiles,data/,nixos/plane/backup/and each caddy's state stay gitignored (the top-levelbackup/is tracked scripts); check what's staged before committing. - Commit messages say why, not just what: this repo's history is the record of how the self-hosted setup got to its current state.
- After a merge, a change under
vps/ornixos/waits for the user to deploy it; the PR body says so. - Forgejo (
git.thodkatz.com), with no CI. Thefjcommands, the sign-off on a squash and the server's quirks:/workspace/agent-methodology/shared/forgejo.md. After each merge, runmethodology reconcile <n>: the server records no push, so a merge leaves its PR open. - Notes go in
docs/knowledge/(index: itsREADME.md); deferred items inBACKLOG.md.
The check
Nothing to install. The check command validates each machine's Caddyfile, and checks that every
reverse_proxy upstream in <machine>/caddy/config/Caddyfile is a service or container_name defined under
the same <machine>/, or is listed in <machine>/caddy/external-upstreams (one name per line); it reads only
single-upstream reverse_proxy http://<name>:<port> lines, the form every line uses today. It prints what
fails and exits non-zero. docker compose config needs each stack's secrets, so it isn't part of it; test a
stack as docs/guides/network-and-caddy.md says.
rc=0
for m in vps nixos; do
docker run --rm -v "$PWD/$m/caddy/config:/config:ro" docker.io/library/caddy:2.10.2 \
caddy validate --adapter caddyfile --config /config/Caddyfile >/dev/null 2>&1 || { echo "invalid: $m/caddy"; rc=1; }
c=$m/caddy/config/Caddyfile
awk -v c="$c" '
FILENAME ~ /external-upstreams$/ { if (NF) def[$1] = 1; next }
FILENAME == c { if ($1 == "reverse_proxy" && sub(/^http:\/\//, "", $2)) { sub(/:.*/, "", $2); use[$2] = 1 }; next }
/^[^ #]/ { svc = ($1 == "services:"); ind = -1; next }
svc && /^ +[A-Za-z0-9._-]+:/ { i = match($0, /[^ ]/) - 1; if (ind < 0) ind = i; if (i == ind) { k = $1; sub(/:.*/, "", k); def[k] = 1 } }
$1 == "container_name:" { v = $2; gsub(/["\047]/, "", v); def[v] = 1 }
END { for (u in use) if (!(u in def)) { print "undefined upstream " u " in " c; bad = 1 }; exit bad }
' $(git ls-files -co --exclude-standard "$m/*/docker-compose.yaml" "$m/*/config/docker-compose.override.yml" \
"$m/caddy/external-upstreams") "$c" || rc=1
done
[ "$rc" = 0 ]
Nothing here is heavy enough for methodology heavy.