From 027bd35a976a0d50e3720f139eb977e1b1a9b89b Mon Sep 17 00:00:00 2001 From: yalh76 Date: Thu, 3 Mar 2022 22:54:43 +0100 Subject: [PATCH] Fix backup/restore --- scripts/backup | 6 ------ scripts/restore | 14 +++++++------- 2 files changed, 7 insertions(+), 13 deletions(-) diff --git a/scripts/backup b/scripts/backup index 4aaca4a..d1a2235 100755 --- a/scripts/backup +++ b/scripts/backup @@ -43,12 +43,6 @@ ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf" #================================================= # SPECIFIC BACKUP -#================================================= -# BACKUP SYSTEMD -#================================================= - -ynh_backup --src_path="/etc/systemd/system/$app.service" - #================================================= # BACKUP VARIOUS FILES #================================================= diff --git a/scripts/restore b/scripts/restore index 30b588a..a410887 100755 --- a/scripts/restore +++ b/scripts/restore @@ -31,6 +31,7 @@ domain=$(ynh_app_setting_get --app=$app --key=domain) path_url=$(ynh_app_setting_get --app=$app --key=path) db_name=$(ynh_app_setting_get --app=$app --key=db_name) db_user=$db_name +port=$(ynh_app_setting_get --app=$app --key=port) #================================================= # CHECK IF THE APP CAN BE RESTORED @@ -70,7 +71,7 @@ ynh_install_extra_app_dependencies --repo="deb https://dl.packager.io/srv/deb/op #================================================= ynh_script_progression --message="Restoring the PostgreSQL database..." -db_pwd=$(ynh_app_setting_get --app=$app --key=db_pwd) +db_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd) ynh_psql_test_if_first_run ynh_psql_setup_db --db_user=$db_user --db_name=$db_name --db_pwd=$db_pwd ynh_psql_execute_file_as_root --file="./db.sql" --database=$db_name @@ -86,13 +87,12 @@ chmod 750 "/etc/openproject/" chmod -R o-rwx "/etc/openproject/" chown -R $app:$app "/etc/openproject/" -#================================================= -# RESTORE SYSTEMD -#================================================= -ynh_script_progression --message="Restoring the systemd configuration..." +openproject config:set PORT=$port +openproject config:set SERVER_PROTOCOL_FORCE_HTTPS="true" +openproject config:set SERVER_HOSTNAME=$domain +openproject config:set SERVER_PATH_PREFIX=$path_url -ynh_restore_file --origin_path="/etc/systemd/system/$app.service" -systemctl enable $app.service --quiet +openproject configure >> "$YNH_STDINFO" #================================================= # INTEGRATE SERVICE IN YUNOHOST