]> git.openstreetmap.org Git - chef.git/blobdiff - cookbooks/nominatim/recipes/master.rb
nominatim: make log dir configurable and move it to ssd on dulcy
[chef.git] / cookbooks / nominatim / recipes / master.rb
index d33d7658d6c860facd0611b4ad921c35f28a0fe8..22a2a580c03302abc29205726aaf5c4ea9c23ac9 100644 (file)
 
 include_recipe "git"
 
 
 include_recipe "git"
 
+passwords = data_bag_item("nominatim", "passwords")
+database_cluster = node[:nominatim][:database][:cluster]
+home_directory = data_bag_item("accounts", "nominatim")["home"]
+
+wal_archives = node[:rsyncd][:modules][:archive][:path]
+# XXX we really should get a list of nominatim-slave nodes here
+slaves = "poldi"
+
 git "#{home_directory}/nominatim" do
   action :checkout
   repository node[:nominatim][:repository]
 git "#{home_directory}/nominatim" do
   action :checkout
   repository node[:nominatim][:repository]
@@ -30,10 +38,6 @@ end
 
 include_recipe "nominatim::base"
 
 
 include_recipe "nominatim::base"
 
-passwords = data_bag_item("nominatim", "passwords")
-database_cluster = node[:nominatim][:database][:cluster]
-home_directory = data_bag_item("accounts", "nominatim")["home"]
-
 superusers = %w(tomh lonvia twain nominatim)
 
 superusers.each do |user|
 superusers = %w(tomh lonvia twain nominatim)
 
 superusers.each do |user|
@@ -53,3 +57,20 @@ postgresql_user "replication" do
   replication true
 end
 
   replication true
 end
 
+directory wal_archives do
+  owner "postgres"
+  group "postgres"
+  mode 0700
+  only_if { node[:postgresql][:settings][:defaults][:archive_mode] == "on" }
+end
+
+template "/usr/local/bin/clean-db-nominatim" do
+  source "clean-db-nominatim.erb"
+  owner "root"
+  group "root"
+  mode 0755
+  variables :archive_dir => wal_archives,
+            :update_stop_file => "#{home_directory}/status/updates_disabled",
+            :streaming_clients => slaves
+  only_if { node[:postgresql][:settings][:defaults][:archive_mode] == "on" }
+end