2 # Cookbook Name:: planet
5 # Copyright 2013, OpenStreetMap Foundation
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
11 # https://www.apache.org/licenses/LICENSE-2.0
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.
20 include_recipe "osmosis"
22 db_passwords = data_bag_item("db", "passwords")
24 package "postgresql-client"
36 remote_directory "/opt/flush" do
46 execute "/opt/flush/Makefile" do
52 subscribes :run, "remote_directory[/opt/flush]"
55 remote_directory "/usr/local/bin" do
56 source "replication-bin"
65 template "/usr/local/bin/users-agreed" do
66 source "users-agreed.erb"
72 template "/usr/local/bin/users-deleted" do
73 source "users-deleted.erb"
79 remote_directory "/store/planet/users_deleted" do
80 source "users_deleted"
89 remote_directory "/store/planet/replication" do
90 source "replication-cgi"
99 directory "/store/planet/replication/changesets" do
105 directory "/store/planet/replication/day" do
111 directory "/store/planet/replication/hour" do
117 directory "/store/planet/replication/minute" do
123 directory "/etc/replication" do
129 template "/etc/replication/auth.conf" do
130 source "replication.auth.erb"
134 variables :password => db_passwords["planetdiff"]
137 template "/etc/replication/changesets.conf" do
138 source "changesets.conf.erb"
142 variables :password => db_passwords["planetdiff"]
145 template "/etc/replication/users-agreed.conf" do
146 source "users-agreed.conf.erb"
150 variables :password => db_passwords["planetdiff"]
153 directory "/var/lib/replication" do
159 directory "/var/lib/replication/hour" do
165 template "/var/lib/replication/hour/configuration.txt" do
166 source "replication.config.erb"
170 variables :base => "minute", :interval => 3600
173 link "/var/lib/replication/hour/data" do
174 to "/store/planet/replication/hour"
177 directory "/var/lib/replication/day" do
183 template "/var/lib/replication/day/configuration.txt" do
184 source "replication.config.erb"
188 variables :base => "hour", :interval => 86400
191 link "/var/lib/replication/day/data" do
192 to "/store/planet/replication/day"
195 if node[:planet][:replication] == "enabled"
196 template "/etc/cron.d/replication" do
197 source "replication.cron.erb"
203 file "/etc/cron.d/replication" do
208 # directory "/var/lib/replication/streaming" do
214 # directory "/var/log/replication" do
220 # ["streaming-replicator", "streaming-server"].each do |name|
221 # template "/etc/init.d/#{name}" do
222 # source "streaming.init.erb"
226 # variables :service => name
229 # if node[:planet][:replication] == "enabled"
231 # action [:enable, :start]
232 # supports :restart => true, :status => true
233 # subscribes :restart, "template[/etc/init.d/#{name}]"
237 # action [:disable, :stop]
238 # supports :restart => true, :status => true