From b42a65b6a027b6b22c60080f1c112a93dc042ce3 Mon Sep 17 00:00:00 2001 From: Sarah Hoffmann Date: Tue, 12 Mar 2024 12:02:09 +0100 Subject: [PATCH] nominatim: migrate versions before installing the software Avoids disruptions where the migration is needed for the frontend to function properly (e.g. when creating new indexes). --- .../default/nominatim-update-refresh-db.erb | 8 +++++--- .../nominatim/templates/default/nominatim-update.erb | 12 +++++++----- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/cookbooks/nominatim/templates/default/nominatim-update-refresh-db.erb b/cookbooks/nominatim/templates/default/nominatim-update-refresh-db.erb index f3de24347..6d7b41596 100644 --- a/cookbooks/nominatim/templates/default/nominatim-update-refresh-db.erb +++ b/cookbooks/nominatim/templates/default/nominatim-update-refresh-db.erb @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/bash -e # DO NOT EDIT - This file is being maintained by Chef @@ -6,5 +6,7 @@ date "+%c === Refresh database after software updates" 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 diff --git a/cookbooks/nominatim/templates/default/nominatim-update.erb b/cookbooks/nominatim/templates/default/nominatim-update.erb index 6bff200e1..145ae6a8c 100644 --- a/cookbooks/nominatim/templates/default/nominatim-update.erb +++ b/cookbooks/nominatim/templates/default/nominatim-update.erb @@ -8,16 +8,18 @@ starttime=`date +%s` <% 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 -%> -- 2.39.5