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

Side by Side Diff: modules/notificationserver/manifests/init.pp

Issue 29557718: #3927 - Clear Nginx cache when notifications are updated (Closed)
Patch Set: Created Sept. 27, 2017, 4:37 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 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 $clear_cache = "find /var/cache/nginx/notification -type f -exec rm -rf {} +"
21
22 # https://linux.die.net/man/5/sudoers
23 file {"/etc/sudoers.d/notification-cache":
24 content => "nginx ALL=(www-data) NOPASSWD:/usr/bin/$clear_cache\n",
f.nicolaisen 2017/09/28 11:05:25 Consider extracting 'www-data' here and below to m
mathias 2017/09/28 12:00:00 Acknowledged.
25 ensure => 'present',
26 group => 'root',
27 mode => '0440',
28 owner => 'root',
29 }
30
31 # https://docs.puppet.com/puppet/latest/types/augeas.html
32 augeas {"files/opt/notifications/.hg/hgrc/hooks/cache":
33 changes => ["set hooks/changegroup.cache 'sudo -u www-data $clear_cache'"],
34 incl => '/opt/notifications/.hg/hgrc',
f.nicolaisen 2017/09/28 11:05:25 No dependency on the notifications repo having bee
mathias 2017/09/28 12:00:00 Acknowledged. Interestingly we just recently lear
35 lens => "Puppet.lns",
36 }
37
19 cron {'update_notifications': 38 cron {'update_notifications':
20 command => 'hg pull -q -u -R /opt/notifications', 39 command => 'hg pull -q -u -R /opt/notifications',
21 environment => hiera('cron::environment', []), 40 environment => hiera('cron::environment', []),
22 minute => '2-59/20', 41 minute => '2-59/20',
23 user => 'nginx', 42 user => 'nginx',
24 require => Exec['fetch_notifications'], 43 require => Exec['fetch_notifications'],
25 } 44 }
26 45
27 include spawn_fcgi 46 include spawn_fcgi
28 47
(...skipping 24 matching lines...) Expand all
53 nginx::hostconfig{'notification.adblockplus.org': 72 nginx::hostconfig{'notification.adblockplus.org':
54 source => 'puppet:///modules/notificationserver/site.conf', 73 source => 'puppet:///modules/notificationserver/site.conf',
55 global_config => template('notificationserver/global.conf.erb'), 74 global_config => template('notificationserver/global.conf.erb'),
56 is_default => $is_default, 75 is_default => $is_default,
57 certificate => 'easylist-downloads.adblockplus.org_sslcert.pem', 76 certificate => 'easylist-downloads.adblockplus.org_sslcert.pem',
58 private_key => 'easylist-downloads.adblockplus.org_sslcert.key', 77 private_key => 'easylist-downloads.adblockplus.org_sslcert.key',
59 log => 'access_log_notification', 78 log => 'access_log_notification',
60 log_format => 'notification', 79 log_format => 'notification',
61 } 80 }
62 } 81 }
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