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