Skip to content

S-Stephen/gunicorn-init

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 

Repository files navigation

gunicorn-init

This project provides an init script for the Gunicorn project.

You can run multiple python web application by setting multiple configuration files.

Basic Usage

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 printed to /var/log/gunicorn/<conf>.log.

Script configuration

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.

Init script

These are the different actions allowed by the init script:

  • start, starts all defined configuration files. The RUN variable must be set to yes.

  • 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.

License

gunicorn-init is released under the MIT License. See the LICENSE file for details.

About

Gunicorn init script

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Shell 95.2%
  • Python 4.8%