]> git.openstreetmap.org Git - chef.git/commitdiff
nominatim: add qa tile generation
authorSarah Hoffmann <lonvia@denofr.de>
Tue, 31 Aug 2021 08:49:43 +0000 (10:49 +0200)
committerSarah Hoffmann <lonvia@denofr.de>
Tue, 31 Aug 2021 08:50:34 +0000 (10:50 +0200)
cookbooks/nominatim/attributes/default.rb
cookbooks/nominatim/recipes/default.rb
cookbooks/nominatim/templates/default/qa_config.erb [new file with mode: 0644]
roles/stormfly-04.rb

index 55a2d836dcb8637d13a4212f38d9680b37970c57..32699dc6d8daa66d4fde453607e7b28deafeeff4 100644 (file)
@@ -9,8 +9,11 @@ default[:nominatim][:repository] = "https://git.openstreetmap.org/public/nominat
 default[:nominatim][:revision] = "master"
 default[:nominatim][:enable_backup] = false
 default[:nominatim][:enable_git_updates] = true
+default[:nominatim][:enable_qa_tiles] = false
 default[:nominatim][:ui_repository] = "https://git.openstreetmap.org/public/nominatim-ui.git"
 default[:nominatim][:ui_revision] = "master"
+default[:nominatim][:qa_repository] = "https://github.com/osm-search/Nominatim-Data-Analyser"
+default[:nominatim][:qa_revision] = "main"
 
 default[:nominatim][:fpm_pools] = {
   "nominatim.openstreetmap.org" => {
index dd6b249b4867871b6813273c01daadab186aa2ab..b5c7c4ce1a7f6d4a7ad19c429f630f8309526a24 100644 (file)
@@ -180,6 +180,8 @@ package %w[
 source_directory = "#{basedir}/nominatim"
 build_directory = "#{basedir}/bin"
 ui_directory = "#{basedir}/ui"
+qa_bin_directory = "#{basedir}/Nominatim-Data-Analyser"
+qa_data_directory = "#{basedir}/qa-data"
 
 directory build_directory do
   owner "nominatim"
@@ -473,3 +475,40 @@ fail2ban_jail "nominatim_limit_req" do
   maxretry 20
   ignoreips frontend_addresses.flatten.sort
 end
+
+### QA tile generation
+
+if node[:nominatim][:enable_qa_tiles]
+  git qa_bin_directory do
+    repository node[:nominatim][:qa_repository]
+    revision node[:nominatim][:qa_revision]
+    enable_submodules true
+    user "nominatim"
+    group "nominatim"
+    notifies :run, "execute[compile_qa]"
+  end
+
+  execute "compile_nominatim" do
+    action :nothing
+    user "nominatim"
+    cwd "#{qa_bin_directory}/clustering-vt"
+    command "make"
+  end
+
+  directory qa_data_directory do
+    owner "nominatim"
+    group "nominatim"
+    mode "755"
+    recursive true
+  end
+
+  template "#{qa_bin_directory}/analyser/config/config.yaml" do
+    source "qa_config.erb"
+    owner "nominatim"
+    group "nominatim"
+    mode "755"
+    variables :outputdir => "#{qa_data_directory}/new"
+  end
+
+
+end
diff --git a/cookbooks/nominatim/templates/default/qa_config.erb b/cookbooks/nominatim/templates/default/qa_config.erb
new file mode 100644 (file)
index 0000000..904ada8
--- /dev/null
@@ -0,0 +1,9 @@
+# DO NOT EDIT - This file is being maintained by Chef
+#Data source name for the database connection.
+Dsn: 'dbname=<%= node[:nominatim][:dbname] %>'
+
+#Path to the folder where rules data are stored (geojson, vector tiles, etc).
+RulesFolderPath: '<%= @outputdir %>'
+
+#Prefix path of the web URL to access the rules data (ex: https://nominatim.org/QA-data).
+WebPrefixPath: 'https://<%= node[:fqdn] %>/qa-data'
index af518eb9179163e9f271d450ac24fd567fb0a442..39a74947dcacf5c6a36dc057860ea1b2f056f729 100644 (file)
@@ -41,6 +41,7 @@ default_attributes(
     :state => "standalone",
     :enable_backup => false,
     :enable_git_updates => true,
+    :enable_qa_tiles => true,
     :dbadmins => %w[lonvia tomh],
     :dbcluster => "12/main",
     :postgis => "2.5",