Skip to Content
HostWall

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

IncludedNot included
The database: dashboard sites, the admin account, exceptions, events and statisticsThe HostWall binary (reinstall it)
Let's Encrypt certificates, keys and ACME accountThe systemd unit (the installer recreates it)
The dashboard's self-signed certificateYour 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.gz

HostWall 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
EOF

Then 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 --force before the file name.
  • Without --force, restore refuses to overwrite an existing database. If a config file already exists, the backup's config goes to <data_dir>/hostwall.restored.yaml so you can compare.
  • Restored files are given to the owner of the data directory (the hostwall user).

Move to a new server

  1. On the new server, install HostWall.
  2. Copy the backup over and restore it as above.
  3. Check the sites on the new server, for example with curl --resolve example.com:443:<new-ip> https://example.com/.
  4. 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.

Edit this page on GitHub

On this page