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