Moving to another server
Move a whole Homerun instance, say from a box at home to a VPS, with one command run on the server you're leaving. It carries the database, settings, secrets, certificates and every volume across, installs the same Homerun version on the new server and redeploys every service there. Nothing is deleted on the old server, so going back is one command.
#Before you start
-
The old server must be a rootful
--mode=fullinstall, the installer's default. A rootless one moves onto the system daemon first with--migrate-to-rootful. -
The new server runs Linux on amd64 or arm64 (the architectures can differ), with nothing else on ports 80 and 443. Docker is installed there if it's missing.
-
Root on the old server logs in to the new one as root over SSH, with a key. The move runs without a prompt, so a password won't do. On the old server:
sudo ssh-keygen -t ed25519 sudo cat /root/.ssh/id_ed25519.puband append that line to
/root/.ssh/authorized_keyson the new server (or runsudo ssh-copy-id root@<new server>when it still accepts a password). Check withsudo ssh root@<new server> true. The new server's host key is trusted the first time it's seen. AHostalias in/root/.ssh/configworks too, for a non-standard port. -
The old server reaches the new one, not the other way round: a box behind a home router with no open ports can move to a VPS.
#Moving
On the old server:
curl -fsSL https://raw.githubusercontent.com/zedensix/homerun/main/cmd/installer/bootstrap.sh \
| sudo bash -s -- --move-to=root@203.0.113.7 --yesThe instance keeps the address in .env's HOMERUN_HOST. Pass
--domain=<domain or IP> when it changes, which is required when the old server
was reached by its own IP address: that address stays behind.
The move goes in six steps, printed as it runs:
- Check the new server: it answers over SSH as root, on a supported architecture. Nothing has changed anywhere yet if this fails.
- Docker on the new server, installed with Docker's own script when it's missing.
- Stop Homerun here. The database is asked to redeploy every service on the next boot, then the stack, every deployed service and the core services (registry mirror, mail server, tunnel, telemetry collector) are stopped. Swarm services are scaled to zero and containers lose their restart policy, so nothing comes back on the old server after a reboot. Your sites are down from here until the new server has redeployed them.
- Copy settings and data:
.env(withAUTH_SECRET, which every stored secret is encrypted with) andhomerun.yaml, then every named Docker volume on the old server (Homerun's database, certificates and routing files, and every service's volumes), recreated with the same labels and options and streamed over SSH with file ownership kept, then every host path a service bind-mounts, to the same path on the new server. - Install Homerun on the new server: the same installer runs there with the
same user, version and image, finds
.envand the volumes already in place and starts on them. It becomes a swarm manager like any fresh install. - Wait for Homerun to answer on the new server. On its first boot it redeploys every service: images are pulled again and git services are rebuilt from their repositories, so a service built for a different CPU architecture is rebuilt for the new one.
The copy runs with Homerun stopped, so the downtime grows with the data: about the volumes' total size divided by the old server's upload speed. Run Docker Cleanup and delete the volumes you don't need first.
A failed move can be run again with the same command. Each finished volume
is recorded under .move/<target> next to the compose file, so a second run
only copies what didn't finish. Delete that directory to start a move to the
same server from scratch.
#After the move
The installer ends with a list of what's left to do by hand:
- DNS: point the dashboard's record, the base domain and its wildcard, and every custom domain at the new server. On DNS → Domains, change each domain's target to the new server's address, so DNS automation updates the records it manages.
- Swarm nodes: other machines in the old server's swarm stay joined to it.
On each, run
docker swarm leave --force, then add it to the new server from Remote Hosts → Add a server. A service pinned to one of them by a placement rule waits until it's back. - Build servers keep their address and token. The new server has to reach them, which a machine on your home network usually isn't from a VPS.
- A volume whose data lives outside Docker (an NFS mount, a local volume
with a
deviceoption) is recreated with the same options but not copied. - A Pangolin tunnel from the old server isn't needed on a VPS with a public address: turn it off on DNS → Pangolin once DNS points at the new server.
- Containers Homerun didn't start, and Docker images on the old server, aren't moved.
#Going back
The old server still has everything, stopped. Start it again:
sudo docker compose -f /home/homerun/homerun/compose.yaml -f /home/homerun/homerun/compose.swarm.yaml up -dIt redeploys every service on its own, the same way the new server did. Once
you're happy with the new server, remove the old one's data with
docker compose ... down --volumes and docker volume prune --all.
This guide lives in the project repo: edit it there, and this page follows with the next release.