]> git.openstreetmap.org Git - chef.git/blob - cookbooks/planet/recipes/tilelog.rb
56023d62e4357afaaf6b2fa246bc4773d8cd2d78
[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 directory tilelog_output_directory do
35   action :create
36   user "www-data"
37   group "www-data"
38   mode 0755
39 end
40
41 execute "tilelog-build" do
42   action :nothing
43   command "make"
44   cwd tilelog_source_directory
45   user "www-data"
46   group "www-data"
47 end
48
49 execute "tilelog-configure" do
50   action :nothing
51   command "./configure --with-boost-libdir=/usr/lib"
52   cwd tilelog_source_directory
53   user "www-data"
54   group "www-data"
55   notifies :run, "execute[tilelog-build]", :immediate
56 end
57
58 execute "tilelog-autogen" do
59   action :nothing
60   command "./autogen.sh"
61   cwd tilelog_source_directory
62   user "www-data"
63   group "www-data"
64   notifies :run, "execute[tilelog-configure]", :immediate
65 end
66
67 git tilelog_source_directory do
68   action :sync
69   repository "https://github.com/zerebubuth/openstreetmap-tile-analyze.git"
70   revision "HEAD"
71   user "www-data"
72   group "www-data"
73   notifies :run, "execute[tilelog-autogen]", :immediate
74 end
75
76 template "/usr/local/bin/tilelog" do
77   source "tilelog.erb"
78   owner "root"
79   group "root"
80   mode 0755
81   variables {
82     :analyze_bin => "#{tilelog_source_directory}/openstreetmap-tile-analyze",
83     :input_dir => tilelog_input_directory,
84     :output_dir => tilelog_output_directory
85   }
86 end
87
88 template "/etc/cron.d/tilelog" do
89   source "tileog.cron.erb"
90   owner "root"
91   group "root"
92   mode 0644
93 end