Skip to content

Instantly share code, notes, and snippets.

@jiphex
Created February 6, 2014 13:21
Show Gist options
  • Save jiphex/8843985 to your computer and use it in GitHub Desktop.
Save jiphex/8843985 to your computer and use it in GitHub Desktop.
00_crazy_uwsgi.md

So uwsgi is pretty crazy:

# ./bin/uwsgi --help|wc -l
857

I'm using it under runit to manage some graphite processes, the problem I was having, was that I simply couldn't get it to restart with sv t, or stop with sv d.

Turns out, this is because UWSGI's default behaviour is to "brutally reload" when it receives the TERM signal, unlike most other things you'd use under runit which would normally die.

Luckily, one of uwsgi's 857 options fixes this:

--die-on-term                          exit instead of brutal reload on SIGTERM

Pop that in your runit run script, and you'll be fine.

The full graphite run script I'm using is attached.

#!/bin/sh
cd /opt/graphite
exec chpst -u graphite ./bin/uwsgi --die-on-term --http :8085 --master --processes 4 --home /opt/graphite --pythonpath /opt/graphite/webapp/graphite --wsgi-file /opt/graphite/conf/graphite.wsgi.example
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment