From 0062d0c3c8cc4ee3886855a1929420cdd7cd8cca Mon Sep 17 00:00:00 2001 From: "ljf (zamentur)" Date: Wed, 14 Apr 2021 13:05:25 +0200 Subject: [PATCH 01/11] [fix] Legacy archive name pruning mess --- conf/backup_method | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/conf/backup_method b/conf/backup_method index 0b3c1ed..5d00e81 100644 --- a/conf/backup_method +++ b/conf/backup_method @@ -30,7 +30,7 @@ do_backup() { repo="$3" size="$4" description="$5" - current_date=$(date +"%d_%m_%y_%H:%M") + current_date=$(date +"%Y-%m-%d_%H:%M") pushd "$work_dir" set +e if borg init -e repokey "$repo" ; then @@ -46,12 +46,18 @@ This is an automated message from your beloved YunoHost server." | /usr/bin/mail fi set -e - borg create "$repo::${name}_${current_date}" ./ 2>&1 >/dev/null | log_with_timestamp + borg create "$repo::_${name}-${current_date}" ./ 2>&1 >/dev/null | log_with_timestamp popd # About thi _20 it's a crazy fix to avoid pruning wordpress__2 # if you prune wordpress - borg prune "$repo" -P ${name}_20 --keep-hourly 2 --keep-daily=7 --keep-weekly=8 --keep-monthly=12 2>&1 >/dev/null | log_with_timestamp + borg prune "$repo" -P "_${name}-" --keep-hourly 2 --keep-daily=7 --keep-weekly=8 --keep-monthly=12 2>&1 >/dev/null | log_with_timestamp + + # Prune legacy archive name without error on wordpress/wordpress__2 + borg prune "$repo" -P "${name}_" --keep-within 2m --keep-monthly=12 2>&1 >/dev/null | log_with_timestamp + + # We prune potential manual backup older than 1 year + borg prune "$repo" --keep-within 1y 2>&1 >/dev/null | log_with_timestamp } do_mount() { From d951888470e7d8beccc62a448a5daa3789729925 Mon Sep 17 00:00:00 2001 From: "ljf (zamentur)" Date: Wed, 14 Apr 2021 13:05:56 +0200 Subject: [PATCH 02/11] [fix] New version --- manifest.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifest.json b/manifest.json index 211c2c5..fe0c170 100644 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "en": "Backup your server on a host server using Borg.", "fr": "Sauvegardez votre serveur sur un serveur distant avec Borg." }, - "version": "1.1.16~ynh17", + "version": "1.1.16~ynh18", "url": "https://borgbackup.readthedocs.io", "license": "BSD-3-Clause", "maintainer": { From 6b253039a9ac58d295b517346b82173121efb68f Mon Sep 17 00:00:00 2001 From: "ljf (zamentur)" Date: Wed, 14 Apr 2021 19:01:08 +0200 Subject: [PATCH 03/11] [fix] No failed email if borg create failed ! --- conf/backup_method | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conf/backup_method b/conf/backup_method index 5d00e81..6094b62 100644 --- a/conf/backup_method +++ b/conf/backup_method @@ -1,6 +1,6 @@ #!/bin/bash -set -e +set -eo pipefail app="${0#"./05-"}" app="${app%"_app"}" From 0c7e302f5b85085dce2e767ce6f1d3ca69c399e1 Mon Sep 17 00:00:00 2001 From: "ljf (zamentur)" Date: Wed, 14 Apr 2021 19:22:40 +0200 Subject: [PATCH 04/11] [fix] Warning in diagnosis --- scripts/install | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/install b/scripts/install index 72ad751..8b78dba 100755 --- a/scripts/install +++ b/scripts/install @@ -135,7 +135,8 @@ systemctl start $app.timer #================================================= ynh_script_progression --message="Integrating service in YunoHost..." --weight=1 -yunohost service add $app --description="Deduplicating backup program" +# Inactive services are ignored cause it's a timer +yunohost service add $app --description="Deduplicating backup program" --test_status="systemctl show borg.service -p ActiveState --value | grep -v failed" #================================================= From c648bd357ed10deba2d6a846a55eb84e0102784f Mon Sep 17 00:00:00 2001 From: "ljf (zamentur)" Date: Wed, 14 Apr 2021 19:23:07 +0200 Subject: [PATCH 05/11] [fix] Warning in diagnosis --- scripts/upgrade | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/scripts/upgrade b/scripts/upgrade index 8e0c8a1..12d12df 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -141,7 +141,9 @@ chmod u+w /var/log/${app} #================================================= ynh_script_progression --message="Integrating service in YunoHost..." --weight=1 -yunohost service add $app --description="Deduplicating backup program" +# Inactive services are ignored cause it's a timer +yunohost service add $app --description="Deduplicating backup program" --test_status="systemctl show borg.service -p ActiveState --value | grep -v failed" + #================================================= # END OF SCRIPT From 6de5b9ab1602049a9fde4b6141dd20bad01185d6 Mon Sep 17 00:00:00 2001 From: "ljf (zamentur)" Date: Wed, 14 Apr 2021 19:23:29 +0200 Subject: [PATCH 06/11] [fix] Warning in diagnosis --- scripts/restore | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/scripts/restore b/scripts/restore index 6a70a59..dc9ac0d 100755 --- a/scripts/restore +++ b/scripts/restore @@ -75,7 +75,9 @@ systemctl enable $app.service --quiet #================================================= ynh_script_progression --message="Integrating service in YunoHost..." --weight=1 -yunohost service add $app --description="Deduplicating backup program" +# Inactive services are ignored cause it's a timer +yunohost service add $app --description="Deduplicating backup program" --test_status="systemctl show borg.service -p ActiveState --value | grep -v failed" + #================================================= # END OF SCRIPT From 23ddcef627250b1d416423fb007782989bbcea5a Mon Sep 17 00:00:00 2001 From: ljf Date: Wed, 14 Apr 2021 19:34:34 +0200 Subject: [PATCH 07/11] [fix] Failed status borg__2 --- manifest.json | 2 +- scripts/install | 2 +- scripts/restore | 2 +- scripts/upgrade | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/manifest.json b/manifest.json index fe0c170..fa453ba 100644 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "en": "Backup your server on a host server using Borg.", "fr": "Sauvegardez votre serveur sur un serveur distant avec Borg." }, - "version": "1.1.16~ynh18", + "version": "1.1.16~ynh19", "url": "https://borgbackup.readthedocs.io", "license": "BSD-3-Clause", "maintainer": { diff --git a/scripts/install b/scripts/install index 8b78dba..834f0a0 100755 --- a/scripts/install +++ b/scripts/install @@ -136,7 +136,7 @@ systemctl start $app.timer ynh_script_progression --message="Integrating service in YunoHost..." --weight=1 # Inactive services are ignored cause it's a timer -yunohost service add $app --description="Deduplicating backup program" --test_status="systemctl show borg.service -p ActiveState --value | grep -v failed" +yunohost service add $app --description="Deduplicating backup program" --test_status="systemctl show $app.service -p ActiveState --value | grep -v failed" #================================================= diff --git a/scripts/restore b/scripts/restore index dc9ac0d..60c7658 100755 --- a/scripts/restore +++ b/scripts/restore @@ -76,7 +76,7 @@ systemctl enable $app.service --quiet ynh_script_progression --message="Integrating service in YunoHost..." --weight=1 # Inactive services are ignored cause it's a timer -yunohost service add $app --description="Deduplicating backup program" --test_status="systemctl show borg.service -p ActiveState --value | grep -v failed" +yunohost service add $app --description="Deduplicating backup program" --test_status="systemctl show $app.service -p ActiveState --value | grep -v failed" #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 12d12df..c7b8930 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -142,7 +142,7 @@ chmod u+w /var/log/${app} ynh_script_progression --message="Integrating service in YunoHost..." --weight=1 # Inactive services are ignored cause it's a timer -yunohost service add $app --description="Deduplicating backup program" --test_status="systemctl show borg.service -p ActiveState --value | grep -v failed" +yunohost service add $app --description="Deduplicating backup program" --test_status="systemctl show $app.service -p ActiveState --value | grep -v failed" #================================================= From f02c8116a8f8d5c1e3d9cb681f959c0b2f96275a Mon Sep 17 00:00:00 2001 From: ljf Date: Wed, 14 Apr 2021 20:03:20 +0200 Subject: [PATCH 08/11] [enh] Add precision about usage with borgserver_ynh --- manifest.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifest.json b/manifest.json index fa453ba..3386479 100644 --- a/manifest.json +++ b/manifest.json @@ -29,7 +29,7 @@ "fr": "Dans quel repo borg souhaitez-vous sauvegarder vos fichiers ?" }, "help":{ - "en": "Specify a remote repository using this format: ssh://USER@DOMAIN.TLD:PORT/~/backup . 'USER' is *not* meant to be an existing user on the guest server. Instead, it will be created *on the host server* during the installation of the Borg Server App. It's also possible to use a local repository using a syntax such as /mount/my_external_harddrive/backups" + "en": "Specify a local repository like /mount/my_external_harddrive/backups or a remote repository using this format: ssh://USER@DOMAIN.TLD:PORT/~/backup . If you plan to use borgserver_ynh app : 'USER' is *not* meant to be an existing user on the guest server, instead, it will be created *on the host server* during the installation of the Borg Server App. With borgserver_ynh apps you can't specify another repo path than ~/backup." }, "example": "ssh://john@serverb.tld:22/~/backup" }, From a60775457d574de1428587aea75e83f7ecc1df3b Mon Sep 17 00:00:00 2001 From: "ljf (zamentur)" Date: Wed, 14 Apr 2021 20:07:21 +0200 Subject: [PATCH 09/11] [fix] Yunohost requirements --- manifest.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifest.json b/manifest.json index 3386479..6ede00a 100644 --- a/manifest.json +++ b/manifest.json @@ -15,7 +15,7 @@ "url": "https://reflexlibre.net" }, "requirements": { - "yunohost": ">= 3.8.1" + "yunohost": ">= 4.1.0" }, "multi_instance": true, "services": [], From 1e69742a44bda8060ce04d69e607b91763b1fbb8 Mon Sep 17 00:00:00 2001 From: utzer Date: Thu, 15 Apr 2021 07:45:27 +0200 Subject: [PATCH 10/11] Adding hint for location of settings file. Adding hint for location of settings file. --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index e3b306c..a768258 100644 --- a/README.md +++ b/README.md @@ -222,3 +222,6 @@ 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. From a090e7fb3ee5e7fd3dac434e1058357976e86040 Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Sat, 17 Apr 2021 14:57:48 +0200 Subject: [PATCH 11/11] Advise to not savagely manually edit commit if you don't know what you're doing --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index a768258..924cb84 100644 --- a/README.md +++ b/README.md @@ -224,4 +224,4 @@ For instance: * 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. +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.