diff --git a/scripts/backup b/scripts/backup index 1c91c7d..1278ce6 100644 --- a/scripts/backup +++ b/scripts/backup @@ -39,7 +39,8 @@ ynh_backup --src_path="/etc/fail2ban/filter.d/$app.conf" ynh_backup --src_path="/etc/logrotate.d/$app" ynh_backup --src_path="/var/log/$app" -ynh_backup --src_path="/etc/systemd/system/$app-daemon.service" + +ynh_backup --src_path="/etc/systemd/system/$app.service" #================================================= # BACKUP THE MYSQL DATABASE diff --git a/scripts/install b/scripts/install index 9f2a6d6..03b15d5 100644 --- a/scripts/install +++ b/scripts/install @@ -16,13 +16,6 @@ source /usr/share/yunohost/helpers email=$(ynh_user_get_info --username="$admin" --key=mail) timezone=$(cat /etc/timezone) -#================================================= -# STORE SETTINGS FROM MANIFEST -#================================================= -ynh_script_progression --message="Storing installation settings..." --weight=1 - -ynh_app_setting_set --app="$app" --key=email --value="$email" - #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= @@ -48,12 +41,12 @@ ynh_script_progression --message="Adding system configurations related to $app.. # Create a dedicated PHP-FPM configy ynh_add_fpm_config -ynh_add_systemd_config --service="$app-daemon" +ynh_add_systemd_config # Create a dedicated nginx config ynh_add_nginx_config -yunohost service add "$app-daemon" --description="Decentralized Social Network" --log="/var/log/$app/daemon.log" +yunohost service add "$app" --description="Decentralized Social Network" --log="/var/log/$app/$app.log" # Use logrotate to manage application logfile(s) ynh_use_logrotate @@ -90,7 +83,7 @@ popd #================================================= ynh_script_progression --message="Starting a systemd service..." --weight=1 -ynh_systemd_action --service_name="$app-daemon" --action="start" --log_path="systemd" +ynh_systemd_action --service_name="$app" --action="start" --log_path="systemd" #================================================= # END OF SCRIPT diff --git a/scripts/remove b/scripts/remove index 4ac1569..0271e24 100644 --- a/scripts/remove +++ b/scripts/remove @@ -19,7 +19,7 @@ source /usr/share/yunohost/helpers if ynh_exec_warn_less yunohost service status "$app" >/dev/null then ynh_script_progression --message="Removing $app service integration..." --weight=1 - yunohost service remove "$app-daemon" + yunohost service remove "$app" fi #================================================= @@ -38,7 +38,7 @@ ynh_remove_logrotate ynh_remove_fail2ban_config -ynh_remove_systemd_config --service="$app-daemon" +ynh_remove_systemd_config #================================================= # END OF SCRIPT diff --git a/scripts/restore b/scripts/restore index 9e4f1c1..b9749d8 100644 --- a/scripts/restore +++ b/scripts/restore @@ -41,10 +41,10 @@ ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf" ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" -ynh_restore_file --origin_path="/etc/systemd/system/$app-daemon.service" +ynh_restore_file --origin_path="/etc/systemd/system/$app.service" systemctl enable "$app-daemon.service" --quiet -yunohost service add "$app-daemon" --description="Decentralized Social Network" --log="/var/log/$app/daemon.log" +yunohost service add "$app-daemon" --description="Decentralized Social Network" --log="/var/log/$app/$app.log" ynh_restore_file --origin_path="/var/log/$app" @@ -54,22 +54,19 @@ ynh_restore_file --origin_path="/etc/fail2ban/jail.d/$app.conf" ynh_restore_file --origin_path="/etc/fail2ban/filter.d/$app.conf" ynh_systemd_action --action=restart --service_name=fail2ban -#================================================= -# GENERIC FINALIZATION #================================================= # RELOAD NGINX AND PHP-FPM OR THE APP SERVICE #================================================= 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" ynh_systemd_action --service_name="php$phpversion-fpm" --action=reload ynh_systemd_action --service_name=nginx --action=reload -ynh_systemd_action --service_name="$app-daemon" --action="start" --log_path="systemd" - -#============== +#================================================= # FINALIZATION -#============== +#================================================= # exit maintenance mode since the app was backed up while in maintenance mode (cd "$install_dir" && ynh_exec_as "$app" "php$phpversion" bin/console.php maintenance 0) diff --git a/scripts/upgrade b/scripts/upgrade index 6fe56b6..d37232e 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -14,7 +14,7 @@ source /usr/share/yunohost/helpers #================================================= ynh_script_progression --message="Stopping a systemd service..." --weight=1 -ynh_systemd_action --service_name="$app-daemon" --action="stop" --log_path="systemd" +ynh_systemd_action --service_name="$app" --action="stop" --log_path="systemd" #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE @@ -54,7 +54,7 @@ fi ynh_add_systemd_config --service="$app-daemon" -yunohost service add "$app-daemon" --description="Decentralized Social Network" --log="/var/log/$app/daemon.log" +yunohost service add "$app" --description="Decentralized Social Network" --log="/var/log/$app/$app.log" # Create a dedicated Fail2Ban config ynh_add_fail2ban_config --logpath="/var/log/nginx/${domain}-error.log" --failregex="^.*authenticate\: failed login attempt.*\"ip\"\:\"\".*$" @@ -100,7 +100,7 @@ popd #================================================= ynh_script_progression --message="Starting a systemd service..." --weight=1 -ynh_systemd_action --service_name="$app-daemon" --action="start" --log_path="systemd" +ynh_systemd_action --service_name="$app" --action="start" --log_path="systemd" #================================================= # END OF SCRIPT