Prepare
Before anything is built: one 1Password vault that will hold every secret, an inventory of what runs today, and a backup of each service you want to restore. Nothing in this chapter changes the running house. Do it on the computer you use today.
Part A. The 1Password vault
Section titled “Part A. The 1Password vault”2.1 Install 1Password and its command line tool
Section titled “2.1 Install 1Password and its command line tool”Why. Every secret in this guide is created in 1Password and read from it by op, so no password is ever typed into a file in the repository.
Mac
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" # skip if brew existsbrew install --cask 1password 1password-cliOpen 1Password, sign in, then in Settings > Developer turn on Integrate with 1Password CLI and Use the SSH agent. In Settings > Security turn on Touch ID.
Verify. op whoami prints your account after one Touch ID prompt.
Rollback. brew uninstall --cask 1password-cli 1password.
2.2 Create the vault
Section titled “2.2 Create the vault”Why. A dedicated vault keeps infrastructure secrets apart from personal logins, and its name is part of every op:// reference in this repository.
Mac
op vault create InfrastructureVerify. op vault list shows Infrastructure.
Rollback. op vault delete Infrastructure (only while it is empty).
2.3 Create the generated secrets
Section titled “2.3 Create the generated secrets”Why. Generating them now means every later step can read a secret that already exists. Disk passphrases use letters and digits only, so they type correctly on a serial console whatever the keyboard layout.
Mac
for vm in home infra standby; do op item create --vault Infrastructure --category password --title "LUKS $vm" \ --generate-password='letters,digits,40' >/dev/null op item create --vault Infrastructure --category login --title "VM $vm user" \ username=admin --generate-password='letters,digits,24' >/dev/nulldonefor t in "Samba config share" "Grafana admin" "AdGuard Home admin" "MQTT homeassistant" \ "NAS backup user" "Time Machine encryption" "Scrypted admin" "restic standby repository" \ "restic home" "restic infra" "NAS Hyper Backup encryption" \ "ansible-vault warm-standby"; do op item create --vault Infrastructure --category password --title "$t" \ --generate-password='letters,digits,32' >/dev/nulldoneInsights Plus needs three values that depend on each other:
SECRET_KEY=$(openssl rand -hex 32)PG_PASS=$(openssl rand -hex 24)PROXY_TOKEN=$(printf 'proxy-auth' | openssl dgst -sha256 -hmac "$SECRET_KEY" | awk '{print $NF}')op item create --vault Infrastructure --category password --title "Insights Plus" \ "secret key[password]=$SECRET_KEY" "postgres password[password]=$PG_PASS" \ "proxy token[password]=$PROXY_TOKEN" >/dev/nullunset SECRET_KEY PG_PASS PROXY_TOKENVerify. op item list --vault Infrastructure --format json | grep -c '"title"' prints 16, and op read "op://Infrastructure/LUKS home/password" | wc -c prints 41.
Rollback. op item delete "<title>" --vault Infrastructure for any item.
2.4 Create the SSH key in 1Password
Section titled “2.4 Create the SSH key in 1Password”Why. The private key never touches the disk. 1Password’s SSH agent answers for it after a Touch ID, which satisfies “every key in 1Password”.
Mac
op item create --vault Infrastructure --category ssh-key --title "SSH mac-admin" --ssh-generate-key ed25519mkdir -p ~/.ssh && chmod 700 ~/.sshcat >> ~/.ssh/config <<'EOF'
Host * IdentityAgent "~/Library/Group Containers/2BUA8C4S2C.com.1password/t/agent.sock"
Host home HostName 10.0.5.2 User adminHost infra HostName 10.0.2.5 User adminHost standby HostName 10.0.6.2 User adminEOFchmod 600 ~/.ssh/configVerify. ssh-add -l (with SSH_AUTH_SOCK pointed at the agent socket, or simply ssh -G home | grep -i identityagent) shows the 1Password socket, and op read "op://Infrastructure/SSH mac-admin/public key" prints a line starting with ssh-ed25519.
Rollback. Remove the block from ~/.ssh/config and delete the item.
2.5 Items you fill in as you go
Section titled “2.5 Items you fill in as you go”These are created by later steps, when the account or key exists. The item titles and field names matter: vm/*/.env.tpl reads them by name.
| Item title | Fields | Created in |
|---|---|---|
| Mac login | password | 4.1 |
| FileVault recovery key | password | 4.2 |
| UniFi owner account | username, password, one-time password | exists today |
| UniFi local admin unpoller | username, password | 3.6 |
| UniFi local admin protect | username, password | 3.6 |
| UniFi API key insights | credential | 3.6 |
| WireGuard admin VPN laptop, WireGuard admin VPN phone | the client configuration files | 10.11 |
| GoDaddy | username, password | exists today |
| Cloudflare account | username, password, one-time password | 9.1 |
| Cloudflare tunnel home | credential | 9.3 |
| Home Assistant admin | username, password, one-time password | chapter 7 |
| NAS admin | username, password, one-time password | exists today |
| NAS SNMPv3 | username, auth password, priv password | 11.9 |
| MaxMind GeoLite2 | account id, license key | 6.3 |
| AbuseIPDB | credential | 6.3 |
| Insights Plus admin | username, password | 6.17 |
| Home Assistant backup encryption key | password | 12.2 |
| Remote site decisions | secure note | 13.1 |
| Site-to-site VPN remote site | password | 13.15 |
| Telegram bot warm-standby | credential, chat id | 14.4 |
| Remote site NUT monitor | password (given by the remote owner) | 14.5 |
| Remote site stack env | secure note (given by the remote owner, includes their tunnel token) | 14.5 |
Part B. Inventory of what runs today
Section titled “Part B. Inventory of what runs today”2.6 Record the current state
Section titled “2.6 Record the current state”Why. The restore paths need exact versions and names, and the rollback of every later chapter is “put it back as it was”, which needs a record of how it was.
Mac (the one that hosts the Home Assistant VM today), with the NAS share mounted at /Volumes/docker and the HA share at /Volumes/config:
mkdir -p ~/infra-migration && cd ~/infra-migration$U list > utm-vms.txtcat /Volumes/config/.HA_VERSION > ha-version.txtssh admin@10.0.5.20 'docker ps --format "{{.Names}}\t{{.Image}}\t{{.Status}}"' > home-vm-containers.txtssh admin@10.0.5.20 'cat /etc/network/interfaces; ip -br addr; ip -6 route' > home-vm-network.txtls /Volumes/docker > nas-docker-folders.txtThen by hand, in the same folder:
- In Synology Container Manager > Container, screenshot the list (name, image, status) as
nas-containers.png. For each container that has no compose file (Scrypted, Mosquitto, Pi-hole, dnscrypt-proxy, homepage, Uptime Kuma), open Settings and screenshot the volume, port and environment tabs. - In UniFi, Settings > Networks: screenshot each network’s DHCP range and DNS server. Client Devices: export or screenshot every fixed IP.
- Note every device that has
10.0.2.2typed in by hand as its DNS server, and every MQTT client that points at the NAS. - The remote spoke on the SD-WAN (10.1.1.0/24) resolves names through the Pi-hole at 10.0.2.2 today. Note it: step 6.11 moves it to the new resolver.
Verify. cat ha-version.txt prints a version such as 2026.11.2, and home-vm-containers.txt lists homeassistant and matter-server.
Rollback. None needed, read only.
Part C. Backups for the restore paths
Section titled “Part C. Backups for the restore paths”Skip any backup whose service you will build from scratch. Keep everything in ~/infra-migration/backups and copy that folder to an external disk when the chapter is done.
2.7 UniFi
Section titled “2.7 UniFi”Why. Chapters 3 and 10 change the network. One file restores the whole controller.
UniFi Settings > System > Backups (UniFi OS: Settings > Control Plane > Backups): click Download. Save it as backups/unifi-before.unf.
Verify. The file exists and is larger than 1 MB.
Rollback. None needed.
2.8 Home Assistant
Section titled “2.8 Home Assistant”Why. A full backup restores configuration, integrations, history and the HomeKit Bridge pairing. The folder copy is the second net, and it is the form the restore path in chapter 7 uses.
Mac
- In Home Assistant, Settings > System > Backups > Create backup (full). Download it to
backups/. - Copy the folders, owners and permissions kept:
mkdir -p ~/infra-migration/backups && cd ~/infra-migration/backupsssh admin@10.0.5.20 'sudo tar -czpf - -C /srv/homeassistant config' > ha-config.tgzssh admin@10.0.5.20 'sudo tar -czpf - -C /srv/matter data' > matter-data.tgzThe Matter archive is taken while the server runs, which is good enough as a safety copy. Chapter 7 takes the final one with the containers stopped.
Verify. tar -tzf ha-config.tgz | grep -c -E 'config/(configuration.yaml|\.storage/core.config_entries)$' prints 2, and tar -tzf matter-data.tgz | head lists files.
Rollback. None needed.
2.9 The Home Assistant VM itself, for the move
Section titled “2.9 The Home Assistant VM itself, for the move”Why. R3: if moving the VM is simple, move it. A UTM VM is one bundle, so it is. Do this step last, just before chapter 7, because the house has no Home Assistant while the VM is stopped.
Mac (old)
$U stop "<name from utm-vms.txt>" --request # wait until `$U status` says stoppedls -d ~/Library/Containers/com.utmapp.UTM/Data/Documents/*.utmCopy the .utm bundle to the new Mac over AirDrop, a shared folder or an external disk. Do the same for the infra VM if you want to move it instead of rebuilding it.
Verify. du -sh of the bundle on both Macs gives the same size.
Rollback. $U start "<name>" on the old Mac. Nothing was changed inside the VM.
2.10 Scrypted
Section titled “2.10 Scrypted”Why. Scrypted’s backup carries the HomeKit pairing of every camera, so the cameras reappear in the Home app without being paired again.
- In the Scrypted web interface on the NAS, Settings > Backup: download the file to
backups/scrypted-backup.zip. - Second net, with the container stopped for a minute in Container Manager:
tar -czf ~/infra-migration/backups/scrypted-volume.tgz -C /Volumes/docker scrypted- Write down each camera’s name and whether it records with HomeKit Secure Video today.
Verify. Both files exist. tar -tzf scrypted-volume.tgz | grep scrypted.db finds the database.
Rollback. Start the container again. Nothing changed.
2.11 Mosquitto
Section titled “2.11 Mosquitto”Why. The password file holds the broker’s users. Restoring it means no MQTT client needs a new password.
Mac
cd ~/infra-migration/backupstar -czf mosquitto.tgz -C /Volumes/docker mosquittoVerify. tar -tzf mosquitto.tgz | grep -E 'password_file|mosquitto.conf' lists both.
Rollback. None needed.
2.12 DNS: Pi-hole and dnscrypt-proxy
Section titled “2.12 DNS: Pi-hole and dnscrypt-proxy”Why. AdGuard Home starts empty. The blocklists, allowlist and local records come from Pi-hole’s export.
- In Pi-hole, Settings > Teleporter > Export. Save as
backups/pihole-teleporter.zip. - Copy the upstream configuration:
cp /Volumes/docker/dnscrypt-proxy/dnscrypt-proxy.toml ~/infra-migration/backups/.
Verify. unzip -l pihole-teleporter.zip lists etc/pihole/gravity.db or adlist.json.
Rollback. None needed.
2.13 Monitoring
Section titled “2.13 Monitoring”Why. The Prometheus configuration and health rules are already versioned in this repository. Only the Grafana dashboards and the secrets file live outside it.
Mac
cd ~/infra-migration/backupscp /Volumes/docker/monitoring/.env monitoring.env && chmod 600 monitoring.envcd $INFRA && scripts/sync-from-live.sh && git status --shortIn Grafana on the NAS (http://10.0.2.2:3002), open each dashboard, Share > Export > Save to file, into backups/grafana/. Then move the secrets into 1Password and delete the copy:
set -a; . ~/infra-migration/backups/monitoring.env; set +aop item create --vault Infrastructure --category login --title "UniFi local admin unpoller" \ "username=$UNIFI_USER" "password=$UNIFI_PASSWORD" >/dev/nullop item create --vault Infrastructure --category password --title "NAS SNMPv3" \ "username[text]=$SNMP_USER" "auth password[password]=$SNMP_AUTH_PASSWORD" \ "priv password[password]=$SNMP_PRIV_PASSWORD" >/dev/nullrm ~/infra-migration/backups/monitoring.envVerify. git status --short in the repository shows no unexpected change (the versioned copies match the NAS), op read "op://Infrastructure/NAS SNMPv3/username" prints the SNMP user, and backups/grafana/ holds one JSON file per dashboard.
Rollback. None needed.
2.14 Take the backups off the Mac
Section titled “2.14 Take the backups off the Mac”Why. Until the new setup has its own backups (chapter 12), this folder is the only copy of several things.
Copy ~/infra-migration to an external disk, and attach unifi-before.unf and the Home Assistant backup to a 1Password item named Migration backups if they fit (100 MB per file).
Verify. The external disk holds the folder with the same file count: find ~/infra-migration -type f | wc -l on both.
Rollback. None needed.
Part D. Things to have at hand
Section titled “Part D. Things to have at hand”| Item | Why | Where |
|---|---|---|
| 10G SFP+ DAC cable, 0.5 to 1 m | Uplink between the UDM Pro and the switch (step 3.2) | For example UACC-DAC-SFP10 |
| UTM | Runs the VMs | mac.getutm.app |
| Debian 13 arm64 netinst ISO | Base of all three VMs | debian.org/distrib/netinst |
| A UPS for the Mac, UDM Pro and switch | With FileVault on, the VMs stay down after a power cut until you log in (chapter 15). A UPS rides through most cuts | Hardware |
| A Mac with enough memory | The three VMs reserve 12 GB (4 GB each). 24 GB or more leaves the workstation comfortable |