Below are the actual files we use in one of our latest applications at Agora Games to achieve zero downtime deploys with gunicorn. I hope these files and notes help. I am happy to update these files or these notes if there are comments/questions. YMMV (of course).
Salient points for each file:
gunicorn.py
: Thepre_fork
function looks for gunicorn's old PID file in the proper file and sends the proper QUIT signal to the old process once the new process is running.sv-gunicorn-run.jinja
: This is the runit template we use in our Salt-managed infrastructure for handling the application process management. You could just as easily convert this to a non-templatized version.