From ac0637da3fd957cc76755ca2deeb499d649cf45d Mon Sep 17 00:00:00 2001 From: Pierre de La Morinerie Date: Mon, 29 Jan 2018 11:15:24 +0530 Subject: [PATCH 1/2] scripts: backup Mattermost data files Fix #79 --- scripts/backup | 7 +++++++ scripts/restore | 6 ++++++ 2 files changed, 13 insertions(+) diff --git a/scripts/backup b/scripts/backup index aa4bfe3..9e3d9d5 100755 --- a/scripts/backup +++ b/scripts/backup @@ -20,6 +20,7 @@ ynh_abort_if_errors app=$YNH_APP_INSTANCE_NAME final_path="/var/www/$app" +data_path="/home/yunohost.app/$app" domain=$(ynh_app_setting_get $app domain) db_name="$app" default_backup_dir="${1}apps/$app" @@ -33,6 +34,12 @@ backup_dir=${backup_dir:-"$default_backup_dir"} ynh_backup "$final_path" "${backup_dir}$final_path" +#================================================= +# BACKUP THE APP DATA +#================================================= + +ynh_backup "$data_path" "${backup_dir}$data_path" + #================================================= # BACKUP THE DATABASE #================================================= diff --git a/scripts/restore b/scripts/restore index bd4ef34..df91701 100644 --- a/scripts/restore +++ b/scripts/restore @@ -51,6 +51,12 @@ ynh_restore_file "/etc/nginx/conf.d/$domain.d/$app.conf" ynh_restore_file "$final_path" +#================================================= +# RESTORE THE APP DATA +#================================================= + +ynh_restore_file "$data_path" + #================================================= # RESTORE THE MYSQL DATABASE #================================================= From cbf70d12c5bf0f36819d489dff29b185bde68ec0 Mon Sep 17 00:00:00 2001 From: Pierre de La Morinerie Date: Mon, 29 Jan 2018 11:18:14 +0530 Subject: [PATCH 2/2] scripts: modernize backup script --- scripts/backup | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/scripts/backup b/scripts/backup index 9e3d9d5..859f559 100755 --- a/scripts/backup +++ b/scripts/backup @@ -23,8 +23,6 @@ final_path="/var/www/$app" data_path="/home/yunohost.app/$app" domain=$(ynh_app_setting_get $app domain) db_name="$app" -default_backup_dir="${1}apps/$app" -backup_dir=${backup_dir:-"$default_backup_dir"} #================================================= # STANDARD BACKUP STEPS @@ -32,29 +30,29 @@ backup_dir=${backup_dir:-"$default_backup_dir"} # BACKUP THE APP MAIN DIR #================================================= -ynh_backup "$final_path" "${backup_dir}$final_path" +ynh_backup "$final_path" #================================================= # BACKUP THE APP DATA #================================================= -ynh_backup "$data_path" "${backup_dir}$data_path" +ynh_backup "$data_path" #================================================= # BACKUP THE DATABASE #================================================= ynh_mysql_dump_db "$db_name" > db.sql -ynh_backup "db.sql" "${backup_dir}/db.sql" +ynh_backup "db.sql" #================================================= # BACKUP THE NGINX CONFIGURATION #================================================= -ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf" "${backup_dir}/etc/nginx/conf.d/$domain.d/$app.conf" +ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf" #================================================= # BACKUP SYSTEMD #================================================= -ynh_backup "/etc/systemd/system/$app.service" "${backup_dir}/etc/systemd/system/$app.service" +ynh_backup "/etc/systemd/system/$app.service"