X-Git-Url: https://git.openstreetmap.org./chef.git/blobdiff_plain/cd61b458c9d289347eddfee79700289fc8b18080..3c0e9a8a3178545962f25797d00d0edf9d8cd1fe:/cookbooks/nominatim/templates/default/nominatim-update.erb?ds=sidebyside diff --git a/cookbooks/nominatim/templates/default/nominatim-update.erb b/cookbooks/nominatim/templates/default/nominatim-update.erb index 6bff200e1..e7f8a5f67 100644 --- a/cookbooks/nominatim/templates/default/nominatim-update.erb +++ b/cookbooks/nominatim/templates/default/nominatim-update.erb @@ -6,19 +6,37 @@ date "+%c === Starting Nominatim update cycle" 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 node.platform?("debian") -%> + EXTRA_PIP='--extra-index-url <%= node[:nominatim][:pip_index] %>' + + # First update the importer and run the migrations. + if <%= @venvprefix %>pip list $EXTRA_PIP --outdated | fgrep -q nominatim-db; then + <%= @venvprefix %>pip install $EXTRA_PIP -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 + # Then only attempt to update the frontend. + if <%= @venvprefix %>pip list $EXTRA_PIP --outdated | fgrep -q nominatim-api; then + <%= @venvprefix %>pip install $EXTRA_PIP -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 + 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 -fi + <% end -%> <% end -%> if ! /sbin/runuser -u nominatim -- <%= @bindir %>/nominatim-update-data; then