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 | 13 include sitescripts |
14 | 14 |
15 $pythonpath = 'PYTHONPATH=/opt/cms:/opt/sitescripts' | 15 $pythonpath = 'PYTHONPATH=/opt/cms:/opt/sitescripts' |
16 | 16 |
17 # Ensure there is at least one character in the respective strings; | 17 # Ensure there is at least one character in the respective strings; |
18 # see https://codereview.adblockplus.org/29329028/#msg3 | 18 # see https://codereview.adblockplus.org/29329028/#msg3 |
19 validate_re($vhost, '.+') | 19 validate_re($vhost, '.+') |
20 validate_re($repository, '.+') | 20 validate_re($repository, '.+') |
21 | 21 |
22 File { | 22 File { |
23 owner => 'root', | 23 owner => 'root', |
24 group => 'root', | 24 group => 'root', |
25 mode => 0644, | 25 mode => '0644', |
26 } | 26 } |
27 | 27 |
28 Cron { | 28 Cron { |
29 environment => concat(hiera('cron::environment', []), [ | 29 environment => concat(hiera('cron::environment', []), [ |
30 $pythonpath, | 30 $pythonpath, |
31 ]), | 31 ]), |
32 } | 32 } |
33 | 33 |
34 class {'nginx': | 34 class {'nginx': |
35 geoip_country => $geoip ? { | 35 geoip_country => $geoip ? { |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 exec {"initialize_content": | 139 exec {"initialize_content": |
140 command => shellquote($initialize_content_exec), | 140 command => shellquote($initialize_content_exec), |
141 user => www, | 141 user => www, |
142 subscribe => [Exec["fetch_repo"], Exec["fetch_cms"]], | 142 subscribe => [Exec["fetch_repo"], Exec["fetch_cms"]], |
143 refreshonly => true, | 143 refreshonly => true, |
144 environment => $pythonpath, | 144 environment => $pythonpath, |
145 } | 145 } |
146 | 146 |
147 file {'/var/www': | 147 file {'/var/www': |
148 ensure => directory, | 148 ensure => directory, |
149 mode => 755, | 149 mode => '0755', |
150 } | 150 } |
151 | 151 |
152 file {[ | 152 file {[ |
153 "/var/cache/$repository", | 153 "/var/cache/$repository", |
154 "/var/www/$vhost", | 154 "/var/www/$vhost", |
155 "/var/www/docs", | 155 "/var/www/docs", |
156 ]: | 156 ]: |
157 ensure => directory, | 157 ensure => directory, |
158 owner => www, | 158 owner => www, |
159 mode => 755, | 159 mode => '0755', |
160 } | 160 } |
161 | 161 |
162 $update_cms_cmd = [ | 162 $update_cms_cmd = [ |
163 'hg', 'pull', | 163 'hg', 'pull', |
164 '--quiet', | 164 '--quiet', |
165 '--update', | 165 '--update', |
166 '--repository', '/opt/cms', | 166 '--repository', '/opt/cms', |
167 ] | 167 ] |
168 | 168 |
169 cron {'update_cms': | 169 cron {'update_cms': |
(...skipping 17 matching lines...) Expand all Loading... |
187 ) | 187 ) |
188 | 188 |
189 cron {'update_repo': | 189 cron {'update_repo': |
190 ensure => present, | 190 ensure => present, |
191 command => $update_webpage_cmd, | 191 command => $update_webpage_cmd, |
192 user => www, | 192 user => www, |
193 minute => '5-59/20', | 193 minute => '5-59/20', |
194 } | 194 } |
195 | 195 |
196 } | 196 } |
OLD | NEW |