OLD | NEW |
1 class notificationserver($is_default = false) { | 1 class notificationserver($is_default = false) { |
2 | 2 |
3 include nginx | 3 include nginx |
4 | 4 |
5 class {'sitescripts': | 5 class {'sitescripts': |
6 sitescriptsini_source => 'puppet:///modules/notificationserver/sitescripts.i
ni' | 6 sitescriptsini_source => 'puppet:///modules/notificationserver/sitescripts.i
ni' |
7 } | 7 } |
8 | 8 |
9 exec {'fetch_notifications': | 9 exec {'fetch_notifications': |
10 command => 'hg clone --noupdate https://hg.adblockplus.org/notifications /op
t/notifications && chown -R nginx /opt/notifications', | 10 command => 'hg clone --noupdate https://hg.adblockplus.org/notifications /op
t/notifications && chown -R nginx /opt/notifications', |
11 path => ['/usr/bin/', '/bin/'], | 11 path => ['/usr/bin/', '/bin/'], |
12 require => [ | 12 require => [ |
13 Package['mercurial'], | 13 Package['mercurial'], |
14 User['nginx'], | 14 User['nginx'], |
15 ], | 15 ], |
16 onlyif => 'test ! -d /opt/notifications' | 16 onlyif => 'test ! -d /opt/notifications' |
17 } | 17 } |
18 | 18 |
| 19 # http://hub.eyeo.com/issues/3927 |
| 20 $cache_flush = 'find /var/cache/nginx/notification -type f -exec rm -rf {} +' |
| 21 $cache_user = 'www-data' |
| 22 |
| 23 # https://linux.die.net/man/5/sudoers |
| 24 file {'/etc/sudoers.d/notification-cache': |
| 25 content => "nginx ALL=($cache_user) NOPASSWD:/usr/bin/$cache_flush\n", |
| 26 ensure => 'present', |
| 27 group => 'root', |
| 28 mode => '0440', |
| 29 owner => 'root', |
| 30 } |
| 31 |
| 32 # https://docs.puppet.com/puppet/latest/types/augeas.html |
| 33 augeas {'files/opt/notifications/.hg/hgrc/hooks/cache': |
| 34 changes => [ |
| 35 "set hooks/changegroup.cache 'sudo -u $cache_user $cache_flush'", |
| 36 ], |
| 37 incl => '/opt/notifications/.hg/hgrc', |
| 38 lens => 'Puppet.lns', |
| 39 require => [ |
| 40 Exec['fetch_notifications'], |
| 41 File['/etc/sudoers.d/notification-cache'], |
| 42 ], |
| 43 } |
| 44 |
19 cron {'update_notifications': | 45 cron {'update_notifications': |
20 command => 'hg pull -q -u -R /opt/notifications', | 46 command => 'hg pull -q -u -R /opt/notifications', |
21 environment => hiera('cron::environment', []), | 47 environment => hiera('cron::environment', []), |
22 minute => '2-59/20', | 48 minute => '2-59/20', |
23 user => 'nginx', | 49 user => 'nginx', |
24 require => Exec['fetch_notifications'], | 50 require => Exec['fetch_notifications'], |
25 } | 51 } |
26 | 52 |
27 include spawn_fcgi | 53 include spawn_fcgi |
28 | 54 |
(...skipping 24 matching lines...) Expand all Loading... |
53 nginx::hostconfig{'notification.adblockplus.org': | 79 nginx::hostconfig{'notification.adblockplus.org': |
54 source => 'puppet:///modules/notificationserver/site.conf', | 80 source => 'puppet:///modules/notificationserver/site.conf', |
55 global_config => template('notificationserver/global.conf.erb'), | 81 global_config => template('notificationserver/global.conf.erb'), |
56 is_default => $is_default, | 82 is_default => $is_default, |
57 certificate => 'easylist-downloads.adblockplus.org_sslcert.pem', | 83 certificate => 'easylist-downloads.adblockplus.org_sslcert.pem', |
58 private_key => 'easylist-downloads.adblockplus.org_sslcert.key', | 84 private_key => 'easylist-downloads.adblockplus.org_sslcert.key', |
59 log => 'access_log_notification', | 85 log => 'access_log_notification', |
60 log_format => 'notification', | 86 log_format => 'notification', |
61 } | 87 } |
62 } | 88 } |
OLD | NEW |