From 47765e0e711a11ec4f793d8a151fb1b9f8a925ba Mon Sep 17 00:00:00 2001 From: Tom Hughes Date: Wed, 16 Feb 2022 16:01:13 +0000 Subject: [PATCH] Configure API limits explicitly for both rails and cgimap --- cookbooks/web/attributes/default.rb | 4 ++++ cookbooks/web/recipes/cgimap.rb | 6 +++++- cookbooks/web/resources/rails_port.rb | 6 +++++- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/cookbooks/web/attributes/default.rb b/cookbooks/web/attributes/default.rb index 7c995d9d8..81e7d94df 100644 --- a/cookbooks/web/attributes/default.rb +++ b/cookbooks/web/attributes/default.rb @@ -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 diff --git a/cookbooks/web/recipes/cgimap.rb b/cookbooks/web/recipes/cgimap.rb index 4422b7cd1..2ebdcb6e1 100644 --- a/cookbooks/web/recipes/cgimap.rb +++ b/cookbooks/web/recipes/cgimap.rb @@ -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]) diff --git a/cookbooks/web/resources/rails_port.rb b/cookbooks/web/resources/rails_port.rb index be979d693..c14c22842 100644 --- a/cookbooks/web/resources/rails_port.rb +++ b/cookbooks/web/resources/rails_port.rb @@ -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 -- 2.39.5