]> git.openstreetmap.org Git - chef.git/blob - cookbooks/tilelog/recipes/default.rb
Remove duplicate resource
[chef.git] / cookbooks / tilelog / recipes / default.rb
1 #
2 # Cookbook:: tilelog
3 # Recipe:: default
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 #     https://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 "git"
21 include_recipe "tools"
22
23 package %w[
24   gcc
25   g++
26   make
27   autoconf
28   automake
29   libboost-filesystem-dev
30   libboost-program-options-dev
31   libboost-system-dev
32 ]
33
34 tilelog_source_directory = node[:tilelog][:source_directory]
35 tilelog_input_directory = node[:tilelog][:input_directory]
36 tilelog_output_directory = node[:tilelog][:output_directory]
37
38 # resources for building the tile analysis binary
39 git tilelog_source_directory do
40   action :sync
41   repository "https://github.com/zerebubuth/openstreetmap-tile-analyze.git"
42   revision "live"
43   user "root"
44   group "root"
45   notifies :run, "execute[tilelog-autogen]", :immediately
46 end
47
48 execute "tilelog-autogen" do
49   action :nothing
50   command "autoreconf -i"
51   cwd tilelog_source_directory
52   user "root"
53   group "root"
54   notifies :run, "execute[tilelog-configure]", :immediately
55 end
56
57 execute "tilelog-configure" do
58   action :nothing
59   command "./configure --with-boost-libdir=/usr/lib/x86_64-linux-gnu"
60   cwd tilelog_source_directory
61   user "root"
62   group "root"
63   notifies :run, "execute[tilelog-build]", :immediately
64 end
65
66 execute "tilelog-build" do
67   action :nothing
68   command "make"
69   cwd tilelog_source_directory
70   user "root"
71   group "root"
72 end
73
74 # resources for running the tile analysis
75 template "/usr/local/bin/tilelog" do
76   source "tilelog.erb"
77   owner "root"
78   group "root"
79   mode 0o755
80   variables :analyze_bin => "#{tilelog_source_directory}/openstreetmap-tile-analyze",
81             :input_dir => tilelog_input_directory,
82             :output_dir => tilelog_output_directory
83 end
84
85 template "/etc/cron.d/tilelog" do
86   source "tilelog.cron.erb"
87   owner "root"
88   group "root"
89   mode 0o644
90 end
91
92 # resources related to the output of the analysis and where it
93 # can be publicly downloaded.
94 directory tilelog_output_directory do
95   user "www-data"
96   group "www-data"
97   mode 0o755
98   recursive true
99 end