Defined Type: uwsgi::app

Defined in:
puppet/modules/uwsgi/manifests/app.pp

Overview

Define: uwsgi:app

Provisions a uWSGI application server instance.

Parameters

settings

Hash of hashes, representing the app configuration. Each key of the top-level hash is used as a section in the app's ini file. If a second level key has a value that is an Array, that key is repeated for each value of the array

Examples

uwsgi::app { 'graphite-web':
  settings => {
    uwsgi => {
        'plugins'     => 'python',
        'socket'      => '/var/run/graphite-web/graphite-web.sock',
        'wsgi-file'   => '/usr/share/graphite-web/graphite.wsgi',
        'master'      => true,
        'processes'   => 4,
        'env'         => ['MYSQL_HOST=localhost', 'STATSD_PREFIX=wat'],
    },
  },
}

Parameters:

  • settings (Any)
  • ensure (Any) (defaults to: present)
  • enabled (Any) (defaults to: true)


28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# File 'puppet/modules/uwsgi/manifests/app.pp', line 28

define uwsgi::app(
    $settings,
    $ensure   = present,
    $enabled  = true,
) {
    include ::uwsgi

    $basename = regsubst($title, '\W', '-', 'G')

    if $ensure == 'present' {
        file { "/etc/uwsgi/apps-available/${basename}.ini":
            content => template('uwsgi/app.ini.erb'),
        }

        if $enabled == true {
            $inipath =  "/etc/uwsgi/apps-enabled/${basename}.ini"
            file { $inipath:
                ensure => link,
                target => "/etc/uwsgi/apps-available/${basename}.ini",
            }

            systemd::service { "uwsgi-${title}":
                ensure             => present,
                template_name      => 'uwsgi',
                epp_template       => true,
                template_variables => {
                    inipath => $inipath,
                    title   => $title,
                },
                subscribe          => File["/etc/uwsgi/apps-available/${basename}.ini"],
            }
        }
    }
}