]> git.openstreetmap.org Git - chef.git/blobdiff - cookbooks/nominatim/templates/default/nominatim-update.erb
nominatim: reorganise recipe for Debian installation
[chef.git] / cookbooks / nominatim / templates / default / nominatim-update.erb
index 9f122206ce2cbdbdfc6767894cdb734a5aebd08b..ed5decedf29659ab74143055b43e7c5d90474b32 100644 (file)
@@ -6,16 +6,35 @@ date "+%c === Starting Nominatim update cycle"
 
 starttime=`date +%s`
 
 
 starttime=`date +%s`
 
-<% if node[:nominatim][:enable_git_updates] -%>
-if /sbin/runuser -u nominatim -- <%= @bindir %>/nominatim-update-source; then
-  pushd <%= @builddir %>
-  make install
-
-  if ! /sbin/runuser -u nominatim -- <%= @bindir %>/nominatim-update-refresh-db; then
-    date "+%c === Database refresh failed. Stopping updates."
-    exit 1
+<% if node.platform?("debian") -%>
+  # First update the importer and run the migrations.
+  if <%= @venvprefix %>pip list --outdated | fgrep -q nominatim-db; then
+    <%= @venvprefix %>pip install -U nominatim-db
+    if ! /sbin/runuser -u nominatim -- <%= @bindir %>/nominatim-update-refresh-db; then
+      date "+%c === Database refresh failed. Stopping updates."
+      exit 1
+    fi
   fi
   fi
-fi
+  # Then only attempt to update the frontend.
+  if <%= @venvprefix %>pip list --outdated | fgrep -q nominatim-api; then
+    <%= @venvprefix %>pip install -U nominatim-api
+    systemctl reload nominatim
+  fi
+<% else -%>
+  <% if node[:nominatim][:enable_git_updates] -%>
+  if /sbin/runuser -u nominatim -- <%= @bindir %>/nominatim-update-source; then
+
+    if ! /sbin/runuser -u nominatim -- <%= @bindir %>/nominatim-update-refresh-db; then
+      date "+%c === Database refresh failed. Stopping updates."
+      exit 1
+    fi
+
+    pushd <%= @builddir %>
+    make install
+
+    systemctl reload nominatim
+  fi
+  <% end -%>
 <% end -%>
 
 if ! /sbin/runuser -u nominatim -- <%= @bindir %>/nominatim-update-data; then
 <% end -%>
 
 if ! /sbin/runuser -u nominatim -- <%= @bindir %>/nominatim-update-data; then