2 # Cookbook Name:: stats
 
   5 # Copyright 2013, OpenStreetMap Foundation
 
   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
 
  11 #     http://www.apache.org/licenses/LICENSE-2.0
 
  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.
 
  20 include_recipe "apache"
 
  23 package "libgeo-ipfree-perl"
 
  25 node[:stats][:sites].each do |site|
 
  26   template "/etc/awstats/awstats.#{site[:name]}.conf" do
 
  27     source "awstats.conf.erb"
 
  31     variables :site => site
 
  35 template "/etc/cron.d/awstats" do
 
  36   source "awstats.cron.erb"
 
  40   variables :sites => node[:stats][:sites]
 
  43 cookbook_file "/usr/local/bin/repack-archived-logs" do
 
  49 template "/etc/cron.d/repack-archived-logs" do
 
  50   source "repack.cron.erb"
 
  56 directory "/srv/stats.openstreetmap.org" do
 
  62 template "/srv/stats.openstreetmap.org/index.html" do
 
  63   source "index.html.erb"
 
  67   variables :sites => node[:stats][:sites]
 
  70 cookbook_file "/srv/stats.openstreetmap.org/robots.txt" do
 
  76 ssl_certificate "stats.openstreetmap.org" do
 
  77   domains ["stats.openstreetmap.org", "stats.osm.org"]
 
  78   notifies :reload, "service[apache2]"
 
  81 apache_site "stats.openstreetmap.org" do
 
  83   directory "/srv/stats.openstreetmap.org"