This project provides an init script for the Gunicorn project.
You can run multiple python web application by setting multiple configuration files.
You will find in the tree directory an example of how to use this script.
For instance, each file in the
CONF_DIR directory (
/etc/gunicorn by default)
represents a web application. For each configuration file, the PID of the master
Gunicorn process is stored in
/var/run/gunicorn/<conf>.pid, and logs are
The script configuration file is
/etc/default/gunicorn. You have the following
variables to set:
RUN <yes|no>, should the script run on system boot ?
CONF_DIR, where are the web application configuration files ?
CONFIGS, which configuration file(s) to load ?
USE_VIRTUALENVS, which configuration file(s) to load ?
RUN_USER, the user to run the gunicorn process
Web application configuration
For the web application configuration file, you have these possible variables:
WORKING_DIR, the script will change to this directory before launching Gunicorn.
APP_MODULE, Python module and callable to run.
CONFIG_FILE, Python Gunicorn configuration file path.
LOG_LEVEL, logging level.
VIRTUALENV, path to the app virtualenv.
These are the different actions allowed by the init script:
start, starts all defined configuration files. The
RUNvariable must be set to
stop, stops all defined configuration files.
restart, restarts all defined configuration files.
reload, reloads (
kill -HUP) all defined configuration files.
start_one <conf>, starts the given configuration file.
stop_one <conf>, stops the given configuration file.
reload_one <conf>, reloads the given configuration file.
inc <conf>, increase workers for the given configuration file.
dec <conf>, decrease workers for the given configuration file.
gunicorn-init is released under the MIT License. See the LICENSE file for details.