From 3bac8469c054305c5cffdcd7ebfd782c84f5107d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felipe=20Mart=C3=ADn?= Date: Thu, 23 May 2013 18:27:41 +0200 Subject: [PATCH] Added supervisor/gunicorn handlers on deploy script. --- config/production/app.supervisor.conf | 1 + config/production/deploy.py | 13 +++++++++++++ 2 files changed, 14 insertions(+) diff --git a/config/production/app.supervisor.conf b/config/production/app.supervisor.conf index d3a2ea1..093cc52 100644 --- a/config/production/app.supervisor.conf +++ b/config/production/app.supervisor.conf @@ -2,6 +2,7 @@ command = /home/app/server.sh directory = /home/app user = app +stopsignal = QUIT autostart = true autorestart = true stdout_logfile = /var/log/supervisor/gunicorn.log diff --git a/config/production/deploy.py b/config/production/deploy.py index c0b9bac..409098a 100644 --- a/config/production/deploy.py +++ b/config/production/deploy.py @@ -413,6 +413,19 @@ status = call( check_status(status) # ================ SERVER ======================= +title('Server') +sub('Killing all gunicorn_django instances') +status = call(['killall', 'gunicorn_django'], + stdout=open(os.devnull, 'wb'), + stderr=open(os.devnull, 'wb')) +check_status(status) + +sub('Restarting with supervisor') +status = call(['sudo', 'supervisorctl', 'restart', 'gunicorn'], + stdout=open(os.devnull, 'wb'), + stderr=open(os.devnull, 'wb')) +check_status(status) + print("") success('Finished!')