From 4b531bc16f7accd428d750fcc01e9ccf996f942a Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Holcroft Date: Mon, 18 Sep 2017 15:08:21 +0200 Subject: [PATCH] uwsgi rewrite --- conf/nginx.conf | 2 +- conf/uwsgi.ini | 38 ++++++++++++-------------------------- conf/uwsgi_service | 10 +++++----- scripts/install | 2 +- 4 files changed, 19 insertions(+), 33 deletions(-) diff --git a/conf/nginx.conf b/conf/nginx.conf index c3c4a1c..470a468 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -7,7 +7,7 @@ location __PATH__ { # Needed for long running operations in admin interface uwsgi_read_timeout 3600; # Adjust based to uwsgi configuration: - uwsgi_pass unix:///opt/__NAME__/uwsgi.sock; + uwsgi_pass unix:///var/run/uwsgi/__NAME__.socket # uwsgi_pass 127.0.0.1:8080; # Include SSOWAT user panel. diff --git a/conf/uwsgi.ini b/conf/uwsgi.ini index e293d58..d5d8394 100644 --- a/conf/uwsgi.ini +++ b/conf/uwsgi.ini @@ -1,34 +1,20 @@ [uwsgi] -uid = __NAME__ -gid = users - -# the virtualenv (full path) -home = __FINALPATH__/venv - -protocol = uwsgi -wsgi-file = __FINALPATH__/venv/lib/python2.7/site-packages/weblate/wsgi.py -python-path = __FINALPATH__ +plugins = python +master = true +protocol = uwsgi +socket = unix:///var/run/uwsgi/__NAME__.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 +buffer-size = 8192 # Increase number of workers for heavily loaded sites #workers = 6 # Needed for background processing enable-threads = true # Child processes do not need file descriptors -close-on-exec = true +close-on-exec = true # Avoid default 0000 umask -umask = 0022 - -# process-related settings -# master -master = true -# maximum number of worker processes -processes = 4 -# the socket (use the full path to be safe -socket = /opt/__NAME__/uwsgi.sock -# ... with appropriate permissions - may be needed -chmod-socket = 666 -stats = /opt/__NAME__/stats.sock -# clear environment on exit -vacuum = true -plugins = python +umask = 0022 diff --git a/conf/uwsgi_service b/conf/uwsgi_service index 56e249c..9f669da 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-paste /etc/uwsgi/apps-enabled/__NAME__.uwsgi.ini -ExecReload=/bin/kill -HUP $MAINPID -ExecStop=/bin/kill -INT $MAINPID +ExecStart=/usr/bin/uwsgi \ + --ini-paste /etc/uwsgi/apps-enabled/__NAME__.uwsgi.ini \ + --socket /var/run/uwsgi/__NAME__.socket Restart=always StandardError=syslog diff --git a/scripts/install b/scripts/install index 9000e1e..a09b850 100755 --- a/scripts/install +++ b/scripts/install @@ -73,7 +73,7 @@ ynh_app_setting_set $app is_public $is_public ynh_install_app_dependencies libxml2-dev libxslt-dev libfreetype6-dev \ libjpeg-dev libz-dev libyaml-dev python-dev python-pip python-virtualenv \ - libmysqlclient-dev + libmysqlclient-dev uwsgi #================================================= # CREATE A MYSQL DATABASE