From 762942af7e66d2118367811be74b903a8f5fdb7f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Thu, 28 Sep 2023 13:21:02 +0200 Subject: [PATCH] cleaning --- scripts/install | 2 +- scripts/remove | 5 ----- scripts/restore | 52 ++++++++++++++++--------------------------------- scripts/upgrade | 2 +- 4 files changed, 19 insertions(+), 42 deletions(-) diff --git a/scripts/install b/scripts/install index 03125a0..2187356 100644 --- a/scripts/install +++ b/scripts/install @@ -96,7 +96,7 @@ ynh_install_composer #================================================= ynh_script_progression --message="Integrating service in YunoHost..." -yunohost service add $app --description="Responsive web-based XMPP client" +yunohost service add $app --description="Responsive web-based XMPP client" --log="/var/log/$app/$app.log" #================================================= # START SYSTEMD SERVICE diff --git a/scripts/remove b/scripts/remove index 0e81610..e0f7443 100644 --- a/scripts/remove +++ b/scripts/remove @@ -22,11 +22,6 @@ then yunohost service remove $app fi -#================================================= -# STOP AND REMOVE SERVICE -#================================================= -ynh_script_progression --message="Stopping and removing the systemd service..." - # Remove the dedicated systemd config ynh_remove_systemd_config diff --git a/scripts/restore b/scripts/restore index aefed30..112e9ec 100644 --- a/scripts/restore +++ b/scripts/restore @@ -26,60 +26,42 @@ ynh_restore_file --origin_path="$install_dir" chmod -R o-rwx "$install_dir" chown -R $app:www-data "$install_dir" -#================================================= -# RESTORE THE PHP-FPM CONFIGURATION -#================================================= -ynh_script_progression --message="Restoring the PHP-FPM configuration..." - -ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf" - -# Recreate a dedicated PHP-FPM config -ynh_add_fpm_config --usage=$fpm_usage --footprint=$fpm_footprint --phpversion=$phpversion - -#================================================= -# RESTORE THE NGINX CONFIGURATION -#================================================= -ynh_script_progression --message="Restoring the NGINX web server configuration..." - -ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" - #================================================= # RESTORE THE POSTGRESQL DATABASE #================================================= ynh_script_progression --message="Restoring the PostgreSQL database..." -ynh_psql_execute_file_as_root --file="./db.sql" --database=$db_name +ynh_psql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < ./db.sql #================================================= -# RESTORE SYSTEMD +# RESTORE SYSTEM CONFIGURATIONS #================================================= -ynh_script_progression --message="Restoring the systemd configuration..." +# RESTORE THE PHP-FPM CONFIGURATION +#================================================= +ynh_script_progression --message="Restoring system configurations related to $app..." --weight=1 + +ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf" + +# Recreate a dedicated PHP-FPM config +ynh_add_fpm_config --usage=$fpm_usage --footprint=$fpm_footprint + +ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" ynh_restore_file --origin_path="/etc/systemd/system/$app.service" systemctl enable $app.service --quiet -#================================================= -# INTEGRATE SERVICE IN YUNOHOST -#================================================= -ynh_script_progression --message="Integrating service in YunoHost..." - -yunohost service add $app --description="Responsive web-based XMPP client" - -#================================================= -# START SYSTEMD SERVICE -#================================================= -ynh_script_progression --message="Starting a systemd service..." - -ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --line_match="Movim daemon launched" +yunohost service add $app --description="Responsive web-based XMPP client" --log="/var/log/$app/$app.log" #================================================= # GENERIC FINALIZATION #================================================= -# RELOAD NGINX AND PHP-FPM +# RELOAD NGINX AND PHP-FPM OR THE APP SERVICE #================================================= -ynh_script_progression --message="Reloading NGINX web server and PHP-FPM..." +ynh_script_progression --message="Reloading NGINX web server and $app's service..." --weight=1 +ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --line_match="Movim daemon launched" 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 85c0564..e044d83 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -85,7 +85,7 @@ ynh_add_nginx_config # Create a dedicated systemd config ynh_add_systemd_config -yunohost service add $app --description="Responsive web-based XMPP client" +yunohost service add $app --description="Responsive web-based XMPP client" --log="/var/log/$app/$app.log" #================================================= # SPECIFIC UPGRADE