]> git.openstreetmap.org Git - chef.git/blob - cookbooks/planet/recipes/replication.rb
f055280f1e92ea294fc6cac462f513863c5bd549
[chef.git] / cookbooks / planet / recipes / replication.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 include_recipe "osmosis"
21
22 db_passwords = data_bag_item("db", "passwords")
23
24 directory "/etc/replication" do
25   owner "root"
26   group "root"
27   mode 0755
28 end
29
30 template "/etc/replication/auth.conf" do
31   source "replication.auth.erb"
32   user "root"
33   group "planet"
34   mode 0640
35   variables :password => db_passwords["planetdiff"]
36 end
37
38 directory "/var/lib/replication" do
39   owner "planet"
40   group "planet"
41   mode 0755
42 end
43
44 directory "/var/lib/replication/hour" do
45   owner "planet"
46   group "planet"
47   mode 0755
48 end
49
50 template "/var/lib/replication/hour/configuration.txt" do
51   source "replication.config.erb"
52   owner "planet"
53   group "planet"
54   mode 0644
55   variables :base => "minute", :interval => 3600
56 end
57
58 link "/var/lib/replication/hour/data" do
59   to "/store/planet/replication/hour"
60 end
61
62 directory "/var/lib/replication/day" do
63   owner "planet"
64   group "planet"
65   mode 0755
66 end
67
68 template "/var/lib/replication/hour/configuration.txt" do
69   source "replication.config.erb"
70   owner "planet"
71   group "planet"
72   mode 0644
73   variables :base => "hour", :interval => 86400
74 end
75
76 link "/var/lib/replication/day/data" do
77   to "/store/planet/replication/day"
78 end
79
80 template "/etc/cron.d/replication" do
81   source "replication.cron.erb"
82   owner "root"
83   group "root"
84   mode 0644
85 end