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

Delta Between Two Patch Sets: modules/statsmaster/manifests/awstats.pp

Issue 6293281981857792: Issue 239 - Move AWStats processing to the stats server (Closed)
Left Patch Set: Created April 23, 2014, 1:14 p.m.
Right Patch Set: Added IP address anonymization and addressed review comments Created April 25, 2014, 7:38 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « modules/statsmaster/files/site.conf ('k') | modules/statsmaster/manifests/downloads.pp » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
1 class statsmaster::awstats { 1 class statsmaster::awstats {
2 package {['awstats', 'libgeo-ip-perl']:} 2 package {['awstats', 'libgeo-ip-perl']:}
3 3
4 file {'/var/www/awstatsdata': 4 file {['/var/www/awstatsdata', '/var/www/awstatsconf', '/var/www/awstats']:
Felix Dahlke 2014/04/25 04:37:08 How about combining these directory resources? fi
5 ensure => directory,
6 owner => root,
7 mode => 0755,
8 }
9
10 file {'/var/www/awstatsconf':
11 ensure => directory,
12 owner => root,
13 mode => 0755,
14 }
15
16 file {'/var/www/awstats':
17 ensure => directory,
18 owner => root,
19 mode => 0755,
20 }
21
22 file {'/var/www/awstats/archive':
23 ensure => directory, 5 ensure => directory,
24 owner => root, 6 owner => root,
25 mode => 0755, 7 mode => 0755,
26 } 8 }
27 9
28 concat {'/var/www/awstats/index.html': 10 concat {'/var/www/awstats/index.html':
29 mode => 0644, 11 mode => 0644,
30 owner => root, 12 owner => root,
31 } 13 }
32 14
33 concat {'/home/stats/process_logs': 15 concat {['/home/stats/process_logs', '/home/stats/build_static',
34 owner => stats, 16 '/home/stats/anonymize_ips']:
35 mode => 0700,
36 }
37
38 concat {'/home/stats/build_static':
39 owner => stats, 17 owner => stats,
40 mode => 0700, 18 mode => 0700,
41 } 19 }
42 20
43 concat::fragment {'index_head': 21 concat::fragment {'index_head':
44 target => '/var/www/awstats/index.html', 22 target => '/var/www/awstats/index.html',
45 content => template('statsmaster/index_head.html.erb'), 23 content => template('statsmaster/index_head.html.erb'),
46 order => 'aaahead', 24 order => 'aaahead',
47 } 25 }
48 26
49 concat::fragment {'index_foot': 27 concat::fragment {'index_foot':
50 target => '/var/www/awstats/index.html', 28 target => '/var/www/awstats/index.html',
51 content => template('statsmaster/index_foot.html.erb'), 29 content => template('statsmaster/index_foot.html.erb'),
52 order => 'zzzfoot', 30 order => 'zzzfoot',
53 } 31 }
54 32
55 concat::fragment {'process_logs_head': 33 concat::fragment {'process_logs_head':
56 target => '/home/stats/process_logs', 34 target => '/home/stats/process_logs',
57 content => template('statsmaster/process_logs_head.erb'), 35 content => template('statsmaster/process_logs_head.erb'),
58 order => 'aaahead', 36 order => 'aaahead',
59 } 37 }
60 38
61 concat::fragment {'build_static_head': 39 concat::fragment {'build_static_head':
62 target => '/home/stats/build_static', 40 target => '/home/stats/build_static',
63 content => template('statsmaster/build_static_head.erb'), 41 content => template('statsmaster/build_static_head.erb'),
64 order => 'aaahead', 42 order => 'aaahead',
65 } 43 }
66 44
45 concat::fragment {'anonymize_ips_head':
46 target => '/home/stats/anonymize_ips',
47 content => template('statsmaster/anonymize_ips_head.erb'),
48 order => 'aaahead',
49 }
50
67 define siteconfig($host, $log) { 51 define siteconfig($host, $log) {
68 file {"/var/www/awstatsconf/awstats.$title.conf": 52 file {"/var/www/awstatsconf/awstats.$title.conf":
69 ensure => present, 53 ensure => present,
70 mode => 0444, 54 mode => 0444,
71 owner => root, 55 owner => root,
72 content => template('statsmaster/awstats.conf'), 56 content => template('statsmaster/awstats.conf'),
73 } 57 }
74 58
75 file {["/var/www/awstatsdata/$title", "/var/www/awstats/$title", "/var/www/a wstats/archive/$title"]: 59 file {["/var/www/awstatsdata/$title", "/var/www/awstats/$title",
Felix Dahlke 2014/04/25 04:37:08 Nit: Wrap at 80 columns?
60 "/var/www/awstats/archive/$title"]:
76 ensure => directory, 61 ensure => directory,
77 mode => 0755, 62 mode => 0755,
78 owner => stats, 63 owner => stats,
79 } 64 }
80 65
81 concat::fragment {"index_$title": 66 concat::fragment {"index_$title":
82 target => '/var/www/awstats/index.html', 67 target => '/var/www/awstats/index.html',
83 content => template('statsmaster/index_item.html.erb'), 68 content => template('statsmaster/index_item.html.erb'),
84 order => $title, 69 order => $title,
85 } 70 }
86 71
87 concat::fragment {"process_logs_$title": 72 concat::fragment {"process_logs_$title":
88 target => '/home/stats/process_logs', 73 target => '/home/stats/process_logs',
89 content => template('statsmaster/process_logs_item.erb'), 74 content => template('statsmaster/process_logs_item.erb'),
90 order => $title, 75 order => $title,
91 } 76 }
92 77
93 concat::fragment {"build_static_$title": 78 concat::fragment {"build_static_$title":
94 target => '/home/stats/build_static', 79 target => '/home/stats/build_static',
95 content => template('statsmaster/build_static_item.erb'), 80 content => template('statsmaster/build_static_item.erb'),
96 order => $title, 81 order => $title,
97 } 82 }
83
84 concat::fragment {"anonymize_ips_$title":
85 target => '/home/stats/anonymize_ips',
86 content => template('statsmaster/anonymize_ips_item.erb'),
87 order => $title,
88 }
98 } 89 }
99 90
100 $sites = { 91 $sites = {
101 'adblockplus.org' => { 92 'adblockplus.org' => {
102 host => 'ssh.adblockplus.org', 93 host => 'ssh.adblockplus.org',
103 log => 'access_log_adblockplus', 94 log => 'access_log_adblockplus',
104 }, 95 },
105 'easylist.adblockplus.org' => { 96 'easylist.adblockplus.org' => {
106 host => 'ssh.adblockplus.org', 97 host => 'ssh.adblockplus.org',
107 log => 'access_log_easylist', 98 log => 'access_log_easylist',
108 }, 99 },
109 'share.adblockplus.org' => { 100 'share.adblockplus.org' => {
110 host => 'ssh.adblockplus.org', 101 host => 'ssh.adblockplus.org',
111 log => 'access_log_share', 102 log => 'access_log_share',
112 }, 103 },
113 'facebook.adblockplus.me' => { 104 'facebook.adblockplus.me' => {
114 host => 'ssh.adblockplus.org', 105 host => 'ssh.adblockplus.org',
115 log => 'access_log_facebook', 106 log => 'access_log_facebook',
116 }, 107 },
117 'youtube.adblockplus.org' => { 108 'youtube.adblockplus.me' => {
Wladimir Palant 2014/04/24 18:57:03 The site is called youtube.adblockplus.me, not you
118 host => 'ssh.adblockplus.org', 109 host => 'ssh.adblockplus.org',
119 log => 'access_log_youtube', 110 log => 'access_log_youtube',
120 }, 111 },
121 'acceptableads.org' => { 112 'acceptableads.org' => {
122 host => 'ssh.adblockplus.org', 113 host => 'ssh.adblockplus.org',
123 log => 'access_log_acceptableads', 114 log => 'access_log_acceptableads',
124 }, 115 },
125 'eyeo.com' => { 116 'eyeo.com' => {
126 host => 'web1.adblockplus.org', 117 host => 'web1.adblockplus.org',
127 log => 'access_log_eyeo.com', 118 log => 'access_log_eyeo.com',
128 }, 119 },
129 'intraforum.adblockplus.org' => { 120 'intraforum.adblockplus.org' => {
130 host => 'server10.adblockplus.org', 121 host => 'server_10.adblockplus.org',
Wladimir Palant 2014/04/24 18:57:03 The DNS name is server_10, fixed that in https://h
131 log => 'access_log_intraforum', 122 log => 'access_log_intraforum',
132 }, 123 },
133 } 124 }
134 125
135 create_resources(statsmaster::awstats::siteconfig, $sites) 126 create_resources(statsmaster::awstats::siteconfig, $sites)
136 127
137 cron {'awstats_update': 128 cron {'awstats_update':
138 ensure => present, 129 ensure => present,
139 require => [ 130 require => [
140 Package['awstats', 'libgeo-ip-perl'], 131 Package['awstats', 'libgeo-ip-perl'],
141 Concat['/home/stats/process_logs'], 132 File['/home/stats/process_logs', '/home/stats/build_static',
142 Concat['/home/stats/build_static'], 133 '/var/www/awstatsconf', '/var/www/awstatsdata', '/var/www/awstats'],
143 File['/var/www/awstatsconf'],
144 File['/var/www/awstatsdata'],
145 File['/var/www/awstats'],
146 ], 134 ],
147 command => '/home/stats/process_logs && /home/stats/build_static', 135 command => '/home/stats/process_logs && /home/stats/build_static',
148 environment => ['MAILTO=admins@adblockplus.org,root'], 136 environment => ['MAILTO=admins@adblockplus.org,root'],
149 user => stats, 137 user => stats,
150 hour => 4, 138 hour => 4,
151 minute => 0, 139 minute => 0,
152 } 140 }
153 141
154 cron {'awstats_prevmonth': 142 cron {'awstats_prevmonth':
155 ensure => present, 143 ensure => present,
156 require => [ 144 require => [
157 Package['awstats'], 145 Package['awstats'],
158 Concat['/home/stats/build_static'], 146 File['/home/stats/build_static', '/home/stats/anonymize_ips',
159 File['/var/www/awstatsconf'], 147 '/var/www/awstatsconf', '/var/www/awstatsdata', '/var/www/awstats'],
160 File['/var/www/awstatsdata'],
161 File['/var/www/awstats/archive'],
162 ], 148 ],
163 command => '/home/stats/build_static prevmonth', 149 command => '/home/stats/anonymize_ips prevmonth && /home/stats/build_static prevmonth',
164 environment => ['MAILTO=admins@adblockplus.org,root'], 150 environment => ['MAILTO=admins@adblockplus.org,root'],
165 user => stats, 151 user => stats,
166 monthday => 1, 152 monthday => 1,
167 hour => 6, 153 hour => 6,
168 minute => 0, 154 minute => 0,
169 } 155 }
170 } 156 }
LEFTRIGHT

Powered by Google App Engine
This is Rietveld