]> git.openstreetmap.org Git - chef.git/blob - cookbooks/planet/recipes/dump.rb
nominatim: install secondary importance file
[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 include_recipe "accounts"
21 include_recipe "git"
22
23 package %w[
24   gcc
25   g++
26   make
27   autoconf
28   automake
29   pkg-config
30   libxml2-dev
31   libboost-dev
32   libboost-program-options-dev
33   libboost-date-time-dev
34   libboost-filesystem-dev
35   libboost-thread-dev
36   libboost-iostreams-dev
37   libosmpbf-dev
38   libprotobuf-dev
39   osmpbf-bin
40   pbzip2
41   mktorrent
42   xmlstarlet
43   libxml2-utils
44   inotify-tools
45 ]
46
47 directory "/opt/planet-dump-ng" do
48   owner "root"
49   group "root"
50   mode "755"
51 end
52
53 git "/opt/planet-dump-ng" do
54   action :sync
55   repository "https://github.com/zerebubuth/planet-dump-ng.git"
56   revision "v1.2.7"
57   depth 1
58   user "root"
59   group "root"
60 end
61
62 execute "/opt/planet-dump-ng/autogen.sh" do
63   action :nothing
64   command "./autogen.sh"
65   cwd "/opt/planet-dump-ng"
66   user "root"
67   group "root"
68   subscribes :run, "git[/opt/planet-dump-ng]"
69 end
70
71 execute "/opt/planet-dump-ng/configure" do
72   action :nothing
73   command "./configure"
74   cwd "/opt/planet-dump-ng"
75   user "root"
76   group "root"
77   subscribes :run, "execute[/opt/planet-dump-ng/autogen.sh]"
78 end
79
80 execute "/opt/planet-dump-ng/Makefile" do
81   action :nothing
82   command "make"
83   cwd "/opt/planet-dump-ng"
84   user "root"
85   group "root"
86   subscribes :run, "execute[/opt/planet-dump-ng/configure]"
87 end
88
89 directory "/store/planetdump" do
90   owner "planet"
91   group "planet"
92   mode "755"
93   recursive true
94 end
95
96 %w[planetdump planetdump-trigger].each do |program|
97   template "/usr/local/bin/#{program}" do
98     source "#{program}.erb"
99     owner "root"
100     group "root"
101     mode "755"
102   end
103 end
104
105 systemd_service "planetdump@" do
106   description "Planet dump for %i"
107   user "planet"
108   exec_start "/usr/local/bin/planetdump %i"
109   memory_max "64G"
110   sandbox :enable_network => true
111   protect_home "tmpfs"
112   bind_paths "/home/planet"
113   read_write_paths [
114     "/store/planetdump",
115     "/store/planet/pbf",
116     "/store/planet/planet",
117     "/var/log/exim4",
118     "/var/spool/exim4"
119   ]
120 end
121
122 systemd_service "planetdump-trigger" do
123   description "Planet dump trigger"
124   user "root"
125   exec_start "/usr/local/bin/planetdump-trigger"
126   sandbox true
127   restrict_address_families "AF_UNIX"
128 end
129
130 service "planetdump-trigger" do
131   action [:enable, :start]
132   subscribes :restart, "template[/usr/local/bin/planetdump-trigger]"
133 end