Mercurial > repos > other > Puppet
annotate modules/python/manifests/gunicorn.pp @ 312:490d7ec20172
Make firewall rule numbering consistent for Dovecot
author | IBBoard <dev@ibboard.co.uk> |
---|---|
date | Sun, 23 Feb 2020 20:29:42 +0000 |
parents | c42fb28cff86 |
children | 66c075c5f54a |
rev | line source |
---|---|
272 | 1 # |
2 # @summary Manages Gunicorn virtual hosts. | |
3 # | |
4 # @param ensure | |
5 # @param config_dir Configure the gunicorn config directory path. | |
6 # @param manage_config_dir Set if the gunicorn config directory should be created. | |
7 # @param virtualenv Run in virtualenv, specify directory. | |
8 # @param mode Gunicorn mode. | |
9 # @param dir Application directory. | |
10 # @param bind Bind on: 'HOST', 'HOST:PORT', 'unix:PATH'. | |
11 # Default: system-wide: unix:/tmp/gunicorn-$name.socket | |
12 # virtualenv: unix:${virtualenv}/${name}.socket | |
13 # @param environment Set ENVIRONMENT variable. | |
14 # @param appmodule Set the application module name for gunicorn to load when not using Django. | |
15 # @param osenv Allows setting environment variables for the gunicorn service. Accepts a hash of 'key': 'value' pairs. | |
16 # @param timeout Allows setting the gunicorn idle worker process time before being killed. The unit of time is seconds. | |
17 # @param template Which ERB template to use. | |
18 # @param args Custom arguments to add in gunicorn config file. | |
19 # | |
20 # @example run gunicorn on vhost in virtualenv /var/www/project1 | |
21 # python::gunicorn { 'vhost': | |
22 # ensure => present, | |
23 # virtualenv => '/var/www/project1', | |
24 # mode => 'wsgi', | |
25 # dir => '/var/www/project1/current', | |
26 # bind => 'unix:/tmp/gunicorn.socket', | |
27 # environment => 'prod', | |
28 # owner => 'www-data', | |
29 # group => 'www-data', | |
30 # appmodule => 'app:app', | |
31 # osenv => { 'DBHOST' => 'dbserver.example.com' }, | |
32 # timeout => 30, | |
33 # template => 'python/gunicorn.erb', | |
34 # } | |
35 # | |
36 define python::gunicorn ( | |
37 Stdlib::Absolutepath $dir, | |
38 Enum['present', 'absent'] $ensure = present, | |
39 $config_dir = '/etc/gunicorn.d', | |
40 $manage_config_dir = false, | |
41 $virtualenv = false, | |
42 Enum['wsgi', 'django'] $mode = 'wsgi', | |
43 $bind = false, | |
44 $environment = false, | |
45 $owner = 'www-data', | |
46 $group = 'www-data', | |
47 $appmodule = 'app:app', | |
48 $osenv = false, | |
49 $timeout = 30, | |
50 $workers = false, | |
51 $access_log_format = false, | |
52 $accesslog = false, | |
53 $errorlog = false, | |
54 Enum['debug', 'info', 'warning', 'error', 'critical'] $log_level = 'error', | |
55 $template = 'python/gunicorn.erb', | |
56 $args = [], | |
57 ) { | |
58 if $manage_config_dir { | |
59 file { $config_dir: | |
0
956e484adc12
Initial public release of Puppet configs
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
60 ensure => directory, |
272 | 61 mode => '0755', |
62 owner => 'root', | |
63 group => 'root', | |
0
956e484adc12
Initial public release of Puppet configs
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
64 } |
272 | 65 file { "${config_dir}/${name}": |
66 ensure => $ensure, | |
67 mode => '0644', | |
68 owner => 'root', | |
69 group => 'root', | |
70 content => template($template), | |
71 require => File[$config_dir], | |
72 } | |
73 } else { | |
74 file { "${config_dir}/${name}": | |
75 ensure => $ensure, | |
76 mode => '0644', | |
77 owner => 'root', | |
78 group => 'root', | |
79 content => template($template), | |
0
956e484adc12
Initial public release of Puppet configs
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
80 } |
956e484adc12
Initial public release of Puppet configs
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
81 } |
272 | 82 |
0
956e484adc12
Initial public release of Puppet configs
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
83 } |