- Jinja 60.5%
- Shell 39.5%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
Install and run the T3 Code server from the NetBird-only feed at http://harp-willow.mesh.secluded.site:8081/t3code once NetBird is verified installed and connected. - Add the t3code role: verifies NetBird connectivity, resolves the feed host on the controller (respecting --disable-dns on target hosts), tracks latest-linux.yml with SHA256SUMS verification, installs versioned runtimes under /opt/t3code, symlinks /usr/local/bin/t3, and runs t3code.service as cr0w on :3773 (--lan). - Allow TCP 3773 on wt0 in the UFW role and declare t3code_port in common group_vars. - Wire t3code into bootstrap.yml (after NetBird admin SSH verification) and site.yml (for day-2 convergence and updates), and update README.md. |
||
| .mise/lib | ||
| ansible | ||
| LICENSES | ||
| manifests | ||
| scripts | ||
| systemd | ||
| .gitignore | ||
| ansible.cfg | ||
| mise.toml | ||
| README.md | ||
| REUSE.toml | ||
| server-inventory.md | ||
birdhouse-infra
Infrastructure-as-code for the b1rdh0use stack. This repository will eventually
hold the cloud resources, host configuration, and deploy tasks for everything that
currently runs by hand on av1ary.
Current server state is captured in server-inventory.md, which records the pre-migration host. The architecture below is the declared state this repository owns.
Architecture
One Hetzner Cloud VPS (av1ary, 4 vCPU / 7.6 GiB / 75 GiB) running Debian 12.
Every workload lives directly on the host as a systemd unit wrapped around an
application user. There is no container runtime.
Internet
|
[ Hetzner VPS ]
|
+---------------+---------------+
| |
Caddy :80/:443 Forgejo :22 NetBird
ACME TLS Git SSH av1ary peer
| |
+----+----+ |
| | |
static git.* sshd
site foundry.* :2222
|
forgejo / foundry
127.0.0.1:3000/30000
| Concern | How it works |
|---|---|
| Compute | Hetzner Cloud, KVM, cloud-init image, primary IPv4 + static IPv6 /64 |
| OS | Debian 12 (bookworm), UTC, no swap |
| Ingress | Caddy 2.11.7, automatic ACME, HTTP/3; sites b1rdh0use.com, www, git.b1rdh0use.com, foundry.b1rdh0use.com |
| Static site | /var/www/b1rdh0use, generated output, source not on the host |
| Git forge | Forgejo 16.0.5 (SQLite), HTTP on 127.0.0.1:3000 behind Caddy, built-in Git SSH on :22 |
| VTT | Foundry VTT 5.x, bound to 127.0.0.1:30000 behind Caddy, unit present but not enabled at boot |
| Game server | Minecraft, tmux-backed Type=forking unit, currently down |
| Remote access | NetBird (pinned peer address, client DNS disabled), hardened sshd on :2222 (wt0 only), T3 Code server on :3773 (wt0 only, installed from harp-willow.mesh.secluded.site:8081/t3code) |
| Firewall | UFW enabled; public 80/443 plus 22 for Forgejo Git SSH, admin SSH (2222) and T3 Code (3773) on NetBird (wt0) only |
| DNS | deSEC zones |
| Purelymail | |
| Isolation | Per-service system users (git, foundry, minecraft, caddy) with per-user homes and data directories |
| Deploys | mise tasks drive rsync from a workstation to the host |
Pain points this migration targets
- Unreproducible host — 715 days of drift, no declaration of state anywhere.
- No backups — resolved 2026-11-04: nightly restic snapshots to a Hetzner Storage Box, with a verified restore drill. See Backups and restore.
- Fragile units — tmux-based Minecraft; Foundry not enabled at boot.
- Secrets on the image — Forgejo
SECRET_KEY/DB, Foundry license, NetBird setup key, DNS and mail credentials. - Manual, single-host deploys —
rsyncassumes whatever the host currently looks like.
Target state
Same single VPS (or a small set of them), but every piece of it is declared in this repo and rebuildable from scratch. Stack: Ansible for both the cloud and host layers, mise as the task runner and deploy interface.
deSEC DNS ---- Purelymail (mail stays external)
|
Ansible cloud layer: server, IPs, SSH keys,
provision firewall, DNS records, cloud-init
|
v
bootstrap.yml first contact: users, keys, UFW,
(public address) NetBird join
|
v
NetBird overlay stable address for every later run
|
site.yml host layer: packages, users, units,
(NetBird address) Caddyfile, app config, secrets
|
v
mise day-2 interface: provision, converge,
deploy, backup, restore, health
Layer responsibilities
| Layer | Tool | Owns |
|---|---|---|
| Cloud | Ansible (hosts: localhost, hetzner.hcloud) |
Server type/location/image, primary + IPv6, SSH keys, Hetzner Cloud Firewall, DNS records in deSEC, cloud-init user_data |
| Bootstrap | Ansible (playbooks/bootstrap.yml, public address) |
Base users, authorized keys, essential packages, UFW, NetBird join, and initial T3 Code server install once NetBird is verified. Run once over the public address; every later run goes over NetBird. |
| Host | Ansible (site.yml, NetBird address) |
Package state, service users and homes, systemd units, /etc/caddy/Caddyfile, Forgejo app.ini |
| Day-2 | mise tasks | Wrapping the above, plus deploys, backups, and restores so no one runs raw commands by hand |
Decisions
- Ansible for every layer. One tool, one language, one execution model across cloud and host. The cloud layer here is one server, a firewall, and a handful of records; a second tool for that is cost without capability.
- No OpenTofu, no state file. The provider APIs are the source of truth. Nothing to secure, nothing to lock, and nothing that can drift from reality. Adopting the existing server is a playbook run, not an import step.
hetzner.hcloudcovers the cloud layer.server,primary_ip,ssh_key,firewall,firewall_resource, plus thehcloudinventory plugin that feeds the host play.- deSEC needs a small amount of custom work.
community.dnsships providers for Hetzner, Hosttech, and Infomaniak, not deSEC. Default to a thin set ofuritasks against the deSEC REST API; reach for a third-party collection (tealk.desec,strfl89.desec_io) only if it earns the dependency. --check --diffis the review gate. No plan file, so the dry run is what gets read before anything mutates.- No containers initially. Keep per-user systemd isolation; folding Foundry/Minecraft/Forgejo into containers is a follow-up, not a prerequisite. This also fixes the tmux Minecraft unit when it happens.
- mise is the only entry point. Every operation is a named task, so the path is identical on a laptop, in CI, and on the host.
- NetBird replaces Tailscale without load-bearing DNS. The server joins with a setup key from
https://netbird.secluded.site, and Ansible targets the pinned peer address stored ingroup_vars. Client DNS management is disabled, so no MagicDNS-style name sits in the deploy or ingress path. Setup keys add the peer to its group, and/var/lib/netbirdjoins the backup set. - Tunnel IPs stay out of service config. Caddy, Forgejo, and Foundry use
127.0.0.1; the NetBird interface (wt0) carries admin SSH (:2222) and T3 Code (:3773), gated by UFW. Re-enrolling the peer cannot break ingress. - Secrets never in the image. Ansible Vault by default, decrypting at run time. Forgejo
SECRET_KEY, NetBird setup key, Foundry license, deSEC/mail tokens, Hetzner API token.
Deploy flow (target)
Every playbook task requires an explicit environment (test or prod). Production mutations prompt for confirmation; dry runs (:check) do not.
mise run provision:check <test|prod>— dry run of cloud and DNS changes.mise run provision <test|prod>— create or update the server, firewall, and DNS records.mise run bootstrap:check <test|prod> -e public_ip=<ip>— dry run over the public address.mise run bootstrap <test|prod> -e public_ip=<ip>— base users, UFW, and the NetBird join; note the peer address it prints.- Set
netbird_ipinansible/inventories/<env>/group_vars/all/(orlocal.ymlfortest), thenmise run converge:check <test|prod>andmise run converge <test|prod>— Ansible configures the host over NetBird, idempotently. mise run restore:check <test|prod>/mise run restore <test|prod>— read-only restic restore of service data (e.g.-e restore_tag=pre-migration --tags forgejo).- Backups are not a
misetask: a systemd timer on the host runs them nightly onprod(restic_backup_enabled: true) and is disabled/masked ontest.
Manual SSH is for debugging only, not for change.
NetBird cutover
NetBird and Tailscale both allocate from 100.64.0.0/10, so they cannot run
together. bootstrap.yml stops and disables tailscaled before joining
NetBird; run it over the public address (or keep a Hetzner console session
open) so the join does not depend on the tunnel it is replacing. Join the
workstation to NetBird first, because the role verifies the new path from the
controller before finishing.
The bootstrap prints the assigned peer address. Put it in netbird_ip in
ansible/inventories/<env>/group_vars/all/ (or reserve the address in the NetBird
dashboard), then converge. Keep tailscaled installed and /var/lib/tailscale
in the last restic snapshot until the NetBird path is verified, then purge
Tailscale, revoke its keys, and delete the old device. Rollback is
netbird down plus re-enabling tailscaled, or public-address SSH.
Backups and restore
Nightly, on the host, by a systemd timer. Not a mise task and not a playbook
run: a backup that depends on a workstation or a controller stops exactly when
that machine is unreachable, which is when it matters.
| Target | gr4nary, Hetzner Storage Box, Falkenstein (server is in Hillsboro) |
| Transport | restic over SFTP, port 23, subaccount key |
| Schedule | restic-av1ary.timer, 03:30 daily, Persistent=true |
| Script | /usr/local/sbin/restic-backup.sh (source: scripts/restic-backup.sh) |
| Paths | /root/av1ary-backup-paths.txt (source: manifests/av1ary-backup-paths.txt) |
| Forgejo | forgejo dump to /var/backups/forgejo/, dated, 10 days kept |
| Retention | 7 daily, 4 weekly, 6 monthly; prune and check --read-data-subset=5% on Sundays |
| Concurrency | flock in the unit's ExecStart; --retry-lock did not behave on this restic build |
Two notes on the files above. The script and the paths manifest are deployed by
hand today, at paths outside the repo, so they can drift until an Ansible role
owns them. And the Forgejo dump runs while the service is up: forgejo dump
takes a consistent database snapshot, and the rest of the tree is copied live,
which is correct for Forgejo's storage layout but means a snapshot is not a
frozen instant of the world.
Restore preconditions
A restore needs three things, and two of them are deliberately not on the server:
- The restic password, which lives in the password manager and nowhere else.
- Access to the Hetzner console, to add a fresh SSH key to the storage box subaccount if the server's key dies with the server.
- The repository itself, which then needs only
restic restore latest.
Recovery order on a total loss: create a keypair, add it to the subaccount in
the Hetzner console, restore /etc, /var/lib/forgejo, /var/backups/forgejo,
the service homes, and the Caddy state, then start services and diff what is
running against this repository.
Drill (2026-11-04)
Restoring one known-unchanged Forgejo repository and comparing git refs and object hashes gave an exact match:
=== refs/heads/master ===
capture: ef3e3fb7311cc0f7c9ded736009f33276a8d85bc
drill: ef3e3fb7311cc0f7c9ded736009f33276a8d85bc
REF MATCH
OBJECT MATCH 9f7f32a2aaf71a04acb8a0483565ff69d2176e6cd0173dbf7013a22686e75b28
That proves the path from snapshot to readable repository for one repository.
Widening it with git fsck across every repository in the restored tree is the
next step, since a truncated object in a repo nobody happened to test would
still be silent.
Repository layout
.
├── README.md
├── server-inventory.md
├── ansible.cfg # inventory = /dev/null (fail-closed) and roles_path
├── ansible/
│ ├── requirements.yml # hetzner.hcloud, community.general, ansible.posix
│ ├── inventories/
│ │ ├── common/ # shared derived vars and optional shared vault
│ │ ├── test/ # av1aries (techpaws.com, cpx21), backups disabled
│ │ └── prod/ # av1ary (b1rdh0use.com, cpx31), backups enabled
│ ├── playbooks/provision.yml # localhost: server, firewall, DNS
│ ├── playbooks/bootstrap.yml # public address: users, UFW, NetBird
│ ├── playbooks/restore.yml # NetBird: read-only restic restore
│ ├── roles/ # guardrails, base, ufw, netbird, caddy, forgejo, foundry, minecraft, restic, t3code
│ └── site.yml # host convergence over NetBird
├── mise.toml # all tasks: provision, bootstrap, converge, restore, lint, check
└── .mise/lib/ansible-run.sh # explicit env validation, layered -i wiring, prod confirmation gate
Migration order
- Preserve first. Backups and a captured copy of every root-readable path currently marked BLOCKED in the inventory. No cutover before this.
- Codify the host. Ansible roles for the units and config that exist today, converging to a no-op on the live box. This pays off immediately and needs no new infrastructure.
- Codify the cloud layer. A
provisionplaybook that adopts the existing server by name and declares the firewall and DNS records. - Move deploys to mise. Replace ad-hoc
rsyncinvocations with tasks. - Rehearse a rebuild. Provision a clone from repo alone; diff against the live host.
- Cut over. Only after the rehearsal matches.
Licensing
This repository is REUSE compliant.
| Scope | License |
|---|---|
| Code and configuration (Ansible, mise, task scripts) | Mutualist License 1.2 (LicenseRef-MutuaL-1.2) |
Documentation (README.md, server-inventory.md, docs/) |
CC0-1.0 |
Run mise run license (or reuse lint) before committing.
Open questions
- Which deSEC zone(s) cover every hostname today, and can every record be declared without a gap?
- Is a third-party deSEC collection worth depending on, or is
uriagainst the REST API the right shape? - Do Foundry and Minecraft stay on this host, or move to dedicated/contained workloads?
- What is the backup target and retention policy?
- Full severity/risk list lives in server-inventory.md.