Backups and restore
Back up HostWall to one file, schedule backups, restore, and move HostWall to a new server.
Everything HostWall knows lives in its data directory and config file. One command saves all of it to a single file.
What a backup contains
| Included | Not included |
|---|---|
| The database: dashboard sites, the admin account, exceptions, events and statistics | The HostWall binary (reinstall it) |
| Let's Encrypt certificates, keys and ACME account | The systemd unit (the installer recreates it) |
| The dashboard's self-signed certificate | Your apps and their data |
The config file (hostwall.yaml) |
The backup contains private keys, the admin password hash and the 2FA secret. Store it like a password.
Create a backup
sudo hostwall backup --out /tmp/hostwall-backup.tar.gzHostWall can keep running: the database is copied as a consistent snapshot. Then move the file somewhere safe, ideally off the server.
Note
With sudo, the CLI writes the file as the hostwall user, which can't write to most home directories. Write to /tmp (or another directory that user can write to), then move it.
Scheduled backups
For example, a nightly backup with cron that keeps the last 7 days:
sudo tee /etc/cron.d/hostwall-backup >/dev/null <<'EOF'
15 3 * * * root /usr/local/bin/hostwall backup --out /tmp/hostwall-backup.tar.gz && mv /tmp/hostwall-backup.tar.gz /root/hostwall-backup-$(date +\%a).tar.gz
EOFThen copy the files off the server with your usual tool (rsync, restic, borg, rclone). Built-in S3 backups are planned for v0.3.
Restore
On the same server, or a new one with HostWall installed:
sudo systemctl stop hostwall
sudo hostwall restore --force /tmp/hostwall-backup.tar.gz
sudo systemctl start hostwall- Put
--forcebefore the file name. - Without
--force,restorerefuses to overwrite an existing database. If a config file already exists, the backup's config goes to<data_dir>/hostwall.restored.yamlso you can compare. - Restored files are given to the owner of the data directory (the
hostwalluser).
Move to a new server
- On the new server, install HostWall.
- Copy the backup over and restore it as above.
- Check the sites on the new server, for example with
curl --resolve example.com:443:<new-ip> https://example.com/. - Point DNS at the new server. Certificates come with the backup, so HTTPS works straight away.
Docker
docker exec hostwall hostwall backup --out /var/lib/hostwall/backup.tar.gz
docker cp hostwall:/var/lib/hostwall/backup.tar.gz .Or back up the hostwall-data volume with your usual volume backup tool while the container is stopped.