OLD | NEW |
1 class web::server( | 1 class web::server( |
2 $vhost, | 2 $vhost, |
3 $repository, | 3 $repository, |
4 $certificate = hiera('web::server::certificate', 'undef'), | 4 $certificate = hiera('web::server::certificate', 'undef'), |
5 $private_key = hiera('web::server::private_key', 'undef'), | 5 $private_key = hiera('web::server::private_key', 'undef'), |
6 $is_default = false, | 6 $is_default = false, |
7 $aliases = undef, | 7 $aliases = undef, |
8 $custom_config = undef, | 8 $custom_config = undef, |
9 $multiplexer_locations = undef, | 9 $multiplexer_locations = undef, |
10 $geoip = false, | 10 $geoip = false, |
11 ) { | 11 ) { |
12 | 12 |
13 include sitescripts | |
14 | |
15 # Ensure there is at least one character in the respective strings; | 13 # Ensure there is at least one character in the respective strings; |
16 # see https://codereview.adblockplus.org/29329028/#msg3 | 14 # see https://codereview.adblockplus.org/29329028/#msg3 |
17 validate_re($vhost, '.+') | 15 validate_re($vhost, '.+') |
18 validate_re($repository, '.+') | 16 validate_re($repository, '.+') |
19 | 17 |
20 File { | 18 File { |
21 owner => 'root', | 19 owner => 'root', |
22 group => 'root', | 20 group => 'root', |
23 mode => 0644, | 21 mode => 0644, |
24 } | 22 } |
25 | 23 |
26 Cron { | 24 Cron { |
27 environment => concat(hiera('cron::environment', []), [ | 25 environment => concat(hiera('cron::environment', []), [ |
28 'PYTHONPATH=/opt/cms:/opt/sitescripts', | 26 'PYTHONPATH=/opt/cms:/opt/sitescripts', |
29 ]), | 27 ]), |
30 } | 28 } |
31 | 29 |
32 class {'nginx': | 30 class {'nginx': |
33 geoip_country => $geoip ? { | 31 geoip_country => $geoip ? { |
34 false => undef, | 32 false => undef, |
35 default => '/usr/share/GeoIP/GeoIPv6.dat', | 33 default => '/usr/share/GeoIP/GeoIPv6.dat', |
36 }, | 34 }, |
37 } | 35 } |
38 | 36 |
39 class {'geoip': | 37 class {'geoip': |
40 cron => {hour => 0, minute => 8, monthday => 15}, | 38 cron => {hour => 0, minute => 8, monthday => 15}, |
41 ensure => $geoip ? {false => 'absent', default => 'present'}, | 39 ensure => $geoip ? {false => 'absent', default => 'present'}, |
42 } | 40 } |
43 | 41 |
44 ensure_packages(['python-pip']) | 42 package {['python-jinja2', 'python-markdown']:} |
45 | |
46 # Make sure that apt packages corresponding to the pip-installed modules below | |
47 # won't be installed unintentionally, these will take precedence otherwise. | |
48 package {['python-jinja2', 'python-markdown']: | |
49 ensure => 'held', | |
50 } | |
51 | |
52 package {'Jinja2': | |
53 ensure => '2.8', | |
54 provider => 'pip', | |
55 require => [Package['python-pip'], Package['python-jinja2']], | |
56 } | |
57 | |
58 package {'markdown': | |
59 ensure => '2.6.6', | |
60 provider => 'pip', | |
61 require => [Package['python-pip'], Package['python-markdown']], | |
62 } | |
63 | 43 |
64 nginx::hostconfig {$vhost: | 44 nginx::hostconfig {$vhost: |
65 content => template('web/site.conf.erb'), | 45 content => template('web/site.conf.erb'), |
66 global_config => template('web/global.conf.erb'), | 46 global_config => template('web/global.conf.erb'), |
67 is_default => $is_default, | 47 is_default => $is_default, |
68 certificate => $certificate ? {'undef' => undef, default => $certificate}, | 48 certificate => $certificate ? {'undef' => undef, default => $certificate}, |
69 private_key => $private_key ? {'undef' => undef, default => $private_key}, | 49 private_key => $private_key ? {'undef' => undef, default => $private_key}, |
70 log => "access_log_$vhost" | 50 log => "access_log_$vhost" |
71 } | 51 } |
72 | 52 |
73 sitescripts::configfragment {$title: | |
74 source => 'puppet:///modules/web/sitescripts', | |
75 } | |
76 | |
77 if $multiplexer_locations != undef { | 53 if $multiplexer_locations != undef { |
78 include spawn-fcgi | 54 include spawn-fcgi |
79 package {'python-flup':} | 55 package {'python-flup':} |
80 | 56 |
| 57 class {'sitescripts': |
| 58 sitescriptsini_source => 'puppet:///modules/web/sitescripts', |
| 59 } |
| 60 |
81 spawn-fcgi::pool {"multiplexer": | 61 spawn-fcgi::pool {"multiplexer": |
82 ensure => present, | 62 ensure => present, |
83 fcgi_app => '/opt/sitescripts/multiplexer.fcgi', | 63 fcgi_app => '/opt/sitescripts/multiplexer.fcgi', |
84 socket => '/tmp/multiplexer-fastcgi.sock', | 64 socket => '/tmp/multiplexer-fastcgi.sock', |
85 mode => '0666', | 65 mode => '0666', |
86 user => 'nginx', | 66 user => 'nginx', |
87 children => 1, | 67 children => 1, |
88 require => [ | 68 require => [ |
89 Class["sitescripts"], | 69 Exec["fetch_sitescripts"], |
90 Package["python-flup"], | 70 Package["python-flup"], |
91 ], | 71 ], |
92 } | 72 } |
93 } | 73 } |
94 | 74 |
95 user {'www': | 75 user {'www': |
96 ensure => present, | 76 ensure => present, |
97 comment => 'Web content owner', | 77 comment => 'Web content owner', |
98 home => '/home/www', | 78 home => '/home/www', |
99 managehome => true, | 79 managehome => true, |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 path => ['/usr/bin/'], | 145 path => ['/usr/bin/'], |
166 require => Package['nodejs'], | 146 require => Package['nodejs'], |
167 onlyif => 'test ! -x /usr/bin/jsdoc', | 147 onlyif => 'test ! -x /usr/bin/jsdoc', |
168 } | 148 } |
169 | 149 |
170 package {['make', 'doxygen']:} | 150 package {['make', 'doxygen']:} |
171 | 151 |
172 cron {'generate_docs': | 152 cron {'generate_docs': |
173 ensure => present, | 153 ensure => present, |
174 require => [ | 154 require => [ |
175 Class['sitescripts'], | 155 Exec['fetch_sitescripts', 'install_jsdoc'], |
176 Exec['install_jsdoc'], | |
177 Package['make', 'doxygen'], | 156 Package['make', 'doxygen'], |
178 File['/var/www/docs'], | 157 File['/var/www/docs'], |
179 ], | 158 ], |
180 command => 'python -m sitescripts.docs.bin.generate_docs', | 159 command => 'python -m sitescripts.docs.bin.generate_docs', |
181 user => www, | 160 user => www, |
182 minute => '5-55/10', | 161 minute => '5-55/10', |
183 } | 162 } |
184 } | 163 } |
OLD | NEW |