]> git.openstreetmap.org Git - chef.git/blob - cookbooks/planet/recipes/current.rb
c7a4a8f50d1cb807191d03b47cd9829252c84646
[chef.git] / cookbooks / planet / recipes / current.rb
1 #
2 # Cookbook:: planet
3 # Recipe:: current
4 #
5 # Copyright:: 2018, 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
22 package %w[
23   pyosmium
24 ]
25
26 template "/usr/local/bin/planet-update" do
27   source "planet-update.erb"
28   owner "root"
29   group "root"
30   mode "755"
31 end
32
33 template "/usr/local/bin/planet-update-file" do
34   source "planet-update-file.erb"
35   owner "root"
36   group "root"
37   mode "755"
38 end
39
40 directory "/var/lib/planet" do
41   owner "planet"
42   group "planet"
43   mode "755"
44 end
45
46 remote_file "/var/lib/planet/planet.pbf" do
47   action :create_if_missing
48   source "https://planet.openstreetmap.org/pbf/planet-latest.osm.pbf"
49   owner "planet"
50   group "planet"
51   mode "644"
52   not_if { ENV["TEST_KITCHEN"] }
53 end
54
55 cron_d "planet-update" do
56   minute "17"
57   hour "1"
58   user "root"
59   command "/usr/local/bin/planet-update"
60 end
61
62 template "/etc/logrotate.d/planet-update" do
63   source "planet-update.logrotate.erb"
64   owner "root"
65   group "root"
66   mode "644"
67 end