From 53c820d71926da6b053a91f96f0acbed5e556878 Mon Sep 17 00:00:00 2001 From: Vague Rabbit Date: Thu, 4 Feb 2021 21:15:44 -0800 Subject: [PATCH] ^ --- deploy-saleor.sh | 7 ++-- resources/saleor/template.uwsgi | 57 ++++++++++++++++----------------- 2 files changed, 31 insertions(+), 33 deletions(-) diff --git a/deploy-saleor.sh b/deploy-saleor.sh index cca6452..fee960c 100644 --- a/deploy-saleor.sh +++ b/deploy-saleor.sh @@ -620,9 +620,11 @@ wait # Build the emails npm run build-emails wait -# Run the uwsgi socket and create it for the first time -uwsgi --ini $HD/saleor/saleor/wsgi/uwsgi.ini --pidfile $HD/saleortemp.pid +# Set ownership of the app directory to $UN:www-data +sudo chown -R $UN:www-data $HD/saleor wait +# Run the uwsgi socket and create it for the first time +sudo uwsgi --ini $HD/saleor/saleor/wsgi/uwsgi.ini --uid www-data --gid www-data --pidfile $HD/saleortemp.pid sleep 5 # Stop the uwsgi processes uwsgi --stop $HD/saleortemp.pid @@ -632,7 +634,6 @@ deactivate sudo mv $HD/saleor/saleor$STATIC_URL /var/www/${HOST}${STATIC_URL} sudo chown -R www-data:www-data /var/www/$HOST sudo chmod -R 776 /var/www/$HOST -sudo chown -R $UN:www-data $HD/saleor ######################################################################################### diff --git a/resources/saleor/template.uwsgi b/resources/saleor/template.uwsgi index 0f2ccaf..0bef2d1 100644 --- a/resources/saleor/template.uwsgi +++ b/resources/saleor/template.uwsgi @@ -1,32 +1,29 @@ [uwsgi] -die-on-term = true -enable-threads = true -http = :$(PORT) - -# full path to Django project's root directory -chdir = {hd}/saleor/ -# Django's wsgi file -module = saleor.wsgi:application -# full path to python virtual env -home = {hd}/env/saleor -# enable uwsgi master process -master = true -# maximum number of worker processes -processes = 4 -# the socket (use the full path to be safe -socket = {hd}/saleor/saleor.sock -# socket permissions -chmod-socket = 666 -# clear environment on exit -vacuum = true +die-on-term = true +enable-threads = true +log-format = UWSGI uwsgi "%(method) %(uri) %(proto)" %(status) %(size) %(msecs)ms [PID:%(pid):Worker-%(wid)] [RSS:%(rssM)MB] # daemonize uwsgi and write messages into given log -daemonize = {hd}/uwsgi-emperor.log - -log-format = UWSGI uwsgi "%(method) %(uri) %(proto)" %(status) %(size) %(msecs)ms [PID:%(pid):Worker-%(wid)] [RSS:%(rssM)MB] -max-requests = 100 -memory-report = true -static-map = /static=/app/static -mimefile = /etc/mime.types -ignore-sigpipe = true -ignore-write-errors = true -disable-write-exception = true \ No newline at end of file +daemonize = {hd}/uwsgi-emperor.log +# enable uwsgi master process +master = true +max-requests = 100 +memory-report = true +module = saleor.wsgi:application +processes = 4 +static-map = /static=/app/static +mimefile = /etc/mime.types +ignore-sigpipe = true +ignore-write-errors = true +disable-write-exception = true +# Modifications +socket = {hd}/saleor/saleor.sock +# socket permissions +chown-socket = ubuntu:www-data +chmod-socket = 660 +strict = true +need-app = true +uid = {un} +# full path to python virtual env +home = {hd}/env/saleor +# full path to Django project's root directory +chdir = {hd}/saleor/saleor/core \ No newline at end of file