Forge Home

uwsgi

Install and configure uwsgi in Emperor mode

87,673 downloads

86,145 latest version

2.5 quality score

We run a couple of automated
scans to help you access a
module's quality. Each module is
given a score based on how well
the author has formatted their
code and documentation and
modules are also checked for
malware using VirusTotal.

Please note, the information below
is for guidance only and neither of
these methods should be considered
an endorsement by Puppet.

Support the Puppet Community by contributing to this module

You are welcome to contribute to this module by suggesting new features, currency updates, or fixes. Every contribution is valuable to help ensure that the module remains compatible with the latest Puppet versions and continues to meet community needs. Complete the following steps:

  1. Review the module’s contribution guidelines and any licenses. Ensure that your planned contribution aligns with the author’s standards and any legal requirements.
  2. Fork the repository on GitHub, make changes on a branch of your fork, and submit a pull request. The pull request must clearly document your proposed change.

For questions about updating the module, contact the module’s author.

Version information

  • 1.2.0 (latest)
  • 1.1.0
  • 1.0.1
  • 1.0.0
  • 0.9.0
  • 0.1.1
  • 0.1.0
released Aug 19th 2014

Start using this module

  • r10k or Code Manager
  • Bolt
  • Manual installation
  • Direct download

Add this module to your Puppetfile:

mod 'engage-uwsgi', '1.2.0'
Learn more about managing modules with a Puppetfile

Add this module to your Bolt project:

bolt module add engage-uwsgi
Learn more about using this module with an existing project

Manually install this module globally with Puppet module tool:

puppet module install engage-uwsgi --version 1.2.0

Direct download is not typically how you would use a Puppet module to manage your infrastructure, but you may want to download the module in order to inspect the code.

Download

Documentation

engage/uwsgi — version 1.2.0 Aug 19th 2014

puppet-uwsgi

A puppet module for installing and managing uwsgi

Description

This module installs and configures uWSGI in Emperor mode.

It can also create and manage uwsgi applications that run under the emperor, which are best defined in hiera.

Just about every option is configurable, so it should work on most distributions by putting together a hiera file.

Classes

uwsgi

The main entry point. Simply include uwsgi to accept all the default parameters. The service file template will, by default, auto-configure itself for redhat init.d or upstart depending on the service provider.

Parameters

  • package_name The package name to install. Default: 'uwsgi'

  • package_ensure Package state. Default: 'installed'

    If 'absent' or 'purged', then remove the service_file and config_file also

  • package_provider The provider to use to install the package. Default: 'pip'

  • service_name The name of the service to run uwsgi. Default: 'uwsgi'

  • service_file The location of the service file. Default: '/etc/init/uwsgi.conf'

  • service_template The location of the template to generate the service_file. Default: 'uwsgi/uwsgi_upstart.conf.erb'

  • service_ensure The service state. Default: true

  • service_enable The service onboot state. Default: true

  • service_provider The service provider. Default: 'upstart'

    upstart is required for the default service_file, and works on RedHat >= 6. Setting service_provider to redhat will now deploy the init.d service file, unless you specifically set service_template etc.

  • manage_service_file Whether to override the system service file if it exists. Default: true

  • config_file The location of the uwsgi config file. Default: '/etc/uwsgi.ini'

  • log_dir The location of the uwsgi emperor log. Default: '/var/log/uwsgi/uwsgi-emperor.log'

  • app_directory Vassal directory for application config files.

    RedHat default: '/etc/uwsgi.d' Other default: '/etc/uwsgi/apps-enabled'

  • install_pip Install pip if it's not already installed? Default: true

  • install_python_dev Install python header files if not already installed? Default: true

  • python_pip Package to be installed for pip Default: 'python-pip'

  • python_dev Package to be installed for python headers Default RedHat: 'python-devel' Default Other: 'python-dev'

  • emperor_options Extra options to set in the emperor config file. Default: undef

Using Hiera

Sets up some custom options within the emperor config file:

---
uwsgi::emperor_options:
  vacuum: 'True'
  reload-mercy: 8

Don't manage python or pip, and use apt-get to install uwsgi. Don't manage the service file, as it will be provided by the package itself:

---
uwsgi::install_pip: false
uwsgi::install_python_dev: false
uwsgi::package_provider: 'apt'
uwsgi::manage_service_file: false

Remove uwsgi:

---
uwsgi::package_ensure: 'absent'
uwsgi::service_ensure: false
uwsgi::service_enable: false
uwsgi::install_pip: false
uwsgi::install_python_dev: false

Defined Types

uwsgi::app

Responsible for creating uwsgi applications that run under the uwsgi emperor. You shouldn't need to use this type directly, as the uwsgi class will automatically create all applications defined in hiera under the uwsgi::app key. See the hiera section below for examples.

Parameters

  • ensure Ensure the config file exists. Default: 'present'

  • template The template used to construct the config file. Default: 'uwsgi/uwsgi_app.ini.erb'

  • uid The user to run the application as. Required. May be the user name, not just the id.

  • gid The group to run the application as. Required. May be the group name, not just the id.

  • application_options Extra options to set in the application config file

  • environment_variables Extra environment variabls to set in the application config file

Using Hiera

Configure a django application:

---
uwsgi::app:
  django:
    ensure: 'present'
    uid: 'django'
    gid: 'django'
    application_options:
      chdir: '/path/to/project'
      module: 'mysite.wsgi:application'
      socket: '/tmp/uwsgi_django.sock'
      master: 'True'
      vaccum: 'True'
      max-requests: '5000'
      buffer-size: '32768'
      processes: 4
      threads: 8

Configure multiple applications (all yaml files are aggregated using hiera_hash):

# common.yaml
---
uwsgi::app:
  django_1:
    ensure: 'present'
    uid: 'django'
    gid: 'django'
    application_options:
      chdir: '/path/to/project'
      module: 'mysite.wsgi:application'
      socket: '/tmp/uwsgi_django.sock'


# role_app_server.yaml
---
uwsgi::app:
  django_2:
    ensure: 'present'
    uid: 'django'
    gid: 'django'
    application_options:
      chdir: '/path/to/project2'
      module: 'mysite.wsgi:application'
      socket: '/tmp/uwsgi_django2.sock'