diff --git a/conf/nginx.conf b/conf/nginx.conf index 1ff683f..0019584 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -13,5 +13,5 @@ location __PATH__/ { uwsgi_read_timeout 3600; uwsgi_param SCRIPT_NAME __PATH__; uwsgi_modifier1 30; - uwsgi_pass unix:///var/run/uwsgi/__NAME__.socket; + uwsgi_pass unix:///var/run/__NAME__/app.socket; } diff --git a/conf/uwsgi-app@.service b/conf/uwsgi-app@.service index 6f630e8..f61228d 100644 --- a/conf/uwsgi-app@.service +++ b/conf/uwsgi-app@.service @@ -1,12 +1,12 @@ - [Unit] Description=%i uWSGI app After=syslog.target [Service] +RuntimeDirectory=%i ExecStart=/usr/bin/uwsgi \ --ini /etc/uwsgi/apps-available/%i.ini \ - --socket /var/run/uwsgi/%i.socket \ + --socket /var/run/%i/app.socket \ --logto /var/log/uwsgi/%i/%i.log User=%i Group=www-data @@ -15,3 +15,6 @@ KillSignal=SIGQUIT Type=notify StandardError=syslog NotifyAccess=all + +[Install] +WantedBy=multi-user.target diff --git a/conf/uwsgi-app@.socket b/conf/uwsgi-app@.socket deleted file mode 100644 index 0975e29..0000000 --- a/conf/uwsgi-app@.socket +++ /dev/null @@ -1,11 +0,0 @@ -[Unit] -Description=Socket for uWSGI app %i - -[Socket] -ListenStream=/var/run/uwsgi/%i.socket -SocketUser=%i -SocketGroup=www-data -SocketMode=0775 - -[Install] -WantedBy=sockets.target diff --git a/conf/uwsgi.ini b/conf/uwsgi.ini index 0eeb8b6..9b8c360 100644 --- a/conf/uwsgi.ini +++ b/conf/uwsgi.ini @@ -2,7 +2,8 @@ plugins = python master = true protocol = uwsgi -socket = /var/run/uwsgi/__APP__.socket +socket = /var/run/__APP__/app.socket +chmod-socket = 660 virtualenv = __FINALPATH__/local wsgi-file = __FINALPATH__/syncserver.wsgi python-path = __FINALPATH__/local diff --git a/scripts/_common.sh b/scripts/_common.sh index 951e218..6d7e3bb 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -6,14 +6,12 @@ ynh_check_global_uwsgi_config () { uwsgi --version || ynh_die "You need to add uwsgi (and appropriate plugin) as a dependency" - cp ../conf/uwsgi-app@.socket /etc/systemd/system/uwsgi-app@.socket cp ../conf/uwsgi-app@.service /etc/systemd/system/uwsgi-app@.service systemctl daemon-reload } # Create a dedicated uwsgi ini file to use with generic uwsgi service -# It will install generic uwsgi.socket and # # This will use a template in ../conf/uwsgi.ini # and will replace the following keywords with @@ -74,8 +72,6 @@ ynh_add_uwsgi_service () { systemctl daemon-reload systemctl stop "uwsgi-app@$app.service" - systemctl enable "uwsgi-app@$app.socket" - systemctl restart "uwsgi-app@$app.socket" systemctl enable "uwsgi-app@$app.service" systemctl start "uwsgi-app@$app.service" @@ -89,8 +85,6 @@ ynh_add_uwsgi_service () { ynh_remove_uwsgi_service () { local finaluwsgiini="/etc/uwsgi/apps-available/$app.ini" if [ -e "$finaluwsgiini" ]; then - systemctl stop "uwsgi-app@$app.socket" - systemctl disable "uwsgi-app@$app.socket" systemctl stop "uwsgi-app@$app.service" systemctl disable "uwsgi-app@$app.service" yunohost service remove "uwsgi-app@$app" diff --git a/scripts/backup b/scripts/backup index 76a0bb5..f86bf14 100644 --- a/scripts/backup +++ b/scripts/backup @@ -60,4 +60,3 @@ ynh_backup "/var/log/uwsgi/$app" ynh_backup "/etc/uwsgi/apps-available/$app.ini" ynh_backup "/etc/systemd/system/uwsgi-app@.service" -ynh_backup "/etc/systemd/system/uwsgi-app@.socket" diff --git a/scripts/restore b/scripts/restore index 952ec19..541ceeb 100644 --- a/scripts/restore +++ b/scripts/restore @@ -101,6 +101,5 @@ yunohost service add "uwsgi-app@$app.service" --log "/var/log/uwsgi/app/$app" # RELOAD NGINX AND PHP-FPM #================================================= -systemctl start "uwsgi-app@$app.socket" systemctl start "uwsgi-app@$app.service" systemctl reload nginx