From 6a02bca717a7f77f1b06fd82bdc216d47d7bb550 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Fri, 19 Nov 2021 15:03:11 +0100 Subject: [PATCH] Testing (#37) * 2.0.17 --- conf/app.src | 5 ++-- conf/nginx.conf | 5 ---- manifest.json | 5 ++-- scripts/restore | 2 -- scripts/upgrade | 61 ++++++++++++++++++++++++++++++++++--------------- 5 files changed, 47 insertions(+), 31 deletions(-) diff --git a/conf/app.src b/conf/app.src index dd318bd..18bd079 100644 --- a/conf/app.src +++ b/conf/app.src @@ -1,6 +1,5 @@ -SOURCE_URL=https://github.com/fisharebest/webtrees/releases/download/2.0.16/webtrees-2.0.16.zip -SOURCE_SUM=c9327e92df83b3ccfa73d4a5c963357ab25be7daa471fa4ecb157f06b9615366 +SOURCE_URL=https://github.com/fisharebest/webtrees/releases/download/2.0.17/webtrees-2.0.17.zip +SOURCE_SUM=cf354f7fff855881bc9647b98a517654ded5a780d5f09737bc2bef17e1cccd71 SOURCE_SUM_PRG=sha256sum SOURCE_FORMAT=zip SOURCE_IN_SUBDIR=true -SOURCE_FILENAME= diff --git a/conf/nginx.conf b/conf/nginx.conf index 1b31226..ca740c7 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -4,11 +4,6 @@ location __PATH__/ { # Path to source alias __FINALPATH__/ ; - # Force usage of https - if ($scheme = http) { - rewrite ^ https://$server_name$request_uri? permanent; - } - index index.php; # Common parameter to increase upload size limit in conjunction with dedicated php-fpm file diff --git a/manifest.json b/manifest.json index 7a03e95..46e9638 100644 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "en": "Web-based genealogy application", "fr": "Logiciel libre de généalogie en ligne" }, - "version":"2.0.16~ynh1", + "version":"2.0.17~ynh1", "url": "https://www.webtrees.net", "license": "GPL-3.0-or-later", "maintainer": { @@ -26,8 +26,7 @@ "install" : [ { "name": "domain", - "type": "domain", - "example": "example.com" + "type": "domain" }, { "name": "path", diff --git a/scripts/restore b/scripts/restore index 15708d2..94c96e9 100644 --- a/scripts/restore +++ b/scripts/restore @@ -35,8 +35,6 @@ phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) #================================================= ynh_script_progression --message="Validating restoration parameters..." --weight=1 -ynh_webpath_available $domain $path_url \ - || ynh_die "Path not available: ${domain}${path_url}" test ! -d $final_path \ || ynh_die "There is already a directory: $final_path " diff --git a/scripts/upgrade b/scripts/upgrade index 973f33d..671df28 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -20,6 +20,28 @@ app=$YNH_APP_INSTANCE_NAME domain=$(ynh_app_setting_get --app=$app --key=domain) path_url=$(ynh_app_setting_get --app=$app --key=path) final_path=$(ynh_app_setting_get --app=$app --key=final_path) +db_name=$(ynh_app_setting_get --app=$app --key=db_name) +db_user=$db_name + +#================================================= +# CHECK VERSION +#================================================= + +upgrade_type=$(ynh_check_app_version_changed) + +#================================================= +# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP +#================================================= +ynh_script_progression --message="Backing up $app before upgrading (may take a while)..." + +# Backup the current version of the app +ynh_backup_before_upgrade +ynh_clean_setup () { + # restore it if the upgrade fails + ynh_restore_upgradebackup +} +# Exit if an error occurs during the execution of the script +ynh_abort_if_errors #================================================= # ENSURE DOWNWARD COMPATIBILITY @@ -46,18 +68,12 @@ if ynh_legacy_permissions_exists; then fi #================================================= -# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP +# CREATE DEDICATED USER #================================================= -ynh_script_progression --message="Backing up $app before upgrading (may take a while)..." +ynh_script_progression --message="Making sure dedicated system user exists..." -# Backup the current version of the app -ynh_backup_before_upgrade -ynh_clean_setup () { - # restore it if the upgrade fails - ynh_restore_upgradebackup -} -# Exit if an error occurs during the execution of the script -ynh_abort_if_errors +# Create a dedicated user (if not existing) +ynh_system_user_create --username=$app --home_dir="$final_path" #================================================= # CREATE DEDICATED USER @@ -74,17 +90,26 @@ ynh_system_user_create --username=$app --home_dir="$final_path" #================================================= ynh_script_progression --message="Upgrading source files..." -# Move old app dir -mv ${final_path} ${final_path}.old +if [ "$upgrade_type" == "UPGRADE_APP" ] +then + ynh_script_progression --message="Upgrading source files..." + # Move old app dir + mv ${final_path} ${final_path}.old -# Download, check integrity, uncompress and patch the source from app.src -ynh_setup_source "$final_path" + # Download, check integrity, uncompress and patch the source from app.src + ynh_setup_source "$final_path" -# restore data -cp -a ${final_path}.old/data ${final_path} + # restore data + cp -a ${final_path}.old/data ${final_path} -# delete temp directory -ynh_secure_remove --file=${final_path}.old + # delete temp directory + ynh_secure_remove --file=${final_path}.old +fi + +chmod 750 "$final_path" +chmod -R 700 $final_path/data +chmod -R o-rwx "$final_path" +chown -R $app:www-data "$final_path" chmod 750 "$final_path" chmod -R 700 $final_path/data