From: Sarah Hoffmann Date: Sat, 17 Sep 2016 12:57:08 +0000 (+0200) Subject: nominatim: replace node references in templates with variables X-Git-Url: https://git.openstreetmap.org./chef.git/commitdiff_plain/c7f6c009e30d0b0be3670d0772176b83b0661e2a?hp=1e2cab84800a723bc8f156345ea281b8d82088be nominatim: replace node references in templates with variables --- diff --git a/cookbooks/nominatim/recipes/base.rb b/cookbooks/nominatim/recipes/base.rb index 76813c346..97cf576c6 100644 --- a/cookbooks/nominatim/recipes/base.rb +++ b/cookbooks/nominatim/recipes/base.rb @@ -207,6 +207,8 @@ end munin_plugin_conf "nominatim" do template "munin.erb" + variables :db => node[:nominatim][:database][:dbname], + :querylog => "#{node[:nominatim][:logdir]}/query.log" end munin_plugin "nominatim_importlag" do @@ -249,6 +251,7 @@ additional_scripts.each do |fname| owner "root" group "root" mode 0o755 + variables :db => node[:nominatim][:database][:dbname] end end diff --git a/cookbooks/nominatim/templates/default/backup-nominatim.erb b/cookbooks/nominatim/templates/default/backup-nominatim.erb index 09711cc43..7cae01b27 100644 --- a/cookbooks/nominatim/templates/default/backup-nominatim.erb +++ b/cookbooks/nominatim/templates/default/backup-nominatim.erb @@ -12,7 +12,7 @@ D=`date +%Y-%m-%d` F=/tmp/nominatim-${D}.dmp -pg_dump --file=$F -F c -Z 9 -t file -t '*columns' -t 'import_polygon_*' -t import_status -t place_addressline -t placex -t search_name -t 'seq_*' -t word <%= node[:nominatim][:database][:dbname] %> +pg_dump --file=$F -F c -Z 9 -t file -t '*columns' -t 'import_polygon_*' -t import_status -t place_addressline -t placex -t search_name -t 'seq_*' -t word <%= @db %> export RSYNC_RSH="ssh -ax" rsync $F backup.openstreetmap.org::backup diff --git a/cookbooks/nominatim/templates/default/munin.erb b/cookbooks/nominatim/templates/default/munin.erb index aa6ac2af2..284314567 100644 --- a/cookbooks/nominatim/templates/default/munin.erb +++ b/cookbooks/nominatim/templates/default/munin.erb @@ -2,6 +2,6 @@ [nominatim_*] user www-data -env.PGDATABASE <%= node[:nominatim][:database][:dbname] %> +env.PGDATABASE <%= @db %> env.PGUSER www-data -env.NOMINATIM_QUERYLOG <%= node[:nominatim][:logdir] %>/query.log +env.NOMINATIM_QUERYLOG <%= @querylog %> diff --git a/cookbooks/nominatim/templates/default/vacuum-db-nominatim.erb b/cookbooks/nominatim/templates/default/vacuum-db-nominatim.erb index 77b1257ef..dacdbf631 100644 --- a/cookbooks/nominatim/templates/default/vacuum-db-nominatim.erb +++ b/cookbooks/nominatim/templates/default/vacuum-db-nominatim.erb @@ -5,10 +5,10 @@ # Vaccum all tables with indices on integer arrays. # Agressive vacuuming seems to help against index bloat. -psql -q -d nominatim -c 'VACUUM ANALYSE search_name' -psql -q -d nominatim -c 'VACUUM ANALYSE search_name_country' +psql -q -d <%= @db %> -c 'VACUUM ANALYSE search_name' +psql -q -d <%= @db %> -c 'VACUUM ANALYSE search_name_country' for i in `seq 0 246`; do - psql -q -d nominatim -c "VACUUM ANALYSE search_name_${i}" + psql -q -d <%= @db %> -c "VACUUM ANALYSE search_name_${i}" done