From 067923c98c6800b4bd1b808865f719dd99ef2de1 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Thu, 7 Jan 2021 14:09:35 +0100 Subject: [PATCH] Fix --- conf/nginx.conf | 2 +- scripts/backup | 3 ++- scripts/change_url | 2 +- scripts/install | 16 +++++++--------- scripts/restore | 6 +++--- scripts/upgrade | 38 ++++++-------------------------------- 6 files changed, 20 insertions(+), 47 deletions(-) diff --git a/conf/nginx.conf b/conf/nginx.conf index 3e2f651..dc9ee4f 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -24,7 +24,7 @@ location __PATH__/ { fastcgi_param REMOTE_USER $remote_user; fastcgi_param PATH_INFO $fastcgi_path_info; fastcgi_param SCRIPT_FILENAME $request_filename; - fastcgi_read_timeout 600; + fastcgi_read_timeout 600; } # Include SSOWAT user panel. diff --git a/scripts/backup b/scripts/backup index 35d1b03..ae210e7 100755 --- a/scripts/backup +++ b/scripts/backup @@ -27,6 +27,7 @@ app=$YNH_APP_INSTANCE_NAME final_path=$(ynh_app_setting_get --app=$app --key=final_path) domain=$(ynh_app_setting_get --app=$app --key=domain) db_name=$(ynh_app_setting_get --app=$app --key=db_name) +phpversion=$(ynh_app_setting_get --app="$app" --key=phpversion) #================================================= # DECLARE DATA AND CONF FILES TO BACKUP @@ -52,7 +53,7 @@ ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf" #================================================= ynh_print_info --message="Backing up php-fpm configuration..." -ynh_backup --src_path="/etc/php/$YNH_PHP_VERSION/fpm/pool.d/$app.conf" +ynh_backup --src_path="/etc/php/$phpversion/fpm/pool.d/$app.conf" #================================================= # SPECIFIC BACKUP diff --git a/scripts/change_url b/scripts/change_url index ced769b..9c78c4e 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -32,7 +32,7 @@ final_path=$(ynh_app_setting_get --app=$app --key=final_path) #================================================= # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP #================================================= -ynh_script_progression --message="Backing up the app before changing its url (may take a while)..." --weight=1 +ynh_script_progression --message="Backing up the app before changing its URL (may take a while)..." --weight=1 # Backup the current version of the app ynh_backup_before_upgrade diff --git a/scripts/install b/scripts/install index f5286fa..cb1f84a 100644 --- a/scripts/install +++ b/scripts/install @@ -26,7 +26,6 @@ admin=$YNH_APP_ARG_ADMIN member=$YNH_APP_ARG_MEMBER is_public=0 - app=$YNH_APP_INSTANCE_NAME #================================================= @@ -100,7 +99,7 @@ ynh_system_user_create --username=$app ynh_script_progression --message="Configuring php-fpm and install dependencies..." --weight=2 # Create a dedicated php-fpm config -ynh_add_fpm_config --usage=medium --footprint=medium --phpversion=$YNH_PHP_VERSION --package="$extra_php_dependencies" +ynh_add_fpm_config --usage=medium --footprint=medium --package="$extra_php_dependencies" #================================================= # SPECIFIC SETUP @@ -139,11 +138,10 @@ chown -R $app: "$final_path" # Set the app as temporarily public for curl call ynh_script_progression --message="Configuring SSOwat..." --weight=1 -ynh_app_setting_set --app=$app --key=skipped_uris --value="/" -# Reload SSOwat config -yunohost app ssowatconf +# Set the app as temporarily public for cURL call +ynh_permission_update --permission "main" --add "visitors" -# Reload Nginx +# Reload NGINX ynh_systemd_action --service_name=nginx --action=reload # Installation with curl @@ -251,10 +249,10 @@ ynh_use_logrotate --logfile="$final_path/documents/dolibarr.log" #================================================= ynh_script_progression --message="Configuring SSOwat..." --weight=1 -# Make app public if necessary -if [ $is_public -eq 1 ] +# Make app public if necessary or protect it +if [ $is_public -eq 0 ] then - ynh_permission_update --permission "main" --add "visitors" + ynh_permission_update --permission "main" --remove "visitors" fi ynh_permission_create --permission "public access" --url "/public/" --allowed "visitors" diff --git a/scripts/restore b/scripts/restore index d7cfd4d..e3c3f42 100755 --- a/scripts/restore +++ b/scripts/restore @@ -33,6 +33,7 @@ datadir=$final_path/documents/ fpm_footprint=$(ynh_app_setting_get --app=$app --key=fpm_footprint) fpm_usage=$(ynh_app_setting_get --app=$app --key=fpm_usage) +phpversion=$(ynh_app_setting_get --app="$app" --key=phpversion) #================================================= # CHECK IF THE APP CAN BE RESTORED @@ -81,8 +82,7 @@ ynh_print_info --message="Reconfiguring PHP-FPM..." ynh_restore_file --origin_path="/etc/php/$YNH_PHP_VERSION/fpm/pool.d/$app.conf" -ynh_add_fpm_config --usage=$fpm_usage --footprint=$fpm_footprint --phpversion=$YNH_PHP_VERSION --package="$extra_php_dependencies" - +ynh_add_fpm_config --usage=$fpm_usage --footprint=$fpm_footprint --package="$extra_php_dependencies" #================================================= # SPECIFIC RESTORATION @@ -119,7 +119,7 @@ chmod go-w $datadir #================================================= ynh_script_progression --message="Reloading nginx web server and php-fpm..." --weight=1 -ynh_systemd_action --service_name=php$YNH_PHP_VERSION-fpm --action=reload +ynh_systemd_action --service_name=php$phpversion-fpm --action=reload ynh_systemd_action --service_name=nginx --action=reload #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 18177d7..a075097 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -29,6 +29,7 @@ datadir=$final_path/documents/ fpm_footprint=$(ynh_app_setting_get --app=$app --key=fpm_footprint) fpm_usage=$(ynh_app_setting_get --app=$app --key=fpm_usage) +phpversion=$(ynh_app_setting_get --app="$app" --key=phpversion) #================================================= # CHECK VERSION @@ -91,18 +92,6 @@ ynh_clean_setup () { # Exit if an error occurs during the execution of the script ynh_abort_if_errors -#================================================= -# CHECK THE PATH -#================================================= - -# Normalize the URL path syntax -# N.B. : this is for app installations before YunoHost 2.7 -# where this value might be something like /foo/ or foo/ -# instead of /foo .... -# If nobody installed your app before 2.7, then you may -# safely remove this line -path_url=$(ynh_normalize_url_path --path_url=$path_url) - #================================================= # STANDARD UPGRADE STEPS #================================================= @@ -123,7 +112,7 @@ fi ynh_script_progression --message="Upgrading nginx web server configuration..." --weight=1 # Create a dedicated nginx config -ynh_add_nginx_config YNH_PHP_VERSION +ynh_add_nginx_config #================================================= # CREATE DEDICATED USER @@ -145,8 +134,7 @@ if [ -f "/etc/php/$old_php_version/fpm/pool.d/$app.conf" ]; then fi # Create a dedicated php-fpm config -ynh_add_fpm_config --usage=$fpm_usage --footprint=$fpm_footprint --phpversion=$YNH_PHP_VERSION --package="$extra_php_dependencies" - +ynh_add_fpm_config --usage=$fpm_usage --footprint=$fpm_footprint --package="$extra_php_dependencies" #================================================= # SPECIFIC UPGRADE @@ -171,17 +159,17 @@ then # Upgrade with CURL pushd $final_path/htdocs/install/ - if php upgrade.php $current_version $update_version > /var/log/$app/upgrade.html; then + if php$phpversion upgrade.php $current_version $update_version > /var/log/$app/upgrade.html; then ynh_print_info --message="Step 1 upgrading ended successfully" else ynh_print_warn --message="Step 1 upgrading ended with error" fi - if php upgrade2.php $current_version $update_version > /var/log/$app/upgrade2.html; then + if php$phpversion upgrade2.php $current_version $update_version > /var/log/$app/upgrade2.html; then ynh_print_info --message="Step 2 upgrading ended successfully" else ynh_print_warn --message="Step 2 upgrading ended with error" fi - if php step5.php $current_version $update_version > /var/log/$app/upgrade3.html; then + if php$phpversion step5.php $current_version $update_version > /var/log/$app/upgrade3.html; then ynh_print_info --message="Step 3 upgrading ended successfully" else ynh_print_warn --message="Step 3 upgrading ended with error" @@ -221,20 +209,6 @@ mkdir -p "$datadir" chown -R $app: "$datadir" chmod go-w $datadir -#================================================= -# SETUP SSOWAT -#================================================= -ynh_script_progression --message="Upgrading SSOwat configuration..." --weight=1 - -# Make app public if necessary -if [ $is_public -eq 1 ] -then - # unprotected_uris allows SSO credentials to be passed anyway - ynh_app_setting_set --app=$app --key=unprotected_uris --value="/" -fi - -ynh_permission_create --permission "public access" --url "/public/" --allowed "visitors" - #================================================= # RELOAD NGINX #=================================================