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 "accounts"
21 include_recipe "osmosis"
23 db_passwords = data_bag_item("db", "passwords")
25 package "postgresql-client"
37 remote_directory "/opt/flush" do
47 execute "/opt/flush/Makefile" do
53 subscribes :run, "remote_directory[/opt/flush]"
56 remote_directory "/usr/local/bin" do
57 source "replication-bin"
66 template "/usr/local/bin/users-agreed" do
67 source "users-agreed.erb"
73 template "/usr/local/bin/users-deleted" do
74 source "users-deleted.erb"
80 remote_directory "/store/planet/users_deleted" do
81 source "users_deleted"
90 remote_directory "/store/planet/replication" do
91 source "replication-cgi"
100 directory "/store/planet/replication/changesets" do
106 directory "/store/planet/replication/day" do
112 directory "/store/planet/replication/hour" do
118 directory "/store/planet/replication/minute" do
124 directory "/etc/replication" do
130 template "/etc/replication/auth.conf" do
131 source "replication.auth.erb"
135 variables :password => db_passwords["planetdiff"]
138 template "/etc/replication/changesets.conf" do
139 source "changesets.conf.erb"
143 variables :password => db_passwords["planetdiff"]
146 template "/etc/replication/users-agreed.conf" do
147 source "users-agreed.conf.erb"
151 variables :password => db_passwords["planetdiff"]
154 directory "/var/lib/replication" do
160 directory "/var/lib/replication/hour" do
166 template "/var/lib/replication/hour/configuration.txt" do
167 source "replication.config.erb"
171 variables :base => "minute", :interval => 3600
174 link "/var/lib/replication/hour/data" do
175 to "/store/planet/replication/hour"
178 directory "/var/lib/replication/day" do
184 template "/var/lib/replication/day/configuration.txt" do
185 source "replication.config.erb"
189 variables :base => "hour", :interval => 86400
192 link "/var/lib/replication/day/data" do
193 to "/store/planet/replication/day"
196 if node[:planet][:replication] == "enabled"
197 template "/etc/cron.d/replication" do
198 source "replication.cron.erb"
204 file "/etc/cron.d/replication" do
209 # directory "/var/lib/replication/streaming" do
215 # directory "/var/log/replication" do
221 # ["streaming-replicator", "streaming-server"].each do |name|
222 # template "/etc/init.d/#{name}" do
223 # source "streaming.init.erb"
227 # variables :service => name
230 # if node[:planet][:replication] == "enabled"
232 # action [:enable, :start]
233 # supports :restart => true, :status => true
234 # subscribes :restart, "template[/etc/init.d/#{name}]"
238 # action [:disable, :stop]
239 # supports :restart => true, :status => true