-
-end
-
-# Replication
-
-cron_d "nominatim-clean-db" do
- action node[:nominatim][:state] == "master" ? :create : :delete
- minute "5"
- hour "*/4"
- user "postgres"
- command "#{bin_directory}/clean-db-nominatim"
- mailto email_errors
-end
-
-if node[:nominatim][:state] == "master"
- postgresql_user "replication" do
- cluster node[:nominatim][:dbcluster]
- password data_bag_item("nominatim", "passwords")["replication"]
- replication true
- end
-
- directory node[:rsyncd][:modules][:archive][:path] do
- owner "postgres"
- group "postgres"
- mode "700"
- end
-
- template "#{bin_directory}/clean-db-nominatim" do
- source "clean-db-nominatim.erb"
- owner "nominatim"
- group "nominatim"
- mode "755"
- variables :archive_dir => node[:rsyncd][:modules][:archive][:path],
- :update_stop_file => "#{basedir}/status/updates_disabled",
- :streaming_clients => search(:node, "nominatim_state:slave").map { |slave| slave[:fqdn] }.join(" ")
- end
-end
-
-# Maintenance
-
-cron_d "nominatim-backup" do
- action (node[:nominatim][:enable_backup] && node[:nominatim][:state] != "off") ? :create : :delete
- minute "0"
- hour "3"
- day "1"
- user "nominatim"
- command "#{bin_directory}/backup-nominatim"
- mailto email_errors
-end
-
-cron_d "nominatim-vacuum-db" do
- action node[:nominatim][:state] != "off" ? :create : :delete
- minute "20"
- hour "0"
- user "postgres"
- command "#{bin_directory}/vacuum-db-nominatim"
- mailto email_errors
-end
-
-%w[backup-nominatim vacuum-db-nominatim].each do |fname|
- template "#{bin_directory}/#{fname}" do
- source "#{fname}.erb"
- owner "nominatim"
- group "nominatim"
- mode "755"
- variables :db => node[:nominatim][:dbname]
- end