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