diff --git a/scripts/backup b/scripts/backup index 66ecde5..19d6d74 100755 --- a/scripts/backup +++ b/scripts/backup @@ -55,3 +55,11 @@ ynh_backup "db.sql" #================================================= ynh_backup "/etc/cron.d/$app" + +#================================================= +# BACKUP THE uwsgi files +#================================================= + +ynh_backup "/etc/uwsgi/apps-available/$app.ini" +ynh_backup "/etc/systemd/system/uwsgi-app@.socket" +ynh_backup "/etc/systemd/system/uwsgi-app@.service" diff --git a/scripts/change_url b/scripts/change_url index fa5be8b..ce467c8 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -160,6 +160,7 @@ fi #================================================= # RELOAD NGINX and Weblate #================================================= + + + systemctl reload nginx -systemctl stop "$app.service" -systemctl start "$app.service" diff --git a/scripts/install b/scripts/install index d8a2f09..7f6ac41 100755 --- a/scripts/install +++ b/scripts/install @@ -273,5 +273,4 @@ fi # RELOAD NGINX #================================================= -systemctl start "uwsgi-app@$app.service" systemctl reload nginx diff --git a/scripts/restore b/scripts/restore index 89c02a6..772aea5 100755 --- a/scripts/restore +++ b/scripts/restore @@ -87,10 +87,36 @@ ynh_psql_setup_db "$db_name" "$db_name" "$db_pwd" ynh_psql_execute_file_as_root ./db.sql "$db_name" #================================================= -# RESTORE THE SERVICE +# RESTORE THE UWSGI MECANICS #================================================= -ynh_add_uwsgi_service +ynh_restore_file "/etc/systemd/system/uwsgi-app@.socket" +ynh_restore_file "/etc/systemd/system/uwsgi-app@.service" + +# make sure the folder for sockets exists and set authorizations +mkdir -p /var/run/uwsgi/ +chown root:www-data /var/run/uwsgi/ +chmod -R 775 /var/run/uwsgi/ + +# make sure the folder for logs exists and set authorizations +mkdir -p /var/log/uwsgi/app/ +chown root:www-data /var/log/uwsgi/app/ +chmod -R 775 /var/log/uwsgi/app/ + +#================================================= +# RESTORE Weblate service +#================================================= + +usermod --append --groups www-data "$app" + +ynh_restore_file "/etc/uwsgi/apps-available/$app.ini" + +systemctl enable "uwsgi-app@$app.socket" +systemctl start "uwsgi-app@$app.socket" +systemctl daemon-reload + +# Add as a service +yunohost service add "uwsgi-app@$app.socket" --log "/var/log/uwsgi/app/$app" #================================================= # RESTORE THE CRON FILE @@ -104,5 +130,4 @@ ynh_restore_file "/etc/cron.d/$app" # RELOAD NGINX & uwsgi #================================================= -systemctl restart "uwsgi-app@$app.service" systemctl reload nginx diff --git a/scripts/upgrade b/scripts/upgrade index 2151195..bf03b1a 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -237,5 +237,4 @@ fi # RELOAD NGINX #================================================= -systemctl restart "uwsgi-app@$app.service" systemctl reload nginx