]> git.openstreetmap.org Git - chef.git/blob - cookbooks/planet/recipes/dump.rb
Install g++ for building planet-dump-ng
[chef.git] / cookbooks / planet / recipes / dump.rb
1 #
2 # Cookbook:: planet
3 # Recipe:: dump
4 #
5 # Copyright:: 2013, 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 node.default[:incron][:planetdump] = {
21   :user => "www-data",
22   :path => "/store/backup",
23   :events => %w[IN_CREATE IN_MOVED_TO],
24   :command => "/usr/local/bin/planetdump $#"
25 }
26
27 include_recipe "git"
28 include_recipe "incron"
29
30 package %w[
31   gcc
32   g++
33   make
34   autoconf
35   automake
36   libxml2-dev
37   libboost-dev
38   libboost-program-options-dev
39   libboost-date-time-dev
40   libboost-filesystem-dev
41   libboost-thread-dev
42   libboost-iostreams-dev
43   libosmpbf-dev
44   libprotobuf-dev
45   osmpbf-bin
46   pbzip2
47   php-cli
48   php-curl
49 ]
50
51 directory "/opt/planet-dump-ng" do
52   owner "root"
53   group "root"
54   mode 0o755
55 end
56
57 git "/opt/planet-dump-ng" do
58   action :sync
59   repository "https://github.com/zerebubuth/planet-dump-ng.git"
60   revision "v1.1.6"
61   depth 1
62   user "root"
63   group "root"
64 end
65
66 execute "/opt/planet-dump-ng/autogen.sh" do
67   action :nothing
68   command "./autogen.sh"
69   cwd "/opt/planet-dump-ng"
70   user "root"
71   group "root"
72   subscribes :run, "git[/opt/planet-dump-ng]"
73 end
74
75 execute "/opt/planet-dump-ng/configure" do
76   action :nothing
77   command "./configure"
78   cwd "/opt/planet-dump-ng"
79   user "root"
80   group "root"
81   subscribes :run, "execute[/opt/planet-dump-ng/autogen.sh]"
82 end
83
84 execute "/opt/planet-dump-ng/Makefile" do
85   action :nothing
86   command "make"
87   cwd "/opt/planet-dump-ng"
88   user "root"
89   group "root"
90   subscribes :run, "execute[/opt/planet-dump-ng/configure]"
91 end
92
93 directory "/store/planetdump" do
94   owner "www-data"
95   group "www-data"
96   mode 0o755
97   recursive true
98 end
99
100 %w[planetdump planet-mirror-redirect-update].each do |program|
101   template "/usr/local/bin/#{program}" do
102     source "#{program}.erb"
103     owner "root"
104     group "root"
105     mode 0o755
106   end
107 end
108
109 template "/etc/cron.d/planet-dump-mirror" do
110   source "planet-dump-mirror-cron.erb"
111   owner "root"
112   group "root"
113   mode 0o644
114 end