From c539006eed04d987c2bc48fc70915d2031de7890 Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Holcroft Date: Wed, 20 Sep 2017 21:43:09 +0200 Subject: [PATCH] uwsgi additions --- conf/nginx.conf | 2 +- conf/uwsgi.ini | 5 ++--- conf/uwsgi_service | 8 ++++---- scripts/backup | 2 +- scripts/install | 3 +-- scripts/remove | 6 +++--- scripts/restore | 6 +++--- 7 files changed, 15 insertions(+), 17 deletions(-) diff --git a/conf/nginx.conf b/conf/nginx.conf index ada9ce5..bad1d0a 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -8,7 +8,7 @@ location __PATH__ { uwsgi_read_timeout 3600; uwsgi_param SCRIPT_NAME /__PATH__; uwsgi_modifier1 30; - uwsgi_pass unix:///var/run/uwsgi/app/__NAME__/socket; + uwsgi_pass unix://__FINALPATH__//socket; # Include SSOWAT user panel. include conf.d/yunohost_panel.conf.inc; diff --git a/conf/uwsgi.ini b/conf/uwsgi.ini index 18afaaa..0cf4778 100644 --- a/conf/uwsgi.ini +++ b/conf/uwsgi.ini @@ -2,14 +2,13 @@ plugins = python master = true protocol = uwsgi -socket = /var/run/uwsgi/app/__NAME__/socket +socket = __FINALPATH__/socket virtualenv = __FINALPATH__/venv wsgi-file = __FINALPATH__/venv/lib/python2.7/site-packages/weblate/wsgi.py python-path = __FINALPATH__/venv -# In case you're using virtualenv uncomment this: -# virtualenv = /path/to/weblate/virtualenv # Needed for OAuth/OpenID buffer-size = 8192 +chmod-socket = 666 # Increase number of workers for heavily loaded sites #workers = 6 # Needed for background processing diff --git a/conf/uwsgi_service b/conf/uwsgi_service index b69f77d..5a80c1f 100644 --- a/conf/uwsgi_service +++ b/conf/uwsgi_service @@ -4,13 +4,13 @@ Requires=network.target After=network.target [Service] -User=root -Group=root +User=__NAME__ +Group=__NAME__ RemainAfterExit=yes WorkingDirectory=__FINALPATH__ ExecStart=/usr/bin/uwsgi \ - --ini /etc/uwsgi/apps-enabled/__NAME__.uwsgi.ini \ - --socket /var/run/uwsgi/app/__NAME__/socket + --ini /etc/uwsgi/apps-enabled/__NAME__.ini \ + --socket __FINALPATH__/socket Restart=always StandardError=syslog diff --git a/scripts/backup b/scripts/backup index 73ae09c..35c5301 100755 --- a/scripts/backup +++ b/scripts/backup @@ -71,4 +71,4 @@ ynh_backup "/etc/cron.d/$app" "${backup_dir}/etc/cron.d/$app" # BACKUP THE SERVICE #================================================= -ynh_backup "/etc/systemd/system/$app.uwsgi.service" "${backup_dir}/etc/systemd/system/$app.uwsgi.service" +ynh_backup "/etc/systemd/system/$app.service" "${backup_dir}/etc/systemd/system/$app.service" diff --git a/scripts/install b/scripts/install index 2efde94..9ec6913 100755 --- a/scripts/install +++ b/scripts/install @@ -127,7 +127,7 @@ ynh_replace_string "__FINALPATH__" "$final_path" "/etc/systemd/system/$app.servi systemctl enable "$app.service" # Add weblate as a service -yunohost service add "$app.service" +yunohost service add "$app.service" --log "/var/log/$app/APP.log" #================================================= # PIP INSTALLATION @@ -198,7 +198,6 @@ ynh_store_file_checksum "$final_path/venv/lib/python2.7/site-packages/weblate/se # Set permissions to app files chown -R "$app": "$final_path" -#chown -R 777 /var/run/uwsgi/app/$app/ #================================================= # SETUP LOGROTATE diff --git a/scripts/remove b/scripts/remove index 0ec8f31..dc1f1a6 100755 --- a/scripts/remove +++ b/scripts/remove @@ -26,7 +26,7 @@ db_name=$(ynh_app_setting_get $app db_name) if yunohost service status | grep -q $app then echo "Remove $app service" - yunohost service remove $app.uwsgi.service + yunohost service remove $app.service fi #================================================= @@ -83,9 +83,9 @@ 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/uwsgi/apps-enabled/$app.ini" -ynh_secure_remove "/etc/systemd/system/$app.uwsgi.service" +ynh_secure_remove "/etc/systemd/system/$app.service" #================================================= # GENERIC FINALIZATION diff --git a/scripts/restore b/scripts/restore index e2a8157..9a40218 100755 --- a/scripts/restore +++ b/scripts/restore @@ -96,13 +96,13 @@ pip install pytz python-bidi PyYaML Babel pyuca pylibravatar pydns # RESTORE THE SERVICE #================================================= -ynh_restore_file "/etc/systemd/system/$app.uwsgi.service" +ynh_restore_file "/etc/systemd/system/$app.service" #================================================= # ADVERTISE SERVICE IN ADMIN PANEL #================================================= -yunohost service add $app --log "/var/log/$app/APP.log" +yunohost service add $app.service --log "/var/log/$app/APP.log" #================================================= # RESTORE THE CRON FILE @@ -123,4 +123,4 @@ ynh_restore_file "/etc/logrotate.d/$app" #================================================= systemctl reload nginx -systemctl reload $app.uwsgi.service +systemctl reload $app.service