Avoids disruptions where the migration is needed for the frontend
to function properly (e.g. when creating new indexes).
-#!/bin/bash
+#!/bin/bash -e
# DO NOT EDIT - This file is being maintained by Chef
cd <%= @projectdir %>
-nominatim admin --migrate
-nominatim refresh --functions --address-levels --website
+# Run the migrations from the nominatim version in the build directory,
+# so they can execute while the frontend doesn't have the new code yet.
+<%= @builddir %>/nominatim admin --migrate
+<%= @builddir %>/nominatim refresh --functions --address-levels --website
<% if node[:nominatim][:enable_git_updates] -%>
if /sbin/runuser -u nominatim -- <%= @bindir %>/nominatim-update-source; then
- pushd <%= @builddir %>
- make install
-<% if node[:nominatim][:api_flavour] == "python" -%>
- systemctl reload nominatim
-<% end -%>
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
+
+<% if node[:nominatim][:api_flavour] == "python" -%>
+ systemctl reload nominatim
+<% end -%>
fi
<% end -%>