2 # Cookbook Name:: piwik
5 # Copyright 2011, 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::ssl"
21 include_recipe "mysql"
23 passwords = data_bag_item("piwik", "passwords")
33 package "geoip-database-contrib"
38 version = node[:piwik][:version]
40 directory "/opt/piwik-#{version}" do
46 remote_file "/tmp/piwik-#{version}.zip" do
47 source "http://builds.piwik.org/piwik-#{version}.zip"
48 not_if { File.exist?("/opt/piwik-#{version}/piwik") }
51 execute "unzip-piwik-#{version}" do
52 command "unzip -q /tmp/piwik-#{version}.zip"
53 cwd "/opt/piwik-#{version}"
56 not_if { File.exist?("/opt/piwik-#{version}/piwik") }
59 directory "/opt/piwik-#{version}/piwik/config" do
65 template "/opt/piwik-#{version}/piwik/config/config.ini.php" do
70 variables :passwords => passwords,
71 :directory => "/opt/piwik-#{version}/piwik",
72 :plugins => node[:piwik][:plugins]
75 directory "/opt/piwik-#{version}/piwik/tmp" do
81 link "/srv/piwik.openstreetmap.org" do
82 to "/opt/piwik-#{version}/piwik"
83 notifies :restart, "service[apache2]"
86 mysql_user "piwik@localhost" do
87 password passwords["database"]
90 mysql_database "piwik" do
91 permissions "piwik@localhost" => :all
94 apache_site "piwik.openstreetmap.org" do
98 template "/etc/cron.d/piwiki" do