A Borg implementation to backup a YunoHost server. This is the Borg Backup App to be installed on a server to backup. It works together with a Borg Server App installed on a host server.
You want to backup a critical "guest" Server A onto a remote "host" Server B, you need:
- Domain name of server B:
host.serverb
- Name of the server B SSH user (to be created by
borgserver
) for connection from Server A:borgservera
- Strong passphrase to encrypt your backups on host Server B. And to restore your backups!!
- IDs of YunoHost apps you want to backup
- Regular time schedule for your backups, see below
- Install Borg Backup App (
borg
) on guest Server A - Install Borg Server App (
borgserver
) on host Server B
Firstly, set up the Borg Backup App (borg
) on the guest Server A you want to backup:
$ yunohost app install borg_ynh
Indicate the domain name of server B where to upload backups: host.serverb
Indicate the ssh user to use to connect on this server: servera
Indicate a strong passphrase, that you will keep preciously if you want to be able to use your backups: N0tAW3akp4ssw0rdYoloMacN!guets
Would you like to backup your YunoHost configuration ? [0 | 1] (default: 1):
Would you like to backup mails and user home directory ? [0 | 1] (default: 1):
Which apps would you backup (list separated by comma or 'all') ? (default: all):
Indicate the backup frequency (see systemd OnCalendar format) (default: Daily):
You can schedule regular backups at specific time. Only one regular time schedule is possible for one borg
instance, see below for workaround. Some examples:
- Monthly :
- Weekly :
- Daily : Daily at midnight
- Hourly : Hourly o Clock
- Sat --1..7 18:00:00 : The first saturday of every month at 18:00
- 4:00 : Every day at 4 AM
- 5,17:00 : Every day at 5 AM and at 5 PM See here for more info : https://wiki.archlinux.org/index.php/Systemd/Timers#Realtime_timer
At the end of the installation, the Borg Backup App (borg
) displays the SSH public key and the SSH user to give to the person who has access to the host Server B and will set up Borg Server App.
You should now install the "Borg Server" app on host.serverb and fill questions like this:
User: servera
Public key: ssh-ed25519 AAAA[...] [email protected]
This information is also sent by email to the admin of guest Server A. If you don't find the mail and you don't see the message in the log bar you can find the SSH public key with this command:
$ cat /root/.ssh/id_borg_ed25519.pub
ssh-ed25519 AAAA[...] [email protected]
Secondly, set up the Borg Server App (borgserver
) on the host Server B that will store your backups:
$ yunohost app install borgserver
Indicate the ssh user to create: servera
Indicate the public key given by Borg Backup app (borg) setup: ssh-ed25519 AAAA[...] [email protected]
Indicate the storage quota: 5G
At this step your backup should run at the scheduled time. Note that the first backup can take very long, as much data has to be copied through ssh. Following backups are incremental: only newly generated data since last backup will be copied.
If you want to test correct Borg Apps setup before scheduled time, you can start a backup manually on guest Server A:
$ service borg start
Next you can check presence of your backup repository on host Server B:
$ borg list /home/servera/backup
You will need the passphrase to run borg
commands on the backup repository created on the host Server B.
YOU SHOULD REGULARLY RESTORE YOUR BACKUPS TO TEST THEIR VALIDITY.
yunohost app setting borg apps -v "nextcloud,wordpress"
Get the storage space used by the backup repository on the host server
borg info /home/servera/backup
If you want to backup your guest server:
- with different YunoHost apps
- at different regular time schedule
- on different host servers
Then you can set up multiple instances of the Borg Apps on same servers. For instance:
- Borg Backup instance
borg
: backup nextcloud daily on host Server B - Borg Backup instance
borg__2
: backup all other YunoHost apps weekly on host Server C