-node[:nominatim][:fpm_pools].each do |name,data|
- template "/etc/php5/fpm/pool.d/#{name}.conf" do
- source "fpm.conf.erb"
+postgresql_munin "nominatim" do
+ cluster node[:nominatim][:dbcluster]
+ database node[:nominatim][:dbname]
+end
+
+directory "#{basedir}/tablespaces" do
+ owner "postgres"
+ group "postgres"
+ mode 0o700
+end
+
+# Note: tablespaces must be exactly in the same location on each
+# Nominatim instance when replication is in use. Therefore
+# use symlinks to canonical directory locations.
+node[:nominatim][:tablespaces].each do |name, location|
+ directory location do
+ owner "postgres"
+ group "postgres"
+ mode 0o700
+ recursive true
+ end
+
+ link "#{basedir}/tablespaces/#{name}" do
+ to location
+ end
+
+ postgresql_tablespace name do
+ cluster node[:nominatim][:dbcluster]
+ location "#{basedir}/tablespaces/#{name}"
+ end
+end
+
+if node[:nominatim][:state] == "master" # ~FC023
+ 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 0o700
+ end
+
+ template "/usr/local/bin/clean-db-nominatim" do
+ source "clean-db-nominatim.erb"