From 9e2c00608e950d932cc5ecb1abe00581164b0eb6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Fri, 19 Jun 2020 22:15:00 +0200 Subject: [PATCH 1/6] Update README.md --- README.md | 45 ++++++++++++++++++++++++++++++++++++++------- 1 file changed, 38 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 5ee3b52..3ccf9cd 100644 --- a/README.md +++ b/README.md @@ -1,14 +1,18 @@ -# restic for Yunohost +# Restic for YunoHost [![Latest Version](https://img.shields.io/badge/version-0.9.6-green.svg?style=flat)](https://github.com/YunoHost-Apps/restic_ynh/releases) [![Status](https://img.shields.io/badge/status-testing-yellow.svg?style=flat)](https://github.com/YunoHost-Apps/restic_ynh/milestones) [![Integration level](https://dash.yunohost.org/integration/restic.svg)](https://dash.yunohost.org/appci/app/restic) [![GitHub license](https://img.shields.io/badge/license-GPLv3-blue.svg?style=flat)](https://raw.githubusercontent.com/YunoHost-Apps/restic_ynh/master/LICENSE) -[![GitHub issues](https://img.shields.io/github/issues/YunoHost-Apps/restic_ynh.svg?style=flat)](https://github.com/YunoHost-Apps/restic_ynh/issues) - +[![GitHub issues](https://img.shields.io/github/issues/YunoHost-Apps/restic_ynh.svg?style=flat)](https://github.com/YunoHost-Apps/restic_ynh/issues) [![Install restic with YunoHost](https://install-app.yunohost.org/install-with-yunohost.png)](https://install-app.yunohost.org/?app=restic) -A [restic](https://restic.net/) package for YunoHost (heavily inspired by [the Borg package](https://github.com/YunoHost-Apps/borg_ynh/)). +> *This package allows you to install Restic quickly and simply on a YunoHost server. +If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/install) to learn how to install it.* + +## Overview + +A [Restic](https://restic.net/) package for YunoHost (heavily inspired by [the Borg package](https://github.com/YunoHost-Apps/borg_ynh/)). Restic is a backup tool that can make local and remote backups. This package uses restic to make backups to a sftp server. @@ -17,7 +21,7 @@ This package uses restic to make backups to a sftp server. If you want to backup your server A onto the server B. -## Setup restic app on Server A +## Setup Restic app on Server A Firstly set up this app on the server A you want to backup: @@ -114,7 +118,7 @@ If you want to check the backups consistency: systemctl start restic_check.service ``` -If you want to make a complete check of the backups - keep in mind that this reads all the backed up data, it can take some time depending on your target server upload speed (more on this topic in [the restic documentation](https://restic.readthedocs.io/en/latest/045_working_with_repos.html#checking-integrity-and-consistency): +If you want to make a complete check of the backups - keep in mind that this reads all the backed up data, it can take some time depending on your target server upload speed (more on this topic in [the Restic documentation](https://restic.readthedocs.io/en/latest/045_working_with_repos.html#checking-integrity-and-consistency): ``` systemctl start restic_check_read_data.service ``` @@ -127,4 +131,31 @@ yunohost app setting restic apps -v "nextcloud,wordpress" ## Backup on different server, and apply distinct schedule for apps -You can setup the restic app 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 Restic app 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. + +#### Supported architectures + +* x86-64 - [![Build Status](https://ci-apps.yunohost.org/ci/logs/restic%20%28Apps%29.svg)](https://ci-apps.yunohost.org/ci/apps/restic/) +* ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/ci/logs/restic%20%28Apps%29.svg)](https://ci-apps-arm.yunohost.org/ci/apps/restic/) + +## Links + + * Report a bug: https://github.com/YunoHost-Apps/restic_ynh/issues + * App website: https://restic.net/ + * Upstream app repository: https://github.com/restic/restic + * YunoHost website: https://yunohost.org/ + +--- + +Developer info +---------------- + +Please send your pull request to the [testing branch](https://github.com/YunoHost-Apps/restic_ynh/tree/testing). + +To try the testing branch, please proceed like that. +``` +sudo yunohost app install https://github.com/YunoHost-Apps/restic_ynh/tree/testing --debug +or +sudo yunohost app upgrade restic -u https://github.com/YunoHost-Apps/restic_ynh/tree/testing --debug +``` + From 34b3b706b4bd57e20c83908645d12f4e782c762c Mon Sep 17 00:00:00 2001 From: Lionel Coupouchetty-Ramouchetty Date: Sat, 26 Sep 2020 13:46:16 +0200 Subject: [PATCH 2/6] fix: removed -b option for listing apps in check-restic --- conf/check-restic.j2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conf/check-restic.j2 b/conf/check-restic.j2 index 2c6dd8c..a9d404f 100644 --- a/conf/check-restic.j2 +++ b/conf/check-restic.j2 @@ -31,7 +31,7 @@ fi # Check 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 check_app=false for selected_app in $(echo $apps | tr "," " ");do if [[ "$selected_app" == "$app" ]] || [ "$apps" = "all" ]; then From da5a693d16ef78f9c872f14837346d3edfc5f0b6 Mon Sep 17 00:00:00 2001 From: Lionel Coupouchetty-Ramouchetty Date: Sat, 26 Sep 2020 13:56:51 +0200 Subject: [PATCH 3/6] feat: use new restic 0.10.0 --- manifest.json | 2 +- scripts/_common.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/manifest.json b/manifest.json index 1d7ce1f..b2538b5 100644 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "en": "Backup your server with restic.", "fr": "Sauvegardez votre serveur avec restic." }, - "version": "0.9.6~ynh5", + "version": "0.10.0~ynh1", "url": "https://restic.net/", "license": "BSD 2-Clause \"Simplified\" License", "maintainer": { diff --git a/scripts/_common.sh b/scripts/_common.sh index dd1705a..5a4cb05 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -5,7 +5,7 @@ #================================================= # App package root directory should be the parent folder PKG_DIR=$(cd ../; pwd) -RESTIC_VERSION="0.9.6" +RESTIC_VERSION="0.10.0" # Install restic if restic is not here install_restic () { From 9971c585e4088179312796dbea0359e5c0761aaf Mon Sep 17 00:00:00 2001 From: Lionel Coupouchetty-Ramouchetty Date: Sat, 26 Sep 2020 13:57:04 +0200 Subject: [PATCH 4/6] fix: disable services since they will be started by the timer --- scripts/install | 3 +++ 1 file changed, 3 insertions(+) diff --git a/scripts/install b/scripts/install index 15f9f7e..66ef0d9 100755 --- a/scripts/install +++ b/scripts/install @@ -65,6 +65,9 @@ ynh_add_systemd_config --service=${app}_check_read_data --template=systemd_check ynh_configure systemd.timer "/etc/systemd/system/${app}.timer" ynh_configure systemd_check.timer "/etc/systemd/system/${app}_check.timer" ynh_configure systemd_check_read_data.timer "/etc/systemd/system/${app}_check_read_data.timer" +systemctl disable ${app}.service +systemctl disable ${app}_check.service +systemctl disable ${app}_check_read_data.service systemctl enable ${app}.timer systemctl enable ${app}_check.timer systemctl enable ${app}_check_read_data.timer From 3fa8df45d6452e20ba38c346ed4c5ff25fd585b6 Mon Sep 17 00:00:00 2001 From: Moutonjr Date: Sun, 8 Nov 2020 17:42:25 +0100 Subject: [PATCH 5/6] Fixing hardcoded values, replacing by YNH calls Hard-tested in production, please review with fresh install. Debian buster with latest YNH stable. --- conf/backup_method.j2 | 12 ++++++++++-- conf/check_method.j2 | 9 +++++++-- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/conf/backup_method.j2 b/conf/backup_method.j2 index ca7048a..71d9521 100644 --- a/conf/backup_method.j2 +++ b/conf/backup_method.j2 @@ -2,8 +2,16 @@ set -e -RESTIC_PASSWORD="{{ passphrase }}" -RESTIC_REPOSITORY_BASE=sftp:{{ server }}:{{ backup_path }} +### +# Fetch information from YNH settings +### +RESTIC_SERVER=$(yunohost app setting restic server) +RESTIC_SERVER_PORT=$(yunohost app setting restic port) +RESTIC_PATH=$(yunohost app setting restic backup_path) + +RESTIC_PASSWORD="$(yunohost app setting restic passphrase)" +RESTIC_REPOSITORY_BASE=sftp://$RESTIC_SERVER:$RESTIC_SERVER_PORT/$RESTIC_PATH/ + RESTIC_COMMAND=/usr/local/bin/restic LOGFILE=/var/log/restic_backup.log ERRFILE=/var/log/restic_backup.err diff --git a/conf/check_method.j2 b/conf/check_method.j2 index 9ce03fc..9884daa 100644 --- a/conf/check_method.j2 +++ b/conf/check_method.j2 @@ -2,8 +2,13 @@ set -e -RESTIC_PASSWORD="{{ passphrase }}" -RESTIC_REPOSITORY_BASE=sftp:{{ server }}:{{ backup_path }} +RESTIC_SERVER=$(yunohost app setting restic server) +RESTIC_SERVER_PORT=$(yunohost app setting restic port) +RESTIC_PATH=$(yunohost app setting restic backup_path) + +RESTIC_PASSWORD="$(yunohost app setting restic passphrase)" +RESTIC_REPOSITORY_BASE=sftp://$RESTIC_SERVER:$RESTIC_SERVER_PORT/$RESTIC_PATH/ + RESTIC_COMMAND=/usr/local/bin/restic do_check() { From 066832b2a189eac7207b74a37ab67c4182ee981a Mon Sep 17 00:00:00 2001 From: Lionel Coupouchetty-Ramouchetty Date: Thu, 12 Nov 2020 08:23:18 +0100 Subject: [PATCH 6/6] fix: end of line whitespaces --- README.md | 4 ++-- scripts/_common.sh | 2 +- scripts/restore | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 3ccf9cd..ddc670d 100644 --- a/README.md +++ b/README.md @@ -4,10 +4,10 @@ [![Status](https://img.shields.io/badge/status-testing-yellow.svg?style=flat)](https://github.com/YunoHost-Apps/restic_ynh/milestones) [![Integration level](https://dash.yunohost.org/integration/restic.svg)](https://dash.yunohost.org/appci/app/restic) [![GitHub license](https://img.shields.io/badge/license-GPLv3-blue.svg?style=flat)](https://raw.githubusercontent.com/YunoHost-Apps/restic_ynh/master/LICENSE) -[![GitHub issues](https://img.shields.io/github/issues/YunoHost-Apps/restic_ynh.svg?style=flat)](https://github.com/YunoHost-Apps/restic_ynh/issues) +[![GitHub issues](https://img.shields.io/github/issues/YunoHost-Apps/restic_ynh.svg?style=flat)](https://github.com/YunoHost-Apps/restic_ynh/issues) [![Install restic with YunoHost](https://install-app.yunohost.org/install-with-yunohost.png)](https://install-app.yunohost.org/?app=restic) -> *This package allows you to install Restic quickly and simply on a YunoHost server. +> *This package allows you to install Restic quickly and simply on a YunoHost server. If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/install) to learn how to install it.* ## Overview diff --git a/scripts/_common.sh b/scripts/_common.sh index 5a4cb05..7851aa9 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -57,7 +57,7 @@ ynh_export () { export $var="${!ynh_arg}" done } -# Save listed var in YunoHost app settings +# Save listed var in YunoHost app settings # usage: ynh_save_args VARNAME1 [VARNAME2 [...]] ynh_save_args () { for var in $@; diff --git a/scripts/restore b/scripts/restore index c55046d..c76eaf5 100755 --- a/scripts/restore +++ b/scripts/restore @@ -38,7 +38,7 @@ mkdir -p /usr/share/yunohost/backup_method #================================================= # RESTORE FILES #================================================= -ynh_restore +ynh_restore #================================================= # ADVERTISE SERVICE IN ADMIN PANEL