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