Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Side by Side Diff: modules/web/manifests/server.pp

Issue 5370681407569920: Issue 2128 - Update web server configuration to use the cms repository (Closed)
Patch Set: Created March 13, 2015, 12:32 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 class web::server( 1 class web::server(
2 $vhost, 2 $vhost,
3 $repository, 3 $repository,
4 $certificate, 4 $certificate,
5 $private_key, 5 $private_key,
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 File { 10 File {
11 owner => 'root', 11 owner => 'root',
12 group => 'root', 12 group => 'root',
13 mode => 0644, 13 mode => 0644,
14 } 14 }
15 15
16 Cron { 16 Cron {
17 environment => ['MAILTO=admins@adblockplus.org', 'PYTHONPATH=/opt/sitescript s'], 17 environment => ['MAILTO=admins@adblockplus.org', 'PYTHONPATH=/opt/cms:/opt/s itescripts'],
18 } 18 }
19 19
20 include nginx 20 include nginx
21 21
22 package {['python-jinja2', 'python-markdown']:} 22 package {['python-jinja2', 'python-markdown']:}
23 23
24 nginx::hostconfig {$vhost: 24 nginx::hostconfig {$vhost:
25 content => template('web/site.conf.erb'), 25 content => template('web/site.conf.erb'),
26 global_config => template('web/global.conf.erb'), 26 global_config => template('web/global.conf.erb'),
27 is_default => $is_default, 27 is_default => $is_default,
28 certificate => $certificate, 28 certificate => $certificate,
29 private_key => $private_key, 29 private_key => $private_key,
30 log => "access_log_$vhost" 30 log => "access_log_$vhost"
31 } 31 }
32 32
33 class {'sitescripts':
34 sitescriptsini_source => 'puppet:///modules/web/sitescripts',
35 }
36
37 if $multiplexer_locations != undef { 33 if $multiplexer_locations != undef {
38 include spawn-fcgi 34 include spawn-fcgi
39 package {'python-flup':} 35 package {'python-flup':}
40 36
37 class {'sitescripts':
38 sitescriptsini_source => 'puppet:///modules/web/sitescripts',
39 }
40
41 spawn-fcgi::pool {"multiplexer": 41 spawn-fcgi::pool {"multiplexer":
42 ensure => present, 42 ensure => present,
43 fcgi_app => '/opt/sitescripts/multiplexer.fcgi', 43 fcgi_app => '/opt/sitescripts/multiplexer.fcgi',
44 socket => '/tmp/multiplexer-fastcgi.sock', 44 socket => '/tmp/multiplexer-fastcgi.sock',
45 mode => '0666', 45 mode => '0666',
46 user => 'nginx', 46 user => 'nginx',
47 children => 1, 47 children => 1,
48 require => [ 48 require => [
49 Exec["fetch_sitescripts"], 49 Exec["fetch_sitescripts"],
50 Package["python-flup"], 50 Package["python-flup"],
51 ], 51 ],
52 } 52 }
53 } 53 }
54 54
55 user {'www': 55 user {'www':
56 ensure => present, 56 ensure => present,
57 comment => 'Web content owner', 57 comment => 'Web content owner',
58 home => '/home/www', 58 home => '/home/www',
59 managehome => true, 59 managehome => true,
60 } 60 }
61 61
62 exec {"fetch_cms":
63 command => "hg clone https://hg.adblockplus.org/cms/ /opt/cms",
64 path => ["/usr/bin/", "/bin/"],
65 require => Package['mercurial'],
66 timeout => 0,
67 onlyif => "test ! -d /opt/cms",
68 }
69
62 exec {"fetch_repo": 70 exec {"fetch_repo":
63 command => "hg clone -U https://hg.adblockplus.org/${repository} /home/www/$ {repository}", 71 command => "hg clone -U https://hg.adblockplus.org/${repository} /home/www/$ {repository}",
64 path => ["/usr/bin/", "/bin/"], 72 path => ["/usr/bin/", "/bin/"],
65 require => Package['mercurial'], 73 require => Package['mercurial'],
66 user => www, 74 user => www,
67 timeout => 0, 75 timeout => 0,
68 onlyif => "test ! -d /home/www/${repository}", 76 onlyif => "test ! -d /home/www/${repository}",
69 } 77 }
70 78
71 file {'/var/www': 79 file {'/var/www':
72 ensure => directory, 80 ensure => directory,
73 mode => 755, 81 mode => 755,
74 } 82 }
75 83
76 file {"/var/www/${vhost}": 84 file {"/var/www/${vhost}":
77 ensure => directory, 85 ensure => directory,
78 owner => www, 86 owner => www,
79 mode => 755, 87 mode => 755,
80 } 88 }
81 89
90 cron {'update_cms':
91 ensure => present,
92 command => "hg pull -q -u -R /opt/cms",
93 minute => '5-55/10',
94 }
95
82 cron {'update_repo': 96 cron {'update_repo':
83 ensure => present, 97 ensure => present,
84 command => "hg pull -q -R /home/www/${repository} && python -m sitescripts.c ms.bin.generate_static_pages /home/www/${repository} /var/www/${vhost}", 98 command => "hg pull -q -R /home/www/${repository} && python -m cms.bin.gener ate_static_pages /home/www/${repository} /var/www/${vhost}",
85 user => www, 99 user => www,
86 minute => '*/10', 100 minute => '*/10',
87 } 101 }
88 } 102 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld