]> git.openstreetmap.org Git - chef.git/commitdiff
nominatim: enable updating of postcodes
authorSarah Hoffmann <lonvia@denofr.de>
Tue, 3 Oct 2017 12:48:36 +0000 (14:48 +0200)
committerSarah Hoffmann <lonvia@denofr.de>
Tue, 3 Oct 2017 12:50:17 +0000 (14:50 +0200)
cookbooks/nominatim/recipes/default.rb
cookbooks/nominatim/templates/default/nominatim.cron.erb
cookbooks/nominatim/templates/default/updater.erb

index ea5533515899805a879218eb16aa51f07675bea3..53529704c4d137be93541b1d4c50803231f75fb0 100644 (file)
@@ -252,7 +252,9 @@ template "/etc/cron.d/nominatim" do
   owner "root"
   group "root"
   mode "0644"
   owner "root"
   group "root"
   mode "0644"
-  variables :bin_directory => "#{source_directory}/utils", :mailto => email_errors
+  variables :bin_directory => "#{source_directory}/utils",
+            :mailto => email_errors,
+            :update_maintenance_trigger => "#{basedir}/status/update_maintenance"
 end
 
 template "#{source_directory}/utils/nominatim-update" do
 end
 
 template "#{source_directory}/utils/nominatim-update" do
@@ -264,7 +266,8 @@ template "#{source_directory}/utils/nominatim-update" do
             :srcdir => source_directory,
             :logfile => "#{node[:nominatim][:logdir]}/update.log",
             :branch => node[:nominatim][:revision],
             :srcdir => source_directory,
             :logfile => "#{node[:nominatim][:logdir]}/update.log",
             :branch => node[:nominatim][:revision],
-            :update_stop_file => "#{basedir}/status/updates_disabled"
+            :update_stop_file => "#{basedir}/status/updates_disabled",
+            :update_maintenance_trigger => "#{basedir}/status/update_maintenance"
 end
 
 template "/etc/init.d/nominatim-update" do
 end
 
 template "/etc/init.d/nominatim-update" do
index 3ad64d4d388f13f2cf86d17f59701f75eba28891..5ae8f3ad6fcc94a2824d38e151713b878de343d9 100644 (file)
@@ -6,7 +6,8 @@ MAILTO=<%= @mailto %>
 <% if node[:nominatim][:enable_backup] -%>
 00 3 1 * * nominatim /usr/local/bin/backup-nominatim
 <% end -%>
 <% if node[:nominatim][:enable_backup] -%>
 00 3 1 * * nominatim /usr/local/bin/backup-nominatim
 <% end -%>
-30 1 * * * postgres /usr/local/bin/vacuum-db-nominatim
+20 0 * * * postgres /usr/local/bin/vacuum-db-nominatim
 <% if node[:nominatim][:state] == "master" -%>
 05 */4 * * * postgres /usr/local/bin/clean-db-nominatim
 <% end -%>
 <% if node[:nominatim][:state] == "master" -%>
 05 */4 * * * postgres /usr/local/bin/clean-db-nominatim
 <% end -%>
+18 1 * * * nominatim touch <%= @update_maintenance_trigger %>
index d5ba2e0bec89e9653b881f3819c76c7017f3b9b4..ade5845aa6fda850f5d16801cef83c1afb012d3e 100644 (file)
@@ -34,4 +34,9 @@ do
     fi
     popd
 <% end -%>
     fi
     popd
 <% end -%>
+
+    if [ -f "<%= @update_maintenance_trigger %>" ]; then
+        rm <%= @update_maintenance_trigger %>
+        ./utils/update.php --calculate-postcodes
+    fi
 done
 done