From e9dc347468c4a67a9d7031c3383bc0bfeb1d45c3 Mon Sep 17 00:00:00 2001 From: Lionel Coupouchetty-Ramouchetty Date: Sun, 23 Feb 2020 12:23:56 +0100 Subject: [PATCH 01/21] fix: last listed app not being backed up --- conf/backup-with-borg.j2 | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/conf/backup-with-borg.j2 b/conf/backup-with-borg.j2 index d2b9f1b..347cdb4 100644 --- a/conf/backup-with-borg.j2 +++ b/conf/backup-with-borg.j2 @@ -30,7 +30,14 @@ fi # Backup all apps independently apps=$(yunohost app setting {{ app }} apps) for app in $(yunohost app list --installed -b | grep id: | cut -d: -f2); do - if [[ "$apps" = *"$app,"* ]] || [ "$apps" = "all" ]; then + backup_app=false + for selected_app in $(echo $apps | tr "," " ");do + if [[ "$selected_app" == "$app" ]] || [ "$apps" = "all" ]; then + backup_app=true + break + fi + done + if [ "$backup_app" == "true" ];then yunohost backup create $ignore_system -n auto_$app --method {{ app }}_app --apps $app fi done From fd760a65c02e1995141329f966a9f710b99948c3 Mon Sep 17 00:00:00 2001 From: Gredin67 <35761345+Gredin67@users.noreply.github.com> Date: Sat, 18 Apr 2020 19:08:25 +0200 Subject: [PATCH 02/21] Improve setup instructions --- README.md | 33 ++++++++++++++++++++------------- 1 file changed, 20 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index f88752d..e1b17b6 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Borg for Yunohost +# Borg Backup 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) @@ -12,15 +12,19 @@ An experimental borg implementation for yunohost ## Usage -If you want to backup your server A onto the server B. +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 app on Server A +## Setup Borg Backup App on Server A -Firstly set up this app on the server A you want to backup: +Firstly set up the Borg Backup App (borg_ynh) on the server A you want to backup: ``` $ yunohost app install https://github.com/YunoHost-Apps/borg_ynh -Indicate the server where you want put your backups: serverB.local +Indicate the domain name of server B where to upload backups: serverB.local 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): @@ -28,6 +32,7 @@ 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: @@ -47,20 +52,22 @@ Sat *-*-1..7 18:00:00 : The first saturday of every month at 18:00 See here for more info : https://wiki.archlinux.org/index.php/Systemd/Timers#Realtime_timer -At the end of the installation, the app display you the public_key and the user to give to the person who has access to the server B. +## 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. ``` You should now install the "Borg Server" app on serverb.local and fill questions like this: User: servera Public key: ssh-ed25519 AAAA[...] root@servera.local ``` - -If you don't find the mail and you don't see the message in the log bar you can found the public_key with this command: +This information is also sent by email to the admin of 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 ``` -## Setup Borg Server app on Server B +## Setup Borg Server App on Server B ``` $ yunohost app install https://github.com/YunoHost-Apps/borgserver_ynh @@ -70,14 +77,14 @@ Indicate the storage quota: 5G ``` ## Test -At this step your backup should schedule. +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. -If you want to be sure, you can test it by running on server A: +If you don't want to wait for the scheduled time, you can test to backup by running on Server A: ``` $ service borg start ``` -Next you can check, your backup on server B +Next you can check presence of your backup on Server B: ``` $ borg list /home/servera/backup ``` @@ -90,4 +97,4 @@ yunohost app setting borg apps -v "nextcloud,wordpress" ## Backup on different server, and apply distinct schedule for apps -You can setup the borg apps several times on the same server so you can backup on several server or manage your frequency backup differently for specific part of your server. +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. From cbd97e84ae73d317edff7c6f976f7d26ee1e3ccd Mon Sep 17 00:00:00 2001 From: Gredin67 <35761345+Gredin67@users.noreply.github.com> Date: Sat, 18 Apr 2020 19:40:29 +0200 Subject: [PATCH 03/21] Improve questions --- manifest.json | 48 ++++++++++++++++++++++++++++-------------------- 1 file changed, 28 insertions(+), 20 deletions(-) diff --git a/manifest.json b/manifest.json index 139592d..16cf05a 100644 --- a/manifest.json +++ b/manifest.json @@ -3,8 +3,8 @@ "id": "borg", "packaging_format": 1, "description": { - "en": "Backup your server with borg.", - "fr": "Sauvegarder votre serveur avec borg." + "en": "Backup this Server A on a Server B with borg.", + "fr": "Sauvegardez ce Serveur A sur un Serveur B avec borg." }, "version": "1.1.10~ynh1", "url": "https://borgbackup.readthedocs.io", @@ -24,37 +24,45 @@ { "name": "server", "ask": { - "en": "Indicate the server where you want put your backups", - "fr": "Indiquez le serveur où vous voulez faire vos sauvegardes" + "en": "Give the domain name of Server B where to upload backups", + "fr": "Indiquez nom de domaine du Serveur B où mettre vos sauvegardes" }, "help":{ - "en": "If the ssh remote server doesn't use a standard port, you could specify it with DOMAIN:PORT", - "fr": "Si le serveur ssh n'utilise pas un port standard, vous pouvez le spécifier avec DOMAIN:PORT" + "en": "If the ssh remote server of B does not use a standard port, you could specify it with DOMAIN:PORT", + "fr": "Si le serveur ssh de B n'utilise pas un port standard, vous pouvez le spécifier avec DOMAIN:PORT" }, - "example": "example.com:22" + "example": "serverb.local:22" }, { "name": "ssh_user", "ask": { - "en": "Indicate the ssh user to use to connect on this server", - "fr": "Indiquez l'utilisateur ssh à utiliser pour se connecter au serveur" + "en": "Give the ssh user to use to connect on Server B", + "fr": "Indiquez l'utilisateur ssh pour se connecter au Serveur B" }, - "example": "john" + "help":{ + "en": "It is not a user of this Server A. The ssh user will be created by installation of Borg Server App on Server B", + "fr": "Ce n'est pas un utilisateur de ce Serveur A. L'utilisateur ssh sera créé sur le Serveur B lors de l'installation de l'App Borg Server" + }, + "example": "servera" }, { "name": "passphrase", "type": "password", "ask": { - "en": "Indicate a strong passphrase, that you will keep preciously if you want to be able to use your backups", - "fr": "Indiquez une phrase de passe forte que vous garderez précieusement si vous voulez être en mesure d'utiliser vos sauvegardes" + "en": "Give a strong passphrase to encrypt your backups. No blank space", + "fr": "Indiquez une phrase de passe forte pour chiffre vos sauvegardes. Sans espaces" } + "help":{ + "en": "Keep it safe! ...if you want to be able to restore. Do not communicate it to Server B holder or anyone else. ", + "fr": "Gardez-la précieusement! ...si vous voulez pouvoir restaurer. Ne donnez pas la clé au possesseur du Serveur B, ni personne." + }, }, { "name": "conf", "type": "boolean", "ask": { - "en": "Would you like to backup your YunoHost configuration ?", - "fr": "Souhaitez-vous effectuer des sauvegardes des configurations du système YunoHost ?" + "en": "Backup your YunoHost configuration ?", + "fr": "Sauvegarder la configuration du système YunoHost ?" }, "default": true }, @@ -62,24 +70,24 @@ "name": "data", "type": "boolean", "ask": { - "en": "Would you like to backup mails and user home directory ?", - "fr": "Souhaitez-vous effectuer des sauvegardes des mails et des répertoire des utilisateurs ?" + "en": "Backup emails and user home directory ?", + "fr": "Sauvegarder les mails et les répertoires utilisateur ?" }, "default": true }, { "name": "apps", "ask": { - "en": "Which apps would you backup (list separated by comma or 'all') ?", - "fr": "Souhaitez-vous effectuer des sauvegardes de vos applications ?" + "en": "Which apps to backup (list separated by comma or 'all') ?", + "fr": "Quelles applications sauvegarder (liste séparée par virgule ou 'all' ?" }, "default": "all" }, { "name": "on_calendar", "ask": { - "en": "Indicate the backup frequency (see systemd OnCalendar format)", - "fr": "Indiquez la fréquence de la sauvegarde (voir le format OnCalendar de systemd)" + "en": "Give the backup frequency (see systemd OnCalendar format)", + "fr": "Indiquez la fréquence de sauvegarde (voir le format OnCalendar de systemd)" }, "example": "Daily", "default": "Daily" From f97e9f39ed2a199c1df6ce7095e677a4ed50c2ea Mon Sep 17 00:00:00 2001 From: "ljf (zamentur)" Date: Fri, 24 Apr 2020 21:20:24 +0200 Subject: [PATCH 04/21] [enh] Remove experimental --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index e1b17b6..b31d4d5 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ [![Install Borg with YunoHost](https://install-app.yunohost.org/install-with-yunohost.png)](https://install-app.yunohost.org/?app=borg) -An experimental borg implementation for yunohost +A borg implementation for yunohost ## Usage From 381c1b25fee6b426f2b70d786b8a53fc9517b3b3 Mon Sep 17 00:00:00 2001 From: Gredin67 <35761345+Gredin67@users.noreply.github.com> Date: Mon, 27 Apr 2020 00:12:48 +0200 Subject: [PATCH 05/21] Update manifest.json Co-Authored-By: Alexandre Aubin --- manifest.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifest.json b/manifest.json index 16cf05a..6c9756f 100644 --- a/manifest.json +++ b/manifest.json @@ -51,7 +51,7 @@ "ask": { "en": "Give a strong passphrase to encrypt your backups. No blank space", "fr": "Indiquez une phrase de passe forte pour chiffre vos sauvegardes. Sans espaces" - } + }, "help":{ "en": "Keep it safe! ...if you want to be able to restore. Do not communicate it to Server B holder or anyone else. ", "fr": "Gardez-la précieusement! ...si vous voulez pouvoir restaurer. Ne donnez pas la clé au possesseur du Serveur B, ni personne." From 6f054412d242da41fa9a856289f5b20d393d2576 Mon Sep 17 00:00:00 2001 From: Gredin67 <35761345+Gredin67@users.noreply.github.com> Date: Mon, 27 Apr 2020 00:12:58 +0200 Subject: [PATCH 06/21] Update manifest.json Co-Authored-By: Alexandre Aubin --- manifest.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/manifest.json b/manifest.json index 6c9756f..2258a6f 100644 --- a/manifest.json +++ b/manifest.json @@ -3,8 +3,8 @@ "id": "borg", "packaging_format": 1, "description": { - "en": "Backup this Server A on a Server B with borg.", - "fr": "Sauvegardez ce Serveur A sur un Serveur B avec borg." + "en": "Backup your server on another server using Borg.", + "fr": "Sauvegardez votre serveur sur un autre serveur avec Borg." }, "version": "1.1.10~ynh1", "url": "https://borgbackup.readthedocs.io", From 9fe2d95447dd671293149f78add871767cceb7b7 Mon Sep 17 00:00:00 2001 From: Gredin67 <35761345+Gredin67@users.noreply.github.com> Date: Mon, 27 Apr 2020 00:13:26 +0200 Subject: [PATCH 07/21] Update manifest.json Co-Authored-By: Alexandre Aubin --- manifest.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/manifest.json b/manifest.json index 2258a6f..38902ce 100644 --- a/manifest.json +++ b/manifest.json @@ -24,8 +24,8 @@ { "name": "server", "ask": { - "en": "Give the domain name of Server B where to upload backups", - "fr": "Indiquez nom de domaine du Serveur B où mettre vos sauvegardes" + "en": "What is the domain name of the remote server when backups will be sent?", + "fr": "Quel est le nom de domaine du serveur distant sur lequel seront envoyés les sauvegardes ?" }, "help":{ "en": "If the ssh remote server of B does not use a standard port, you could specify it with DOMAIN:PORT", From efb70b4ac98a8697e9d5d69e3cc5d3f9bbd607fe Mon Sep 17 00:00:00 2001 From: Gredin67 <35761345+Gredin67@users.noreply.github.com> Date: Mon, 27 Apr 2020 00:13:34 +0200 Subject: [PATCH 08/21] Update manifest.json Co-Authored-By: Alexandre Aubin --- manifest.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/manifest.json b/manifest.json index 38902ce..6c5e3ed 100644 --- a/manifest.json +++ b/manifest.json @@ -36,8 +36,8 @@ { "name": "ssh_user", "ask": { - "en": "Give the ssh user to use to connect on Server B", - "fr": "Indiquez l'utilisateur ssh pour se connecter au Serveur B" + "en": "Which SSH username should be used to connect on the remote server?", + "fr": "Quel utilisateur faut-il utiliser pour se connecter au serveur distant ?" }, "help":{ "en": "It is not a user of this Server A. The ssh user will be created by installation of Borg Server App on Server B", From 7e14f8d95884eac4b4f3945c58f63e863850b119 Mon Sep 17 00:00:00 2001 From: Gredin67 <35761345+Gredin67@users.noreply.github.com> Date: Mon, 27 Apr 2020 00:13:43 +0200 Subject: [PATCH 09/21] Update manifest.json Co-Authored-By: Alexandre Aubin --- manifest.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/manifest.json b/manifest.json index 6c5e3ed..cdccb33 100644 --- a/manifest.json +++ b/manifest.json @@ -61,8 +61,8 @@ "name": "conf", "type": "boolean", "ask": { - "en": "Backup your YunoHost configuration ?", - "fr": "Sauvegarder la configuration du système YunoHost ?" + "en": "Should Borg backup your YunoHost configuration ?", + "fr": "Est-ce que Borg doit sauvegarder la configuration du système YunoHost ?" }, "default": true }, From 4881894b3c03a01cd182b15175dfaef33575e71b Mon Sep 17 00:00:00 2001 From: Gredin67 <35761345+Gredin67@users.noreply.github.com> Date: Mon, 27 Apr 2020 00:13:51 +0200 Subject: [PATCH 10/21] Update manifest.json Co-Authored-By: Alexandre Aubin --- manifest.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/manifest.json b/manifest.json index cdccb33..fae4baa 100644 --- a/manifest.json +++ b/manifest.json @@ -70,8 +70,8 @@ "name": "data", "type": "boolean", "ask": { - "en": "Backup emails and user home directory ?", - "fr": "Sauvegarder les mails et les répertoires utilisateur ?" + "en": "Should Borg backup emails and user home directory ?", + "fr": "Est-ce que Borg doit sauvegarder les mails et les répertoires des utilisateurs ?" }, "default": true }, From a35d654e1b4d6c449ff70df00a9883e089e5ed64 Mon Sep 17 00:00:00 2001 From: Gredin67 <35761345+Gredin67@users.noreply.github.com> Date: Mon, 27 Apr 2020 00:13:58 +0200 Subject: [PATCH 11/21] Update manifest.json Co-Authored-By: Alexandre Aubin --- manifest.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/manifest.json b/manifest.json index fae4baa..f2d703d 100644 --- a/manifest.json +++ b/manifest.json @@ -78,8 +78,8 @@ { "name": "apps", "ask": { - "en": "Which apps to backup (list separated by comma or 'all') ?", - "fr": "Quelles applications sauvegarder (liste séparée par virgule ou 'all' ?" + "en": "Which apps should Borg backup (list separated by comma or 'all') ?", + "fr": "Quelles applications doivent être sauvergées par Borg (liste séparée par virgule ou 'all' ?" }, "default": "all" }, From 20b98a3258749f307c704c70b9c872ba6a7fbcd6 Mon Sep 17 00:00:00 2001 From: Gredin67 <35761345+Gredin67@users.noreply.github.com> Date: Mon, 27 Apr 2020 00:14:05 +0200 Subject: [PATCH 12/21] Update manifest.json Co-Authored-By: Alexandre Aubin --- manifest.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/manifest.json b/manifest.json index f2d703d..1f7f230 100644 --- a/manifest.json +++ b/manifest.json @@ -86,8 +86,8 @@ { "name": "on_calendar", "ask": { - "en": "Give the backup frequency (see systemd OnCalendar format)", - "fr": "Indiquez la fréquence de sauvegarde (voir le format OnCalendar de systemd)" + "en": "At which frequency should the backups be performed ? (see systemd OnCalendar format)", + "fr": "À quelle fréquence les sauvegardes doivent-elles être effectuées ? (voir le format OnCalendar de systemd)" }, "example": "Daily", "default": "Daily" From 5f2bc6d37157341b47f4cbe3ddb4e4c379989ff6 Mon Sep 17 00:00:00 2001 From: Gredin67 <35761345+Gredin67@users.noreply.github.com> Date: Mon, 27 Apr 2020 00:14:14 +0200 Subject: [PATCH 13/21] Update manifest.json Co-Authored-By: Alexandre Aubin --- manifest.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/manifest.json b/manifest.json index 1f7f230..881a0ca 100644 --- a/manifest.json +++ b/manifest.json @@ -28,8 +28,8 @@ "fr": "Quel est le nom de domaine du serveur distant sur lequel seront envoyés les sauvegardes ?" }, "help":{ - "en": "If the ssh remote server of B does not use a standard port, you could specify it with DOMAIN:PORT", - "fr": "Si le serveur ssh de B n'utilise pas un port standard, vous pouvez le spécifier avec DOMAIN:PORT" + "en": "If this remote server does uses a custom SSH port (different from 22), you can specify it with DOMAIN:PORT", + "fr": "Si le serveur distant utilise un port particulier pour SSH (différent de 22), vous pouvez le spécifier avec DOMAIN:PORT" }, "example": "serverb.local:22" }, From 18904280748500fbbeb7c4225044833f65ba9edd Mon Sep 17 00:00:00 2001 From: Gredin67 <35761345+Gredin67@users.noreply.github.com> Date: Mon, 27 Apr 2020 00:14:28 +0200 Subject: [PATCH 14/21] Update manifest.json Co-Authored-By: Alexandre Aubin --- manifest.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/manifest.json b/manifest.json index 881a0ca..2e5b0ea 100644 --- a/manifest.json +++ b/manifest.json @@ -40,8 +40,8 @@ "fr": "Quel utilisateur faut-il utiliser pour se connecter au serveur distant ?" }, "help":{ - "en": "It is not a user of this Server A. The ssh user will be created by installation of Borg Server App on Server B", - "fr": "Ce n'est pas un utilisateur de ce Serveur A. L'utilisateur ssh sera créé sur le Serveur B lors de l'installation de l'App Borg Server" + "en": "It is not meant to be an existing user on this origin server. Instead, it will be created *on the remote server* during the installation of the Borg Server app.", + "fr": "Cet utilisateur n'est pas censé exister sur ce serveur. Il sera créé *sur le serveur de distant* lors de l'installation de l'app Borg Server sur celui-ci." }, "example": "servera" }, From 2057128a411144c9a338cb23b93c62368a6222e2 Mon Sep 17 00:00:00 2001 From: Gredin67 <35761345+Gredin67@users.noreply.github.com> Date: Mon, 27 Apr 2020 00:14:38 +0200 Subject: [PATCH 15/21] Update manifest.json Co-Authored-By: Alexandre Aubin --- manifest.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifest.json b/manifest.json index 2e5b0ea..f886deb 100644 --- a/manifest.json +++ b/manifest.json @@ -49,7 +49,7 @@ "name": "passphrase", "type": "password", "ask": { - "en": "Give a strong passphrase to encrypt your backups. No blank space", + "en": "Provide a strong passphrase to encrypt your backups. No blank space", "fr": "Indiquez une phrase de passe forte pour chiffre vos sauvegardes. Sans espaces" }, "help":{ From 638e97dfee164dcf7aea6af2455f54b2e4064321 Mon Sep 17 00:00:00 2001 From: Gredin67 <35761345+Gredin67@users.noreply.github.com> Date: Mon, 27 Apr 2020 23:38:22 +0200 Subject: [PATCH 16/21] Update README.md --- README.md | 106 ++++++++++++++++++++++++++++-------------------------- 1 file changed, 55 insertions(+), 51 deletions(-) diff --git a/README.md b/README.md index b31d4d5..581172b 100644 --- a/README.md +++ b/README.md @@ -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 From f64ff46f725cc7c16093df334f6146eaff24647d Mon Sep 17 00:00:00 2001 From: Gredin67 <35761345+Gredin67@users.noreply.github.com> Date: Mon, 27 Apr 2020 23:58:41 +0200 Subject: [PATCH 17/21] Update README.md --- README.md | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index 581172b..df7493b 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Borg Backup App 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,20 +8,20 @@ [![Install Borg with YunoHost](https://install-app.yunohost.org/install-with-yunohost.png)](https://install-app.yunohost.org/?app=borg) -A [Borg Backup](https://borgbackup.readthedocs.io/en/stable/index.html#what-is-borgbackup) implementation for yunohost +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. # 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*!! +* 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 ## 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: +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 @@ -45,14 +45,14 @@ You can schedule regular backups at specific time. Only one regular time schedul 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 public_key and the user to give to the person who has access to the server B. +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[...] root@guest.servera ``` 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: +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[...] root@guest.servera @@ -68,7 +68,7 @@ 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 many data have to be copied through ssh. Following backup are incremental: only newly generated data since last backup will be copied. +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: ``` @@ -79,17 +79,17 @@ 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 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. +YOU SHOULD REGULARLY RESTORE YOUR BACKUPS TO TEST THEIR VALIDITY. # Usage and documentation -## Edit the YunoHost apps list to backup +## Edit the list of YunoHost apps to backup ``yunohost app setting borg apps -v "nextcloud,wordpress"`` ## 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) +[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`` ## Backup Yunohost apps with different criticallity levels @@ -98,7 +98,7 @@ 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. +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 From d50d1537a624c21871cf22cd2b75e5cf7957ebe1 Mon Sep 17 00:00:00 2001 From: Gredin67 <35761345+Gredin67@users.noreply.github.com> Date: Tue, 28 Apr 2020 00:19:22 +0200 Subject: [PATCH 18/21] Improve questions --- manifest.json | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/manifest.json b/manifest.json index f886deb..72235d4 100644 --- a/manifest.json +++ b/manifest.json @@ -1,10 +1,10 @@ { - "name": "Borg", + "name": "Borg Backup App", "id": "borg", "packaging_format": 1, "description": { - "en": "Backup your server on another server using Borg.", - "fr": "Sauvegardez votre serveur sur un autre serveur avec Borg." + "en": "Backup your server on a host server using Borg.", + "fr": "Sauvegardez votre serveur sur un serveur distant avec Borg." }, "version": "1.1.10~ynh1", "url": "https://borgbackup.readthedocs.io", @@ -24,45 +24,45 @@ { "name": "server", "ask": { - "en": "What is the domain name of the remote server when backups will be sent?", + "en": "What is the domain name of the host server where backups will be sent?", "fr": "Quel est le nom de domaine du serveur distant sur lequel seront envoyés les sauvegardes ?" }, "help":{ - "en": "If this remote server does uses a custom SSH port (different from 22), you can specify it with DOMAIN:PORT", + "en": "If this host server does use a custom SSH port (different from 22), you can specify it with DOMAIN:PORT", "fr": "Si le serveur distant utilise un port particulier pour SSH (différent de 22), vous pouvez le spécifier avec DOMAIN:PORT" }, - "example": "serverb.local:22" + "example": "host.serverb:22" }, { "name": "ssh_user", "ask": { - "en": "Which SSH username should be used to connect on the remote server?", + "en": "Which SSH username should be used to connect to the host server?", "fr": "Quel utilisateur faut-il utiliser pour se connecter au serveur distant ?" }, "help":{ - "en": "It is not meant to be an existing user on this origin server. Instead, it will be created *on the remote server* during the installation of the Borg Server app.", - "fr": "Cet utilisateur n'est pas censé exister sur ce serveur. Il sera créé *sur le serveur de distant* lors de l'installation de l'app Borg Server sur celui-ci." + "en": "It is not meant to be an existing user on this guest server. Instead, it will be created *on the host server* during the installation of the Borg Server App.", + "fr": "Cet utilisateur n'est pas censé exister sur ce serveur. Il sera créé *sur le serveur distant* lors de l'installation de l'App Borg Server sur celui-ci." }, - "example": "servera" + "example": "borgservera" }, { "name": "passphrase", "type": "password", "ask": { "en": "Provide a strong passphrase to encrypt your backups. No blank space", - "fr": "Indiquez une phrase de passe forte pour chiffre vos sauvegardes. Sans espaces" + "fr": "Indiquez une phrase de passe forte pour chiffrer vos sauvegardes. Sans espaces" }, "help":{ - "en": "Keep it safe! ...if you want to be able to restore. Do not communicate it to Server B holder or anyone else. ", - "fr": "Gardez-la précieusement! ...si vous voulez pouvoir restaurer. Ne donnez pas la clé au possesseur du Serveur B, ni personne." - }, + "en": "Keep it safe! ...if you want to be able to restore. Do not communicate it to host Server holder or anyone else. ", + "fr": "Gardez-la précieusement! ...si vous voulez pouvoir restaurer. Ne donnez pas la clé au possesseur du Serveur distant, ni personne." + } }, { "name": "conf", "type": "boolean", "ask": { "en": "Should Borg backup your YunoHost configuration ?", - "fr": "Est-ce que Borg doit sauvegarder la configuration du système YunoHost ?" + "fr": "Borg doit-il sauvegarder la configuration système YunoHost ?" }, "default": true }, @@ -71,7 +71,7 @@ "type": "boolean", "ask": { "en": "Should Borg backup emails and user home directory ?", - "fr": "Est-ce que Borg doit sauvegarder les mails et les répertoires des utilisateurs ?" + "fr": "Borg doit-elle sauvegarder les mails et les répertoires des utilisateurs ?" }, "default": true }, @@ -79,17 +79,17 @@ "name": "apps", "ask": { "en": "Which apps should Borg backup (list separated by comma or 'all') ?", - "fr": "Quelles applications doivent être sauvergées par Borg (liste séparée par virgule ou 'all' ?" + "fr": "Quelles applications doivent être sauvegardées par Borg (liste séparée par virgule ou 'all' ?" }, "default": "all" }, { "name": "on_calendar", "ask": { - "en": "At which frequency should the backups be performed ? (see systemd OnCalendar format)", + "en": "With which regular time schedule should the backups be performed ? (see systemd OnCalendar format)", "fr": "À quelle fréquence les sauvegardes doivent-elles être effectuées ? (voir le format OnCalendar de systemd)" }, - "example": "Daily", + "example": "Monthly or Weekly or Daily or Hourly or 4:00 or 5,17:00 or Sat --1..7 18:00:00", "default": "Daily" } ] From ecec94aec06662d3ef66a26358e892e2eadd1e68 Mon Sep 17 00:00:00 2001 From: Gredin67 <35761345+Gredin67@users.noreply.github.com> Date: Wed, 29 Apr 2020 20:39:58 +0200 Subject: [PATCH 19/21] Update README.md --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index df7493b..db57ed7 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ A [Borg](https://borgbackup.readthedocs.io/en/stable/index.html#what-is-borgback 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*!! +* **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 @@ -98,6 +98,7 @@ 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 From 29d58f601587aa1289254ae3fd1de44f7a25335c Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Fri, 5 Jun 2020 12:50:05 +0200 Subject: [PATCH 20/21] Fix app backup following disappearance of option -b --- conf/backup-with-borg.j2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conf/backup-with-borg.j2 b/conf/backup-with-borg.j2 index 347cdb4..d6b0f15 100644 --- a/conf/backup-with-borg.j2 +++ b/conf/backup-with-borg.j2 @@ -29,7 +29,7 @@ fi # Backup all apps independently apps=$(yunohost app setting {{ app }} apps) -for app in $(yunohost app list --installed -b | grep id: | cut -d: -f2); do +for app in $(ls /etc/yunohost/apps/*/scripts/backup | cut -d / -f 5); do backup_app=false for selected_app in $(echo $apps | tr "," " ");do if [[ "$selected_app" == "$app" ]] || [ "$apps" = "all" ]; then From a68702d2efebc1e5c4ff1edbfa90ff96f0951bdb Mon Sep 17 00:00:00 2001 From: "ljf (zamentur)" Date: Wed, 17 Jun 2020 23:50:24 +0200 Subject: [PATCH 21/21] [fix] all option broken --- conf/backup-with-borg.j2 | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/conf/backup-with-borg.j2 b/conf/backup-with-borg.j2 index d6b0f15..68df3b1 100644 --- a/conf/backup-with-borg.j2 +++ b/conf/backup-with-borg.j2 @@ -31,12 +31,16 @@ fi apps=$(yunohost app setting {{ app }} apps) for app in $(ls /etc/yunohost/apps/*/scripts/backup | cut -d / -f 5); do backup_app=false - for selected_app in $(echo $apps | tr "," " ");do - if [[ "$selected_app" == "$app" ]] || [ "$apps" = "all" ]; then + if [[ "$apps" = "all" ]]; then backup_app=true - break - fi - done + else + for selected_app in $(echo $apps | tr "," " ");do + if [[ "$selected_app" == "$app" ]]; then + backup_app=true + break + fi + done + fi if [ "$backup_app" == "true" ];then yunohost backup create $ignore_system -n auto_$app --method {{ app }}_app --apps $app fi