]> git.openstreetmap.org Git - chef.git/commitdiff
Merge pull request #702 from lonvia/nominatim-to-debian
authorSarah Hoffmann <lonvia@denofr.de>
Mon, 28 Oct 2024 18:26:40 +0000 (19:26 +0100)
committerGitHub <noreply@github.com>
Mon, 28 Oct 2024 18:26:40 +0000 (19:26 +0100)
nominatim: reorganise recipe for Debian installation

Gemfile
Gemfile.lock
cookbooks/tile/recipes/default.rb
cookbooks/tile/templates/default/replicate.erb
roles/tile.rb

diff --git a/Gemfile b/Gemfile
index ec9eb03b0c0f47c6449890a17e1b0db94df0b0b8..baf310d5a8824a3d7cefbcb904015fec9a97399d 100644 (file)
--- a/Gemfile
+++ b/Gemfile
@@ -4,3 +4,6 @@ gem "cookstyle"
 gem "kitchen-dokken"
 gem "kitchen-inspec"
 gem "test-kitchen"
+
+# Lock some modules to old versions for ruby 3.1 support
+gem "zeitwerk", "< 2.7"
index d432aff365dc4128656cdf656c8878e14c6d4401..40032233db62298e139d1f43c5ee50f124d28c76 100644 (file)
@@ -755,7 +755,7 @@ GEM
     wisper (2.0.1)
     yajl-ruby (1.4.3)
     yaml-safe_load_stream3 (0.1.2)
-    zeitwerk (2.7.1)
+    zeitwerk (2.6.18)
 
 PLATFORMS
   ruby
@@ -765,6 +765,7 @@ DEPENDENCIES
   kitchen-dokken
   kitchen-inspec
   test-kitchen
+  zeitwerk (< 2.7)
 
 BUNDLED WITH
    2.2.16
index 2ebcbf041376ac00102ff9fc43b4bb7cd1884477..ddc7e490e4bf929cccfcd59fcc203cb2fc295b7a 100644 (file)
@@ -300,6 +300,72 @@ systemd_service "update-lowzoom@" do
   restart "on-failure"
 end
 
+postgresql_version = node[:tile][:database][:cluster].split("/").first
+postgis_version = node[:tile][:database][:postgis]
+
+package "postgresql-#{postgresql_version}-postgis-#{postgis_version}"
+
+postgresql_user "jburgess" do
+  cluster node[:tile][:database][:cluster]
+  superuser true
+end
+
+postgresql_user "tomh" do
+  cluster node[:tile][:database][:cluster]
+  superuser true
+end
+
+postgresql_user "pnorman" do
+  cluster node[:tile][:database][:cluster]
+  superuser true
+end
+
+postgresql_user "tile" do
+  cluster node[:tile][:database][:cluster]
+end
+
+postgresql_user "www-data" do
+  cluster node[:tile][:database][:cluster]
+end
+
+postgresql_user "_renderd" do
+  cluster node[:tile][:database][:cluster]
+end
+
+postgresql_database "gis" do
+  cluster node[:tile][:database][:cluster]
+  owner "tile"
+end
+
+postgresql_extension "postgis" do
+  cluster node[:tile][:database][:cluster]
+  database "gis"
+end
+
+postgresql_extension "hstore" do
+  cluster node[:tile][:database][:cluster]
+  database "gis"
+  only_if { node[:tile][:database][:hstore] }
+end
+
+%w[geography_columns planet_osm_nodes planet_osm_rels planet_osm_ways raster_columns raster_overviews].each do |table|
+  postgresql_table table do
+    cluster node[:tile][:database][:cluster]
+    database "gis"
+    owner "tile"
+    permissions "tile" => :all
+  end
+end
+
+%w[geometry_columns planet_osm_line planet_osm_point planet_osm_polygon planet_osm_roads spatial_ref_sys].each do |table|
+  postgresql_table table do
+    cluster node[:tile][:database][:cluster]
+    database "gis"
+    owner "tile"
+    permissions "tile" => :all, "www-data" => :select, "_renderd" => :select
+  end
+end
+
 directory "/srv/tile.openstreetmap.org/styles" do
   owner "tile"
   group "tile"
@@ -383,6 +449,18 @@ node[:tile][:styles].each do |name, details|
     end
   end
 
+  if details[:functions_script]
+    postgresql_execute details[:functions_script] do
+      action :nothing
+      command details[:functions_script]
+      cluster node[:tile][:database][:cluster]
+      database "gis"
+      user "tile"
+      group "tile"
+      subscribes :run, "git[#{style_directory}]"
+    end
+  end
+
   execute "#{style_directory}/project.mml" do
     action :nothing
     command "carto -a 3.0.22 project.mml > project.xml"
@@ -395,72 +473,6 @@ node[:tile][:styles].each do |name, details|
   end
 end
 
-postgresql_version = node[:tile][:database][:cluster].split("/").first
-postgis_version = node[:tile][:database][:postgis]
-
-package "postgresql-#{postgresql_version}-postgis-#{postgis_version}"
-
-postgresql_user "jburgess" do
-  cluster node[:tile][:database][:cluster]
-  superuser true
-end
-
-postgresql_user "tomh" do
-  cluster node[:tile][:database][:cluster]
-  superuser true
-end
-
-postgresql_user "pnorman" do
-  cluster node[:tile][:database][:cluster]
-  superuser true
-end
-
-postgresql_user "tile" do
-  cluster node[:tile][:database][:cluster]
-end
-
-postgresql_user "www-data" do
-  cluster node[:tile][:database][:cluster]
-end
-
-postgresql_user "_renderd" do
-  cluster node[:tile][:database][:cluster]
-end
-
-postgresql_database "gis" do
-  cluster node[:tile][:database][:cluster]
-  owner "tile"
-end
-
-postgresql_extension "postgis" do
-  cluster node[:tile][:database][:cluster]
-  database "gis"
-end
-
-postgresql_extension "hstore" do
-  cluster node[:tile][:database][:cluster]
-  database "gis"
-  only_if { node[:tile][:database][:hstore] }
-end
-
-%w[geography_columns planet_osm_nodes planet_osm_rels planet_osm_ways raster_columns raster_overviews].each do |table|
-  postgresql_table table do
-    cluster node[:tile][:database][:cluster]
-    database "gis"
-    owner "tile"
-    permissions "tile" => :all
-  end
-end
-
-%w[geometry_columns planet_osm_line planet_osm_point planet_osm_polygon planet_osm_roads spatial_ref_sys].each do |table|
-  postgresql_table table do
-    cluster node[:tile][:database][:cluster]
-    database "gis"
-    owner "tile"
-    permissions "tile" => :all, "www-data" => :select, "_renderd" => :select
-  end
-end
-
 package %w[
   gdal-bin
   python3-yaml
index 8d8e287925dac83e13106fd4080bf96ccdd62477..531adca83b2acf0d687ba0e55e38e54b34a15325 100644 (file)
@@ -11,7 +11,6 @@ do
     --number-processes=1 \
     --log-progress=false \
     --expire-tiles=10-16 \
-    --expire-segment-length=90000 \
     --expire-output=/var/lib/replicate/dirty-tiles.txt \
 <% if node[:tile][:database][:multi_geometry] -%>
     --multi-geometry \
index 97bd895f8d55f49ed75dcbb024a55a88ff3d8f8b..20bded97ff13fd0d2fcf2f6161408dc91950244d 100644 (file)
@@ -98,8 +98,9 @@ default_attributes(
     :styles => {
       :default => {
         :repository => "https://github.com/gravitystorm/openstreetmap-carto.git",
-        :revision => "v5.8.0",
+        :revision => "v5.9.0",
         :fonts_script => "/srv/tile.openstreetmap.org/styles/default/scripts/get-fonts.sh",
+        :functions_script => "/srv/tile.openstreetmap.org/styles/default/functions.sql",
         :max_zoom => 19
       }
     }