]> git.openstreetmap.org Git - chef.git/commitdiff
Configure API limits explicitly for both rails and cgimap
authorTom Hughes <tom@compton.nu>
Wed, 16 Feb 2022 16:01:13 +0000 (16:01 +0000)
committerTom Hughes <tom@compton.nu>
Wed, 16 Feb 2022 21:18:40 +0000 (21:18 +0000)
cookbooks/web/attributes/default.rb
cookbooks/web/recipes/cgimap.rb
cookbooks/web/resources/rails_port.rb

index 7c995d9d818b65c54deb345986ce2a46cc8742a7..81e7d94dff028f9c22ed541969cc29d3a0d04819 100644 (file)
@@ -2,5 +2,9 @@ default[:web][:base_directory] = "/srv/www.openstreetmap.org"
 default[:web][:pid_directory] = "/run/web"
 default[:web][:log_directory] = "/var/log/web"
 default[:web][:primary_cluster] = false
+default[:web][:max_request_area] = 0.25
+default[:web][:max_number_of_nodes] = 50000
+default[:web][:max_number_of_way_nodes] = 2000
+default[:web][:max_number_of_relation_members] = 32000
 
 default[:accounts][:users][:rails][:status] = :role
index 4422b7cd1cc2896d0ed35bb7318540107b423410..2ebdcb6e1a46f77b1bf9319c680dcb5da9e1a0bc 100644 (file)
@@ -42,7 +42,11 @@ cgimap_options = {
   "CGIMAP_LOGFILE" => "#{node[:web][:log_directory]}/cgimap.log",
   "CGIMAP_MEMCACHE" => memcached_servers.join(","),
   "CGIMAP_RATELIMIT" => "204800",
-  "CGIMAP_MAXDEBT" => "250"
+  "CGIMAP_MAXDEBT" => "250",
+  "CGIMAP_MAP_AREA" => node[:web][:max_request_area],
+  "CGIMAP_MAP_NODES" => node[:web][:max_number_of_nodes],
+  "CGIMAP_MAX_WAY_NODES" => node[:web][:max_number_of_way_nodes],
+  "CGIMAP_MAX_RELATION_MEMBERS" => node[:web][:max_number_of_relation_members]
 }
 
 if %w[database_readonly api_readonly].include?(node[:web][:status])
index be979d6935891bef39bd20d597eff87fa7c234fa..c14c22842f150d045a4eccf037560bc1846a2615 100644 (file)
@@ -347,7 +347,11 @@ action :create do
     "support_email" => "support@openstreetmap.org",
     "email_return_path" => "bounces@openstreetmap.org",
     "geonames_username" => "openstreetmap",
-    "maxmind_database" => "/usr/share/GeoIP/GeoLite2-Country.mmdb"
+    "maxmind_database" => "/usr/share/GeoIP/GeoLite2-Country.mmdb",
+    "max_request_area" => node[:web][:max_request_area],
+    "max_number_of_nodes" => node[:web][:max_number_of_nodes],
+    "max_number_of_way_nodes" => node[:web][:max_number_of_way_nodes],
+    "max_number_of_relation_members" => node[:web][:max_number_of_relation_members]
   )
 
   if new_resource.memcache_servers