Left: | ||
Right: |
LEFT | RIGHT |
---|---|
1 class web::server($vhost, $repository) { | 1 class web::server($vhost, $repository) { |
2 File { | 2 File { |
3 owner => 'root', | 3 owner => 'root', |
4 group => 'root', | 4 group => 'root', |
5 mode => 0644, | 5 mode => 0644, |
6 } | 6 } |
7 | 7 |
8 Cron { | 8 Cron { |
9 environment => ['MAILTO=admin@adblockplus.org', 'PYTHONPATH=/opt/sitescripts '], | 9 environment => ['MAILTO=admin@adblockplus.org', 'PYTHONPATH=/opt/sitescripts '], |
10 } | 10 } |
11 | 11 |
12 include nginx | 12 include nginx |
13 | 13 |
14 package {['python-jinja2', 'python-markdown']:} | 14 package {['python-jinja2', 'python-markdown']:} |
15 | 15 |
16 file {'/etc/nginx/sites-enabled/default': | 16 nginx::hostconfig {$vhost: |
Felix Dahlke
2013/12/05 06:06:44
The nginx module already has this.
| |
17 ensure => absent, | |
18 require => Package['nginx'], | |
19 } | |
20 | |
21 file {"/etc/nginx/sites-available/${vhost}": | |
Felix Dahlke
2013/12/05 06:06:44
Why not use nginx::hostconfig?
| |
22 content => template('web/site.erb'), | 17 content => template('web/site.erb'), |
23 require => Package['nginx'], | 18 enabled => true, |
24 notify => Service['nginx'], | |
25 } | |
26 | |
27 file {"/etc/nginx/sites-enabled/${vhost}": | |
28 ensure => link, | |
29 target => "/etc/nginx/sites-available/${vhost}", | |
30 notify => Service['nginx'], | |
31 } | 19 } |
32 | 20 |
33 file {'/etc/nginx/sites-available/adblockplus.org_sslcert.key': | 21 file {'/etc/nginx/sites-available/adblockplus.org_sslcert.key': |
Felix Dahlke
2013/12/05 06:06:44
Shouldn't especially the key have mode 0400?
| |
34 ensure => file, | 22 ensure => file, |
35 require => Package['nginx'], | 23 mode => 0400, |
24 require => Nginx::Hostconfig[$vhost], | |
36 source => 'puppet:///modules/private/adblockplus.org_sslcert.key', | 25 source => 'puppet:///modules/private/adblockplus.org_sslcert.key', |
37 } | 26 } |
38 | 27 |
39 file {'/etc/nginx/sites-available/adblockplus.org_sslcert.pem': | 28 file {'/etc/nginx/sites-available/adblockplus.org_sslcert.pem': |
40 ensure => file, | 29 ensure => file, |
41 mode => 0400, | 30 mode => 0400, |
42 require => Package['nginx'], | 31 require => Nginx::Hostconfig[$vhost], |
43 source => 'puppet:///modules/private/adblockplus.org_sslcert.pem', | 32 source => 'puppet:///modules/private/adblockplus.org_sslcert.pem', |
44 } | 33 } |
45 | 34 |
46 class {'sitescripts': | 35 class {'sitescripts': |
47 sitescriptsini_source => 'puppet:///modules/web/sitescripts', | 36 sitescriptsini_source => 'puppet:///modules/web/sitescripts', |
48 } | 37 } |
49 | 38 |
50 user {'wwwuser': | 39 user {'www': |
Felix Dahlke
2013/12/05 06:06:44
I'd vote for just 'www' here, that's in line with
| |
51 ensure => present, | 40 ensure => present, |
52 comment => 'Web content owner', | 41 comment => 'Web content owner', |
53 home => '/home/wwwuser', | 42 home => '/home/www', |
54 managehome => true, | 43 managehome => true, |
55 } | 44 } |
56 | 45 |
57 exec {"fetch_repo": | 46 exec {"fetch_repo": |
58 command => "hg clone -U https://hg.adblockplus.org/${repository} /home/wwwus er/${repository}", | 47 command => "hg clone -U https://hg.adblockplus.org/${repository} /home/www/$ {repository}", |
59 path => ["/usr/bin/", "/bin/"], | 48 path => ["/usr/bin/", "/bin/"], |
60 require => Package['mercurial'], | 49 require => Package['mercurial'], |
61 user => wwwuser, | 50 user => www, |
62 timeout => 0, | 51 timeout => 0, |
63 onlyif => "test ! -d /home/wwwuser/${repository}", | 52 onlyif => "test ! -d /home/www/${repository}", |
64 } | 53 } |
65 | 54 |
66 file {'/var/www': | 55 file {'/var/www': |
67 ensure => directory, | 56 ensure => directory, |
68 mode => 755, | 57 mode => 755, |
69 } | 58 } |
70 | 59 |
71 file {"/var/www/${vhost}": | 60 file {"/var/www/${vhost}": |
72 ensure => directory, | 61 ensure => directory, |
73 owner => wwwuser, | 62 owner => www, |
74 mode => 755, | 63 mode => 755, |
75 } | 64 } |
76 | 65 |
77 cron {'update_repo': | 66 cron {'update_repo': |
78 ensure => present, | 67 ensure => present, |
79 command => "hg pull -q -R /home/wwwuser/${repository} && python -m sitescrip ts.cms.bin.generate_static_pages /home/wwwuser/${repository} /var/www/${vhost}", | 68 command => "hg pull -q -R /home/www/${repository} && python -m sitescripts.c ms.bin.generate_static_pages /home/www/${repository} /var/www/${vhost}", |
80 user => wwwuser, | 69 user => www, |
81 minute => '*/10', | 70 minute => '*/10', |
82 } | 71 } |
83 } | 72 } |
LEFT | RIGHT |