From b6f62df85a3692c7ca6185f5364ce7d9b5a7036a Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Sat, 23 May 2020 20:57:23 +0200 Subject: [PATCH 1/3] Do not name services something.service ... --- scripts/install | 2 +- scripts/remove | 4 ++-- scripts/restore | 6 +++--- scripts/upgrade | 9 +++++++++ 4 files changed, 15 insertions(+), 6 deletions(-) diff --git a/scripts/install b/scripts/install index 23201c8..c7771f2 100644 --- a/scripts/install +++ b/scripts/install @@ -134,7 +134,7 @@ set_permissions #================================================= ynh_print_info --message="Integrating service in YunoHost..." -yunohost service add "uwsgi-app@$app.service" --log "/var/log/uwsgi/app/$app" +yunohost service add "uwsgi-app@$app" --log "/var/log/uwsgi/app/$app" #================================================= diff --git a/scripts/remove b/scripts/remove index 0abfa5e..fe5a3a6 100644 --- a/scripts/remove +++ b/scripts/remove @@ -29,10 +29,10 @@ final_path=$(ynh_app_setting_get --app=$app --key=final_path) #================================================= # Remove the service from the list of services known by Yunohost (added from `yunohost service add`) -if ynh_exec_warn_less yunohost service status $app >/dev/null +if ynh_exec_warn_less yunohost service status uwsgi-app@$app >/dev/null then ynh_print_info --message="Removing $app service..." - yunohost service remove uwsgi-app@$app.service + yunohost service remove uwsgi-app@$app fi #================================================= diff --git a/scripts/restore b/scripts/restore index 5382ae0..63bb1d6 100644 --- a/scripts/restore +++ b/scripts/restore @@ -81,12 +81,12 @@ ynh_mysql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < ./ # INTEGRATE SERVICE IN YUNOHOST #================================================= -yunohost service add "uwsgi-app@$app.service" --log "/var/log/uwsgi/app/$app" +yunohost service add "uwsgi-app@$app" --log "/var/log/uwsgi/app/$app" ynh_script_progression --message="Reloading services..." --weight=3 ynh_check_global_uwsgi_config -systemctl enable "uwsgi-app@$app.service" +systemctl enable "uwsgi-app@$app" #================================================= # GENERIC FINALIZATION @@ -94,7 +94,7 @@ systemctl enable "uwsgi-app@$app.service" # RELOAD NGINX AND UWSGI #================================================= -systemctl start "uwsgi-app@$app.service" +systemctl start "uwsgi-app@$app" systemctl reload nginx ynh_script_progression --message="Restoration completed for $app" --last diff --git a/scripts/upgrade b/scripts/upgrade index 0040219..38b44a2 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -68,6 +68,15 @@ if [ -e /etc/init.d/ffsync ]; then yunohost service remove "$app" fi +# Remove old service ending with ".service" +if ynh_exec_warn_less yunohost service status "uwsgi-app@$app.service" >/dev/null +then + yunohost service remove uwsgi-app@$app.service +fi + +yunohost service add "uwsgi-app@$app" --log "/var/log/uwsgi/app/$app" + + #================================================= # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP #================================================= From 464c35057c62f081ee5acc72f07b0fda5999eea4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Josu=C3=A9=20Tille?= Date: Sun, 24 May 2020 00:22:26 +0200 Subject: [PATCH 2/3] Update uwsgi helper --- scripts/experimental_helper.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/experimental_helper.sh b/scripts/experimental_helper.sh index ee312af..7cf29bc 100644 --- a/scripts/experimental_helper.sh +++ b/scripts/experimental_helper.sh @@ -17,7 +17,8 @@ ExecStart=/usr/bin/uwsgi \ --logto /var/log/uwsgi/%i/%i.log User=%i Group=www-data -Restart=on-failure +Restart=always +RestartSec=10 KillSignal=SIGQUIT Type=notify StandardError=syslog From 32e07385c2e17360def5079c254f529285ef1a4e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Josu=C3=A9=20Tille?= Date: Sun, 24 May 2020 00:41:39 +0200 Subject: [PATCH 3/3] Remove service management in install/upgrade it's already done by uswsgi helper --- scripts/install | 8 -------- scripts/upgrade | 3 --- 2 files changed, 11 deletions(-) diff --git a/scripts/install b/scripts/install index c7771f2..0a44266 100644 --- a/scripts/install +++ b/scripts/install @@ -129,14 +129,6 @@ ynh_script_progression --message="Protecting directory" # Set permissions to app files set_permissions -#================================================= -# INTEGRATE SERVICE IN YUNOHOST -#================================================= -ynh_print_info --message="Integrating service in YunoHost..." - -yunohost service add "uwsgi-app@$app" --log "/var/log/uwsgi/app/$app" - - #================================================= # SETUP SSOWAT #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 38b44a2..1904fc1 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -74,9 +74,6 @@ then yunohost service remove uwsgi-app@$app.service fi -yunohost service add "uwsgi-app@$app" --log "/var/log/uwsgi/app/$app" - - #================================================= # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP #=================================================