Skip to main content

A wrapper around gunicorn to handle graceful restarts correctly

Project description

Rainbow Saddle

https://travis-ci.org/flupke/rainbow-saddle.svg

rainbow-saddle is a wrapper around Gunicorn to simplify code reloading without dropping requests.

Installation

Install from pypi:

$ sudo pip install rainbow-saddle

Or from source:

$ sudo ./setup.py install

Why?

Sometimes doing a kill -HUP <gunicorn PID> is not sufficient to reload your code. For example it doesn’t work well if you host your code behind a symlink, or if a .pth in your installation is updated to point to a different directory.

The correct way to reload code in such situations is a bit complicated:

# Reexec a new master with new workers
/bin/kill -s USR2 `cat "$PID"`
# Graceful stop old workers
/bin/kill -s WINCH `cat "$PIDOLD"`
# Graceful stop old master
/bin/kill -s QUIT `cat "$PIDOLD"`

It also has the downside of changing the “master” process PID, which confuses tools such as supervisord.

rainbow-saddle handles all of this for you, and never changes its PID. Reloading code becomes as simple as sending a SIGHUP again:

$ rainbow-saddle --pid /tmp/mysite.pid gunicorn_paster development.ini --log-level debug
$ kill -HUP `cat /tmp/mysite.pid`

News

0.4.0

Support new binary upgrade method used by Gunicorn, since version 19.6.0. Drops support for all previous versions of Gunicorn. See commit benoitc/gunicorn@418f140 for more info, thanks to Jacob Magnusson.

0.3.1

Minor Python3 compatibility fix, thanks to Justin Locsei.

0.3.0

Thanks to Rafael Floriano da Silva for the following:

  • add –gunicorn-pidfile
  • fix race condition for slow starting apps
  • update psutil

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, size & hash SHA256 hash help File type Python version Upload date
rainbow-saddle-0.4.0.tar.gz (5.2 kB) Copy SHA256 hash SHA256 Source None Oct 5, 2016

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page