From 43c60df37165183afa4246cc6594b48b9ba1f1df Mon Sep 17 00:00:00 2001 From: zvolsky Date: Thu, 10 Mar 2016 10:15:03 +0100 Subject: [PATCH] nginx/ubuntu deploy script: added uWSGI Emperor configuration --- scripts/setup-web2py-nginx-uwsgi-ubuntu.sh | 29 +++++++++++++++++++--- 1 file changed, 25 insertions(+), 4 deletions(-) diff --git a/scripts/setup-web2py-nginx-uwsgi-ubuntu.sh b/scripts/setup-web2py-nginx-uwsgi-ubuntu.sh index 6b6da641..ffa4f984 100644 --- a/scripts/setup-web2py-nginx-uwsgi-ubuntu.sh +++ b/scripts/setup-web2py-nginx-uwsgi-ubuntu.sh @@ -1,6 +1,6 @@ #!/bin/bash echo 'setup-web2py-nginx-uwsgi-ubuntu-precise.sh' -echo 'Requires Ubuntu > 12.04 and installs Nginx + uWSGI + Web2py' +echo 'Requires Ubuntu > 12.04 or Debian >= 8 and installs Nginx + uWSGI + Web2py' # Check if user has root privileges if [[ $EUID -ne 0 ]]; then echo "You must run the script as root or using sudo" @@ -137,6 +137,26 @@ fi # Prepare folders for uwsgi sudo mkdir /etc/uwsgi sudo mkdir /var/log/uwsgi +sudo mkdir /etc/systemd +sudo mkdir /etc/systemd/system + +#uWSGI Emperor +echo '[Unit] +Description = uWSGI Emperor +After = syslog.target + +[Service] +ExecStart = /usr/local/bin/uwsgi --ini /etc/uwsgi/web2py.ini +RuntimeDirectory = uwsgi +Restart = always +KillSignal = SIGQUIT +Type = notify +StandardError = syslog +NotifyAccess = all + +[Install] +WantedBy = multi-user.target +' > /etc/systemd/system/emperor.uwsgi.service # Create configuration file /etc/uwsgi/web2py.ini echo '[uwsgi] @@ -192,17 +212,18 @@ if [ "$nopassword" -eq 0 ] then sudo -u www-data python -c "from gluon.main import save_password; save_password('$PW',443)" fi -start uwsgi-emperor +systemctl enable emperor.uwsgi.service +systemctl start emperor.uwsgi.service /etc/init.d/nginx restart echo <