]> git.openstreetmap.org Git - chef.git/blob - cookbooks/planet/recipes/tilelog.rb
f5480f547ddeab76b578f21048eec13d6eff6b67
[chef.git] / cookbooks / planet / recipes / tilelog.rb
1 #
2 # Cookbook Name:: planet
3 # Recipe:: tilelog
4 #
5 # Copyright 2014, 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 "tools"
21
22 package "gcc"
23 package "make"
24 package "autoconf"
25 package "automake"
26 package "libboost-filesystem-dev"
27 package "libboost-system-dev"
28 package "libboost-program-options-dev"
29
30 tilelog_source_directory = node[:planet][:tilelog_source_directory]
31 tilelog_input_directory = node[:planet][:tilelog_input_directory]
32 tilelog_output_directory = node[:planet][:tilelog_output_directory]
33
34 execute "tilelog-build" do
35   action :nothing
36   command "make"
37   cwd tilelog_source_directory
38   user "www-data"
39   group "www-data"
40 end
41
42 execute "tilelog-configure" do
43   action :nothing
44   command "./configure --with-boost-libdir=/usr/lib"
45   cwd tilelog_source_directory
46   user "www-data"
47   group "www-data"
48   notifies :run, "execute[tilelog-build]", :immediate
49 end
50
51 execute "tilelog-autogen" do
52   action :nothing
53   command "./autogen.sh"
54   cwd tilelog_source_directory
55   user "www-data"
56   group "www-data"
57   notifies :run, "execute[tilelog-configure]", :immediate
58 end
59
60 git tilelog_source_directory do
61   action :sync
62   repository "https://github.com/zerebubuth/openstreetmap-tile-analyze.git"
63   revision "HEAD"
64   user "www-data"
65   group "www-data"
66   notifies :run, "execute[tilelog-autogen]", :immediate
67 end
68
69 template "/usr/local/bin/tilelog" do
70   source "tilelog.erb"
71   owner "root"
72   group "root"
73   mode 0755
74   variables {
75     :analyze_bin => "#{tilelog_source_directory}/openstreetmap-tile-analyze",
76     :input_dir => tilelog_input_directory,
77     :output_dir => tilelog_output_directory
78   }
79 end
80
81 template "/etc/cron.d/tilelog" do
82   source "tileog.cron.erb"
83   owner "root"
84   group "root"
85   mode 0644
86 end