Gunicorn or Green Unicorn is a Python WSGI HTTP Server for UNIX. It's a
pre-fork worker model ported from Ruby's Unicorn project. The Gunicorn server
is broadly compatible with various web frameworks, simply implemented, light on
server resources, and fairly speedy.
The providers of the wsgi relation must provide working_dir, plus optionally
any of the charm's config directives, which will override the current config
for the charm.
- Patrick Hetu firstname.lastname@example.org
How to configure the charm
To deploy a charm with this subordinate it must minimaly:
- Provide the wsgi interface.
- Set the
working_dirrelation variable in the wsgi hook.
The configuration of Gunicorn will use the variable pass by
the relation hook first. If there are not define it will
fallback to the global configuration of the charm.
Deployment with python-moinmoin for example::
juju bootstrap juju deploy --config mywiki_with_wsgi_settings.yaml python-moinmoin juju deploy gunicorn juju add-relation gunicorn python-moinmoin juju expose python-moinmoin
Accessing your new wiki should be ready at::
To find out the public address of gunicorn/python-moinmoin, look for it in
the output of the
juju status command.
I recommend using a reverse proxy like Nginx in front of Gunicorn.
- Rewrite the charm using python instead of BASH scripts
- add listen_ip configuration variable
Backwards incompatible changes:
- Remove the Django mode since Gunicorn is not recommending it anymore.
- Use Upstart to manage daemons
- no start/stop hook anymore use related charms instead.
- no configuration change directly on the charm anymore, use related charms instead.
- no access logging by default
- exposing a port must now be done in the linked charm instead of this one
- (string) Switch worker process to run as this group. A valid group id (as an int) or the name.
- (int) Timeout of a request in seconds.
- (string) Space separated extra settings. For example: --debug
- (string) The granularity of Error log outputs.
- (string) The Access log file to write to.
- (string) IP adresses that Gunicorn will listen on. By default we listen on all of them.
- (string) The log file to write to. If empty the logs would be handle by upstart.
- (int) The maximum number of requests a worker will process before restarting.
- (string) The variable to modify to trigger Gunicorn reload.
- (int) The number of worker process for handling requests. 0 for count(cpu) + 1
- (string) List of environment variables for the wsgi process. e.g. FOO="bar" BAZ="1 2 3"
- (string) The name of the WSGI application.
- (string) A bit mask for the file mode on files written by Gunicorn. The number 0 means Python guesses the base. Note that this affects unix socket permissions.
- (int) Keep alive time in seconds.
- (string) Set an additionnal PYTHONPATH to the project.
- (string) The Access log format. Don't forget to escape all quotes and round brackets.
- (int) The maximum number of pending connections.
- (string) Gunicorn workers type. Can be: sync, eventlet, gevent, tornado
- (int) Port the application will be listenning.
- (int) The maximum number of simultaneous clients.
- (string) Switch worker processes to run as this user. User id (as an int) or the name.