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