Backup to your own cloud: VPS backups to your Backblaze B2 or S3 Print

  • 0

With the free Backup to your own cloud app (chosen when you order the VPS), your VPS comes with restic, a free backup program, and the dphost-backup command. You choose where backups are stored (an account of yours at Backblaze B2, Amazon S3, other S3-compatible storage, or another server of yours) and they run every day, overnight, on their own. It works on Ubuntu, Debian, AlmaLinux and Rocky Linux.

  • Backups are encrypted on the VPS before they leave: anyone with access to the storage only sees scrambled files.
  • Only what changed is uploaded again, so the daily backup is fast and uses little space.
  • The storage key and the encryption password stay only on your VPS, in /etc/dphost-backup (root-only). DP HOST does not receive or keep them.
  • You pay the storage provider directly. This is different from DP HOST's Daily backup, which is stored in the same data center as the VPS.

1. Create the storage (Backblaze B2 example)

  1. Create a Backblaze B2 account.
  2. Create a private bucket (Buckets > Create a Bucket, "Private") and write down its Endpoint (e.g. s3.us-west-004.backblazeb2.com).
  3. In the bucket's Lifecycle Settings, choose "Keep only the last version of the file". Otherwise B2 keeps old versions of deleted files and your bill keeps growing.
  4. In Application Keys > Add a New Application Key, give access to this bucket only, with Read and Write. Write down the keyID and the applicationKey (it is shown only once).

Other destinations: Amazon S3 (a private bucket and a user allowed only on that bucket: region, bucket, Access Key ID and Secret Access Key); other S3-compatible storage (Wasabi, Cloudflare R2, iDrive e2, MinIO: the service URL, the bucket and both keys); another server of yours, over SFTP (server, port, user and folder: the command creates an SSH key and shows the public part for you to add at the destination).

2. Turn the backup on

Log in to the VPS over SSH as root and run dphost-backup configure. It asks for the destination, the keys (the secret key is hidden while you type) and the encryption password: type your own (at least 12 characters) or press Enter to generate a strong one. A generated password is shown only once: save it in a password manager, outside the VPS. Without the encryption password nobody can open the backups: not you, not DP HOST. At the end the daily backup is on, and the command offers to run the first backup right away.

3. Check it from time to time

  • dphost-backup status: destination, next run, last result and stored snapshots. The last result also shows on screen when you log in to the VPS.
  • dphost-backup test: checks the backups and restores a test file. Run it at least once a month.
  • Automatic alert (optional): in configure, enter a URL to be called after each successful backup (an Uptime Kuma Push monitor, for example). If backups stop, your monitor alerts you.

4. Restore

Run dphost-backup restore: it lists the snapshots, asks which one to use and what to restore (e.g. /var/www). Files come back into a new folder, never on top of the current files; then copy what you need from there. Before each backup, the VPS's MariaDB/MySQL and PostgreSQL databases (including those in Docker containers) are exported to /var/backups/dphost-backup/: to bring a database back, restore that folder and import the .sql file, carefully (the current database is replaced). Lost VPS: order a new VPS with Backup to your own cloud, run dphost-backup configure with the same destination and the same encryption password and use dphost-backup restore.

5. What is included

Included: /etc, /root, /home, /opt, /srv, /var/www, /var/spool/cron, /usr/local, Docker volumes, /data and the database exports. Not included: the backup keys, caches and /swapfile. To change it: /etc/dphost-backup/pastas.txt (folders) and /etc/dphost-backup/excluir.txt (exclusions). It keeps 7 daily, 4 weekly and 3 monthly snapshots (/etc/dphost-backup/opcoes.env). Other commands: dphost-backup now, disable, enable, language en and help. Log: /var/log/dphost-backup.log.

Important

  • The VPS is unmanaged: the backup is yours. Check status and test a restore from time to time.
  • If you stop paying the storage provider, the backups go away with the account.
  • Reinstalling the operating system from the panel deletes the program and its settings; backups already at the destination stay there.

Was this answer helpful?

« Back

Powered by WHMCompleteSolution