]> git.openstreetmap.org Git - chef.git/blob - cookbooks/planet/recipes/dump.rb
7aca0844211b5e9ce82b6b9c96a65af96b39f05b
[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 #     http://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 => [ "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 directory "/opt/planet-dump-ng" do
46   owner "root"
47   group "root"
48   mode 0755
49 end
50
51 git "/opt/planet-dump-ng" do
52   action :sync
53   repository "git://github.com/zerebubuth/planet-dump-ng.git"
54   revision "v1.0.0"
55   user "root"
56   group "root"
57 end
58
59 execute "/opt/planet-dump-ng/autogen.sh" do
60   action :nothing
61   command "./autogen.sh"
62   cwd "/opt/planet-dump-ng"
63   user "root"
64   group "root"
65   subscribes :run, "git[/opt/planet-dump-ng]"
66 end
67
68 execute "/opt/planet-dump-ng/configure" do
69   action :nothing
70   command "./configure"
71   cwd "/opt/planet-dump-ng"
72   user "root"
73   group "root"
74   subscribes :run, "execute[/opt/planet-dump-ng/autogen.sh]"
75 end
76
77 execute "/opt/planet-dump-ng/Makefile" do
78   action :nothing
79   command "make"
80   cwd "/opt/planet-dump-ng"
81   user "root"
82   group "root"
83   subscribes :run, "execute[/opt/planet-dump-ng/configure]"
84 end
85
86 directory "/store/planetdump" do
87   owner "www-data"
88   group "www-data"
89   mode 0755
90 end
91
92 ["planetdump", "planet-mirror-redirect-update", "apache-latest-planet-filename"].each do |program|
93   template "/usr/local/bin/#{program}" do
94     source "#{program}.erb"
95     owner "root"
96     group "root"
97     mode 0755
98   end
99 end