From 265e7b02ca64117d022222e46aff092d15f1262e Mon Sep 17 00:00:00 2001 From: yalh76 Date: Thu, 4 Jun 2020 17:22:45 +0200 Subject: [PATCH] Change upgrade steps order to be homogeneous with install steps order --- scripts/upgrade | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/scripts/upgrade b/scripts/upgrade index e7de87b..200b238 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -146,6 +146,14 @@ ynh_add_fpm_config # ... #================================================= +#================================================= +# SETUP SYSTEMD +#================================================= +ynh_script_progression --message="Upgrading systemd configuration..." --time --weight=1 + +# Create a dedicated systemd config +ynh_add_systemd_config + #================================================= # MODIFY A CONFIG FILE #================================================= @@ -159,6 +167,15 @@ ynh_replace_string --match_string="match_string" --replace_string="replace_strin # Recalculate and store the checksum of the file for the next upgrade. ynh_store_file_checksum --file="$final_path/CONFIG_FILE" +#================================================= +# GENERIC FINALIZATION +#================================================= +# SECURE FILES AND DIRECTORIES +#================================================= + +# Set permissions on app files +chown -R root: $final_path + #================================================= # SETUP LOGROTATE #================================================= @@ -168,15 +185,12 @@ ynh_script_progression --message="Upgrading logrotate configuration..." --time - ynh_use_logrotate --non-append #================================================= -# SETUP SYSTEMD +# START SYSTEMD SERVICE #================================================= -ynh_script_progression --message="Upgrading systemd configuration..." --time --weight=1 +ynh_script_progression --message="Starting a systemd service..." --time --weight=1 -# Create a dedicated systemd config -ynh_add_systemd_config +ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log" -#================================================= -# GENERIC FINALIZATION #================================================= # UPGRADE FAIL2BAN #================================================= @@ -185,13 +199,6 @@ ynh_script_progression --message="Reconfiguring fail2ban..." --time --weight=1 # Create a dedicated fail2ban config ynh_add_fail2ban_config --logpath="/var/log/nginx/${domain}-error.log" --failregex="Regex to match into the log for a failed login" -#================================================= -# SECURE FILES AND DIRECTORIES -#================================================= - -# Set permissions on app files -chown -R root: $final_path - #================================================= # SETUP SSOWAT #================================================= @@ -204,13 +211,6 @@ then ynh_app_setting_set --app=$app --key=unprotected_uris --value="/" fi -#================================================= -# START SYSTEMD SERVICE -#================================================= -ynh_script_progression --message="Starting a systemd service..." --time --weight=1 - -ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log" - #================================================= # RELOAD NGINX #=================================================