Ana içeriğe geç

🚑 Backups

In the context of self-hosting, backups are essential for mitigating the impact of unexpected events—such as fires, database corruption, server access issues, or security breaches. The backup strategy you implement should be tailored to the importance of the services and data you are managing. For instance, backing up a test server will be of little interest, whereas when handling critical data for an NGO or business, backups become much more vital. In these cases, it’s crucial to store backups in one, or ideally several locations.

Manual backup

YunoHost comes with a backup system that allows you to back up (and restore) system configurations and data (e.g. emails) and apps, if they support it.

You can manage backups either from the command line (yunohost backup --help) or from the web administration (in the Backups section), though some features are not yet available in the webadmin.

The current default method consists of creating a .tar archive containing all relevant files.

Creating backups

You can easily create backup archives from the webadmin by going to Backups > Local storage and clicking on New backup. You will then be asked to select which configuration, data and apps you want to back up.

Screenshot of YunoHost's backup panel

Downloading backups

After creating backups, it is possible to list and inspect them using the corresponding views in the web administration interface. A button allows you to download the archive. If the archive is larger than 3GB, it may be better to proceed via SFTP.

Backup > Local Archives > <Archive name> > Download

uyarı

Don't forget to store your backup in a different location from your server.

bilgi

If you want, you can connect an external disk to your server so that the archives are saved directly to it. See this guide on adding external storage to your server.

Testing

You should regularly test your backups by at least listing the contents of the archives and checking the size of the associated data. It is best to practice restoration regularly.

# List the files
tar -tvf /home/yunohost.backup/archives/ARCHIVE.tar | less

# List database exports
tar -tvf /home/yunohost.backup/archives/ARCHIVE.tar | grep "(db|dump)`.sql"

# Check the weight
ls -lh /home/yunohost.backup/archives/ARCHIVE.tar

Restoring backups

bilgi

SPOILER: The larger your data volume and the more applications you have, the more complex your recovery will be.

Simple case: little data, archive already present

Go in Backup > Local storage and select your archive. You can then select which items you want to restore, then click on 'Restore'.

Screenshot of YunoHost&#39;s restore panel

To restore an app, the domain on which it was installed should already be configured (or you need to restore the corresponding system configuration). You also cannot restore an app that is already installed... which means that to restore an old version of an app, you must first uninstall it.

Uploading an archive

In many cases, the archive is not on the server on which you want to restore it. So it has to be uploaded, which depending on its size can take more or less time.

Currently, the most accessible solution for uploading backups is to use the FileZilla program as explained in this page.

By default, backups are to be placed in /home/yunohost.backup/archives/.