python - Restart Gunicorn_django via Fabric -
i'm building django application , decided investigate fabric automating deployment. i've got working, fails @ last step, , can't seem puzzle out why.
i'm using nginx , gunicorn serve application, , want kill , restart gunicorn after changes have been pulled in , database updated. unfortunately seems fail @ last hurdle.
the final command doesn't respond kind of error, application isn't getting served, , if ssh in there's no process , have restart manually. every other command works perfectly.
my fabfile.py:
#!/usr/bin/env python fabric.api import local, env, run fabric.context_managers import cd, prefix env.hosts = ['192.168.1.1'] env.path = "/home/matthew/sites/projectname" def deploy(): # push changes bitbucket local('git push origin master') # switch project directory cd(env.path): # pull changes server run('git pull origin master') # activate virtualenv prefix('source venv/bin/activate'): # collect static files run('python manage.py collectstatic --noinput') # sync , migrate database run('python manage.py syncdb') run('python manage.py migrate') # kill , restart gunicorn run('killall gunicorn_django || true') run('gunicorn_django -d -c gunicorn.conf.py')
if drop -d flag isn't daemonised, works , following output, have disconnect manually ctrl-c. if append & end, stops working:
[192.168.1.1] out: 2013-05-22 12:47:51 [60549] [info] starting gunicorn 0.17.4 [192.168.1.1] out: 2013-05-22 12:47:51 [60549] [info] listening at: http://127.0.0.1:8888 (60549) [192.168.1.1] out: 2013-05-22 12:47:51 [60549] [info] using worker: sync [192.168.1.1] out: 2013-05-22 12:47:51 [60554] [info] booting worker pid: 60554 [192.168.1.1] out: 2013-05-22 12:47:51 [60555] [info] booting worker pid: 60555 [192.168.1.1] out: 2013-05-22 12:47:51 [60556] [info] booting worker pid: 60556 [192.168.1.1] out:
can see i've gone astray?
didn't ever resolve such, knuckled down , picked supervisor. turned out, supervisor pretty simple use , this blog post able puzzle out quite quickly. thought i'd post in case else has same kind of issue , stumbles across page.
Comments
Post a Comment