Skip to main content

🚑 Copias de apoio

No contexto da auto-hospedaxe, as copias de apoio son fundamentais para mitigar o efecto de eventos imprevistos—como incendios, bases de datos estragadas, problemas de acceso ao servidor, fallos de seguridade. A estratexia de copias que implementes debe axeitarse á importancia dos servizos e datos que xestiones. Por exemplo, facer copia dun servidor de proba ten pouco interese, pero xestionar datos críticos dunha ONG ou empresa ten importancia capital. Nestes casos é imprescindible facer copia de apoio, preferiblemente en varias localizacións.

Copia manual

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.

Podes xestionar as copias ben desde a liña de ordes (yunohost backup --help) ou ben desde a web de administración (na sección Copias de apoio), aínda que algunhas ferramentas aínda non están dispoñibles na web.

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

Creando copias de apoio

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.

captura de pantalla do panel para copias de YunoHost

Descargando as copias

Despois de crear as copias é posible inspeccionar e ver a lista utilizando a sección correspondente da interface web. Un botón permíteche descargar o arquivo. Se o arquivo é maior de 3GB é mellor descargalo usando SFTP.

Copia de apoio > Arquivos locais > <Nome do arquivo> > Descargar

caution

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

info

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

info

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/.