1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/borg_ynh.git synced 2024-09-03 18:16:05 +02:00

Update README.md

This commit is contained in:
Gredin67 2020-04-27 23:38:22 +02:00 committed by GitHub
parent 2057128a41
commit 638e97dfee
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

106
README.md
View file

@ -1,4 +1,4 @@
# Borg Backup for Yunohost
# Borg Backup App for Yunohost
[![Latest Version](https://img.shields.io/badge/version-1.0.3-green.svg?style=flat)](https://github.com/YunoHost-Apps/borg_ynh/releases)
[![Status](https://img.shields.io/badge/status-testing-yellow.svg?style=flat)](https://github.com/YunoHost-Apps/borg_ynh/milestones)
@ -8,23 +8,23 @@
[![Install Borg with YunoHost](https://install-app.yunohost.org/install-with-yunohost.png)](https://install-app.yunohost.org/?app=borg)
A borg implementation for yunohost
A [Borg Backup](https://borgbackup.readthedocs.io/en/stable/index.html#what-is-borgbackup) implementation for yunohost
## Usage
If you want to backup your Server A onto the Server B, you need:
* Domain name of server B: serverB.local
* Name of the user that will be created on server B and that server A will use to ssh on server B: servera
* YunoHost names of apps you want to backup
* Frequency of your backups, see below
## Setup Borg Backup App on Server A
Firstly set up the Borg Backup App (borg_ynh) on the server A you want to backup:
# How does it work? Set up Borg Apps
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_ynh) 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
## Set up Borg Backup App on guest Server A
Firstly, set up the Borg Backup App (``borg_ynh``) on the guest server A you want to backup:
```
$ yunohost app install https://github.com/YunoHost-Apps/borg_ynh
Indicate the domain name of server B where to upload backups: serverB.local
$ 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):
@ -32,69 +32,73 @@ 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):
```
## Syntax to define backup frequency
You can schedule your backup by choosing an other frequency. Some example:
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
### 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
* 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
## Information generated by borg_ynh
At the end of the installation, the app displays the public_key and the user to give to the person who has access to the server B.
### Information generated by Borg Backup
At the end of the installation, the Borg Backup App (´´borg´´) displays the public_key and the user to give to the person who has access to the server B.
```
You should now install the "Borg Server" app on serverb.local and fill questions like this:
You should now install the "Borg Server" app on host.serverb and fill questions like this:
User: servera
Public key: ssh-ed25519 AAAA[...] root@servera.local
Public key: ssh-ed25519 AAAA[...] root@guest.servera
```
This information is also sent by email to the admin of Server A.
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 public_key with this command:
```
$ cat /root/.ssh/id_borg_ed25519.pub
ssh-ed25519 AAAA[...] root@servera.local
ssh-ed25519 AAAA[...] root@guest.servera
```
## Setup Borg Server App on Server B
## 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:
```
$ yunohost app install https://github.com/YunoHost-Apps/borgserver_ynh
$ yunohost app install borgserver
Indicate the ssh user to create: servera
Indicate the public key given by borg_ynh app: ssh-ed25519 AAAA[...] root@servera.local
Indicate the public key given by Borg Backup app (borg) setup: ssh-ed25519 AAAA[...] root@guest.servera
Indicate the storage quota: 5G
```
## Test
At this step your backup should run at the scheduled time. Note that the first backup can take very long, as many data have to be copied through ssh. Following backup are incremental, only additional data from to the last backup will be copied.
# 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 many data have to be copied through ssh. Following backup are incremental: only newly generated data since last backup will be copied.
If you don't want to wait for the scheduled time, you can test to backup by running on Server A:
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 on Server B:
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 CHECK REGULARLY THAT YOUR BACKUP ARE STILL WORKING.
## Edit the apps list to backup
# Usage and documentation
yunohost app setting borg apps -v "nextcloud,wordpress"
## Edit the YunoHost apps list to backup
``yunohost app setting borg apps -v "nextcloud,wordpress"``
## Backup on different server, and apply distinct schedule for apps
## Other usefull borg commands
[Get the storage space used by the backup on the remote server](https://borgbackup.readthedocs.io/en/stable/usage/info.html)
``borg info /home/servera/backup``
You can setup the borg apps several times on the same server so you can backup on several server or manage your backup frequency differently for specific part of your server.
## 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 a same server.
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