]> git.openstreetmap.org Git - chef.git/blob - cookbooks/stats/recipes/default.rb
Bring stats.openstreetmap.org under chef control
[chef.git] / cookbooks / stats / recipes / default.rb
1 #
2 # Cookbook Name:: stats
3 # Recipe:: default
4 #
5 # Copyright 2013, OpenStreetMap Foundation
6 #
7 # Licensed under the Apache License, Version 2.0 (the "License");
8 # you may not use this file except in compliance with the License.
9 # You may obtain a copy of the License at
10 #
11 #     http://www.apache.org/licenses/LICENSE-2.0
12 #
13 # Unless required by applicable law or agreed to in writing, software
14 # distributed under the License is distributed on an "AS IS" BASIS,
15 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 # See the License for the specific language governing permissions and
17 # limitations under the License.
18 #
19
20 include_recipe "apache"
21
22 package "awstats"
23
24 node[:stats][:sites].each do |site|
25   template "/etc/awstats/awstats.#{site[:name]}.conf" do
26     source "awstats.conf.erb"
27     owner "root"
28     group "root"
29     mode 0644
30     variables :site => site
31   end
32 end
33
34 template "/etc/cron.d/awstats" do
35   source "awstats.cron.erb"
36   owner "root"
37   group "root"
38   mode 0644
39   variables :sites => node[:stats][:sites]
40 end
41
42 cookbook_file "/usr/local/bin/repack-archived-logs" do
43   owner "root"
44   group "root"
45   mode 0755
46 end
47
48 template "/etc/cron.d/repack-archived-logs" do
49   source "repack.cron.erb"
50   owner "root"
51   group "root"
52   mode 0644
53 end
54
55 directory "/srv/stats.openstreetmap.org" do
56   owner "root"
57   group "root"
58   mode 0755
59 end
60
61 template "/srv/stats.openstreetmap.org/index.html" do
62   source "index.html.erb"
63   owner "root"
64   group "root"
65   mode 644
66   variables :sites => node[:stats][:sites]
67 end
68
69 apache_site "stats.openstreetmap.org" do
70   template "apache.erb"
71   directory "/srv/stats.openstreetmap.org"
72 end