mirror of
https://github.com/YunoHost-Apps/borg_ynh.git
synced 2024-09-03 18:16:05 +02:00
Refactor doc manifestv2
This commit is contained in:
parent
297dd6903b
commit
46ad2ce2fb
3 changed files with 50 additions and 21 deletions
|
@ -3,6 +3,7 @@
|
|||
## How to backup your server with this app?
|
||||
|
||||
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**!!
|
||||
|
@ -15,9 +16,10 @@ You want to backup a critical "guest" Server A onto a remote "host" Server B, yo
|
|||
You should received an email after the first backup succeeded.
|
||||
|
||||
### Set up Borg Backup App on guest Server A
|
||||
|
||||
Firstly, set up the Borg Backup App (`borg`) on the guest Server A you want to backup:
|
||||
|
||||
```
|
||||
```bash
|
||||
$ yunohost app install borg
|
||||
In which borg repository location do you want to backup your files ?: user@host.serverb:/remote/repository
|
||||
Provide a strong passphrase to encrypt your backups. No blank space:
|
||||
|
@ -29,7 +31,9 @@ Do you want admin to receive mail notifications on backups ? [always | errors_on
|
|||
```
|
||||
|
||||
#### Syntax to define a backup time schedule
|
||||
|
||||
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
|
||||
|
@ -37,25 +41,32 @@ You can schedule regular backups at specific time. Only one regular time schedul
|
|||
* 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
|
||||
|
||||
See here for more info : <https://wiki.archlinux.org/index.php/Systemd/Timers#Realtime_timer>
|
||||
|
||||
#### Information generated by Borg Backup
|
||||
|
||||
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.
|
||||
```
|
||||
|
||||
```text
|
||||
You should now install the "Borg Server" app on host.serverb and fill questions like this:
|
||||
User: servera
|
||||
Public key: ssh-ed25519 AAAA[...] root@guest.servera
|
||||
```
|
||||
|
||||
This information is also sent by email to the admin of guest Server A.
|
||||
If you don't find the email and you don't see the message in the log bar you can find the SSH public key with this command:
|
||||
```
|
||||
|
||||
```bash
|
||||
$ cat /root/.ssh/id_borg_ed25519.pub
|
||||
ssh-ed25519 AAAA[...] root@guest.servera
|
||||
```
|
||||
|
||||
### Set up Borg Server App on host Server B
|
||||
|
||||
Secondly, set up the Borg Server App (``borgserver``) on the host Server B that will store your backups:
|
||||
```
|
||||
|
||||
```bash
|
||||
$ 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[...] root@guest.servera
|
||||
|
@ -63,43 +74,51 @@ Indicate the storage quota: 5G
|
|||
```
|
||||
|
||||
### Test the Borg Apps setup
|
||||
|
||||
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:
|
||||
```
|
||||
$ systemctl start borg
|
||||
|
||||
```bash
|
||||
systemctl start borg
|
||||
```
|
||||
|
||||
Next you can check presence of your backup repository on host Server B:
|
||||
|
||||
```bash
|
||||
BORG_RSH="ssh -i /root/.ssh/id_borg_ed25519 -oStrictHostKeyChecking=yes " borg list servera@host.serverb:~/backup
|
||||
```
|
||||
$ BORG_RSH="ssh -i /root/.ssh/id_borg_ed25519 -oStrictHostKeyChecking=yes " borg list servera@host.serverb:~/backup
|
||||
```
|
||||
|
||||
You will need the passphrase to run ``borg`` commands on the backup repository created on the host Server B.
|
||||
|
||||
## Check regularly your backup
|
||||
|
||||
If you want to be sure to be able to restore your server, you should try to restore regularly the archives. But this process is quite time consumming.
|
||||
|
||||
You should at least:
|
||||
* Keep your apps up to date (if apps are too old, they could be difficult to restore on a more recent recent version)
|
||||
* Check regularly the presence of `info.json` and `db.sql` or `dump.sql` in your apps archives
|
||||
```
|
||||
|
||||
* Keep your apps up to date (if apps are too old, they could be difficult to restore on a more recent recent version)
|
||||
* Check regularly the presence of `info.json` and `db.sql` or `dump.sql` in your apps archives
|
||||
|
||||
```bash
|
||||
borg list ./::ARCHIVE_NAME | grep info.json
|
||||
borg list ./::ARCHIVE_NAME | grep db.sql
|
||||
borg list ./::ARCHIVE_NAME | grep dump.sql
|
||||
```
|
||||
* Be sure to have your passphrase available even if your server is completely broken
|
||||
|
||||
* Be sure to have your passphrase available even if your server is completely broken
|
||||
|
||||
## How to restore a complete system
|
||||
|
||||
*For infos on restoring process, check [this yunohost forum thread](https://forum.yunohost.org/t/restoring-whole-yunohost-from-borg-backups/12705/3) and [that one](https://forum.yunohost.org/t/how-to-properly-backup-and-restore/12583/3), also [using Borg with sshkeys](https://thisiscasperslife.wordpress.com/2017/11/28/using-borg-backup-across-ssh-with-sshkeys/), the [`borg extract` documentation](https://borgbackup.readthedocs.io/en/stable/usage/extract.html), and this [general tutorial on Borg Backup](https://practical-admin.com/blog/backups-using-borg/).*
|
||||
|
||||
In the following explanations:
|
||||
- the server to backup/restore will be called: `yuno`
|
||||
- the remote server that receives and store the back will be called: `rem`
|
||||
- `rem` is accessible at the domain `rem.tld`
|
||||
- the remote user on `rem` which owns the Borg backups will be called `yurem`
|
||||
- backup files will be stored in `rem` in the directory: `/home/yurem/backup`
|
||||
|
||||
* the server to backup/restore will be called: `yuno`
|
||||
* the remote server that receives and store the back will be called: `rem`
|
||||
* `rem` is accessible at the domain `rem.tld`
|
||||
* the remote user on `rem` which owns the Borg backups will be called `yurem`
|
||||
* backup files will be stored in `rem` in the directory: `/home/yurem/backup`
|
||||
|
||||
### Overview
|
||||
|
||||
|
@ -125,6 +144,7 @@ If you don't want to restore the whole system, just some apps, you can skip some
|
|||
The idea here is just to install Borg, not in order to create backups, but only to use Borg commands to import remote backups.
|
||||
|
||||
So for example, you can install it doing the following:
|
||||
|
||||
```bash
|
||||
sudo yunohost app install borg -a "server=rem.tld&ssh_user=yurem&conf=0&data=0&apps=hextris&on_calendar=2:30"
|
||||
```
|
||||
|
@ -200,23 +220,28 @@ sudo yunohost backup restore auto_borg_XX_XX_XX_XX:XX --apps
|
|||
## Tips
|
||||
|
||||
### Edit the list of YunoHost apps to backup
|
||||
``yunohost app setting borg apps -v "nextcloud,wordpress"``
|
||||
|
||||
`yunohost app setting borg apps -v "nextcloud,wordpress"`
|
||||
|
||||
### Other usefull borg commands
|
||||
|
||||
[Get the storage space used by the backup repository on the host server](https://borgbackup.readthedocs.io/en/stable/usage/info.html)
|
||||
``borg info /home/servera/backup``
|
||||
`borg info /home/servera/backup`
|
||||
|
||||
### Backup YunoHost apps with different criticallity levels
|
||||
|
||||
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
|
||||
|
||||
### Settings location
|
||||
|
||||
Settings of apps are in /etc/yunohost/apps/*/settings.yml, so are the settings for borg_ynh as well. Be careful though to not savagely manually edit them if you don't know what you're doing.
|
|
@ -1 +1,3 @@
|
|||
A [Borg](https://borgbackup.readthedocs.io/en/stable/index.html#what-is-borgbackup) 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](https://github.com/YunoHost-Apps/borgserver_ynh) installed on a host server.
|
||||
A [Borg](https://borgbackup.readthedocs.io/en/stable/index.html#what-is-borgbackup) 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](https://github.com/YunoHost-Apps/borgserver_ynh) installed on a host server.
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
You should check out the admin documentation of this app after installation for more info!
|
||||
|
||||
If you selected a remote borg server as backup target, you should now install the "Borg Server" app on __SERVER__ and with the following credentials:
|
||||
|
||||
User: __SSH_USER__
|
||||
|
|
Loading…
Add table
Reference in a new issue