diff --git a/conf/uwsgi_service b/conf/uwsgi_service new file mode 100644 index 0000000..56e249c --- /dev/null +++ b/conf/uwsgi_service @@ -0,0 +1,18 @@ +[Unit] +Description=uWSGI instance to weblate +Requires=network.target +After=network.target + +[Service] +User=root +Group=root +RemainAfterExit=yes +WorkingDirectory=__FINALPATH__ +ExecStart=/usr/bin/uwsgi --ini-paste /etc/uwsgi/apps-enabled/__NAME__.uwsgi.ini +ExecReload=/bin/kill -HUP $MAINPID +ExecStop=/bin/kill -INT $MAINPID +Restart=always +StandardError=syslog + +[Install] +WantedBy=multi-user.target diff --git a/scripts/install b/scripts/install index 0e711e4..246f45e 100755 --- a/scripts/install +++ b/scripts/install @@ -126,12 +126,16 @@ ynh_replace_string "__FINALPATH__" "$final_path" $final_path/uwsgi.ini sudo mkdir -p /etc/uwsgi/apps-enabled/ sudo ln -s $final_path/uwsgi.ini /etc/uwsgi/apps-enabled/$app.uwsgi.ini -# Start service -sudo systemctl enable uwsgi -sudo systemctl restart uwsgi +sudo cp ../conf/uwsgi_service /etc/systemd/system/$app.uwsgi.service +ynh_replace_string "__NAME__" "$app" /etc/systemd/system/$app.uwsgi.service +ynh_replace_string "__FINALPATH__" "$final_path" /etc/systemd/system/$app.uwsgi.service -# Add umap.uwsgi as a service -sudo yunohost service add $app.uwsgi +# Start service +sudo systemctl enable $app.uwsgi.service +sudo systemctl restart $app.uwsgi.service + +# Add weblate.uwsgi as a service +sudo yunohost service add $app.service #================================================= # SPECIFIC SETUP settings.py @@ -169,7 +173,6 @@ sudo $final_path/manage.py collectstatic --noinput cp ../conf/cron_weblate /etc/cron.d/$app ynh_replace_string "__FINALPATH__" "$final_path/" /etc/cron.d/$app -chmod +x $final_path/script/lutim #================================================= # STORE THE CHECKSUM OF THE CONFIG FILE diff --git a/scripts/remove b/scripts/remove index 1e2bc7f..c5e1000 100755 --- a/scripts/remove +++ b/scripts/remove @@ -79,6 +79,14 @@ ynh_secure_remove "/etc/$app/" # Remove the log files ynh_secure_remove "/var/log/$app/" +#================================================= +# REMOVE uwsgi and systemd files +#================================================= + +ynh_secure_remove "/etc/uwsgi/apps-enabled/$app.uwsgi.ini" + +ynh_secure_remove "/etc/systemd/system/$app.uwsgi.service" + #================================================= # GENERIC FINALIZATION #=================================================