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

Side by Side Diff: modules/statsmaster/manifests/awstats.pp

Issue 6293281981857792: Issue 239 - Move AWStats processing to the stats server (Closed)
Patch Set: Created April 23, 2014, 1:14 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
OLDNEW
(Empty)
1 class statsmaster::awstats {
2 package {['awstats', 'libgeo-ip-perl']:}
3
4 file {'/var/www/awstatsdata':
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,
24 owner => root,
25 mode => 0755,
26 }
27
28 concat {'/var/www/awstats/index.html':
29 mode => 0644,
30 owner => root,
31 }
32
33 concat {'/home/stats/process_logs':
34 owner => stats,
35 mode => 0700,
36 }
37
38 concat {'/home/stats/build_static':
39 owner => stats,
40 mode => 0700,
41 }
42
43 concat::fragment {'index_head':
44 target => '/var/www/awstats/index.html',
45 content => template('statsmaster/index_head.html.erb'),
46 order => 'aaahead',
47 }
48
49 concat::fragment {'index_foot':
50 target => '/var/www/awstats/index.html',
51 content => template('statsmaster/index_foot.html.erb'),
52 order => 'zzzfoot',
53 }
54
55 concat::fragment {'process_logs_head':
56 target => '/home/stats/process_logs',
57 content => template('statsmaster/process_logs_head.erb'),
58 order => 'aaahead',
59 }
60
61 concat::fragment {'build_static_head':
62 target => '/home/stats/build_static',
63 content => template('statsmaster/build_static_head.erb'),
64 order => 'aaahead',
65 }
66
67 define siteconfig($host, $log) {
68 file {"/var/www/awstatsconf/awstats.$title.conf":
69 ensure => present,
70 mode => 0444,
71 owner => root,
72 content => template('statsmaster/awstats.conf'),
73 }
74
75 file {["/var/www/awstatsdata/$title", "/var/www/awstats/$title", "/var/www/a wstats/archive/$title"]:
Felix Dahlke 2014/04/25 04:37:08 Nit: Wrap at 80 columns?
76 ensure => directory,
77 mode => 0755,
78 owner => stats,
79 }
80
81 concat::fragment {"index_$title":
82 target => '/var/www/awstats/index.html',
83 content => template('statsmaster/index_item.html.erb'),
84 order => $title,
85 }
86
87 concat::fragment {"process_logs_$title":
88 target => '/home/stats/process_logs',
89 content => template('statsmaster/process_logs_item.erb'),
90 order => $title,
91 }
92
93 concat::fragment {"build_static_$title":
94 target => '/home/stats/build_static',
95 content => template('statsmaster/build_static_item.erb'),
96 order => $title,
97 }
98 }
99
100 $sites = {
101 'adblockplus.org' => {
102 host => 'ssh.adblockplus.org',
103 log => 'access_log_adblockplus',
104 },
105 'easylist.adblockplus.org' => {
106 host => 'ssh.adblockplus.org',
107 log => 'access_log_easylist',
108 },
109 'share.adblockplus.org' => {
110 host => 'ssh.adblockplus.org',
111 log => 'access_log_share',
112 },
113 'facebook.adblockplus.me' => {
114 host => 'ssh.adblockplus.org',
115 log => 'access_log_facebook',
116 },
117 'youtube.adblockplus.org' => {
Wladimir Palant 2014/04/24 18:57:03 The site is called youtube.adblockplus.me, not you
118 host => 'ssh.adblockplus.org',
119 log => 'access_log_youtube',
120 },
121 'acceptableads.org' => {
122 host => 'ssh.adblockplus.org',
123 log => 'access_log_acceptableads',
124 },
125 'eyeo.com' => {
126 host => 'web1.adblockplus.org',
127 log => 'access_log_eyeo.com',
128 },
129 'intraforum.adblockplus.org' => {
130 host => 'server10.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',
132 },
133 }
134
135 create_resources(statsmaster::awstats::siteconfig, $sites)
136
137 cron {'awstats_update':
138 ensure => present,
139 require => [
140 Package['awstats', 'libgeo-ip-perl'],
141 Concat['/home/stats/process_logs'],
142 Concat['/home/stats/build_static'],
143 File['/var/www/awstatsconf'],
144 File['/var/www/awstatsdata'],
145 File['/var/www/awstats'],
146 ],
147 command => '/home/stats/process_logs && /home/stats/build_static',
148 environment => ['MAILTO=admins@adblockplus.org,root'],
149 user => stats,
150 hour => 4,
151 minute => 0,
152 }
153
154 cron {'awstats_prevmonth':
155 ensure => present,
156 require => [
157 Package['awstats'],
158 Concat['/home/stats/build_static'],
159 File['/var/www/awstatsconf'],
160 File['/var/www/awstatsdata'],
161 File['/var/www/awstats/archive'],
162 ],
163 command => '/home/stats/build_static prevmonth',
164 environment => ['MAILTO=admins@adblockplus.org,root'],
165 user => stats,
166 monthday => 1,
167 hour => 6,
168 minute => 0,
169 }
170 }
OLDNEW

Powered by Google App Engine
This is Rietveld