X-Git-Url: https://git.openstreetmap.org/chef.git/blobdiff_plain/aeaa46f3071de018b5c5e0f5678cb5b4082e3ddc..d2a0a1163cec42e48cc5585f8dd2a8318997a485:/cookbooks/tile/recipes/default.rb diff --git a/cookbooks/tile/recipes/default.rb b/cookbooks/tile/recipes/default.rb index 5a7a33af8..0f8cd9303 100644 --- a/cookbooks/tile/recipes/default.rb +++ b/cookbooks/tile/recipes/default.rb @@ -23,6 +23,7 @@ include_recipe "git" include_recipe "munin" include_recipe "nodejs" include_recipe "postgresql" +include_recipe "prometheus" include_recipe "python" include_recipe "tools" @@ -45,7 +46,14 @@ ssl_certificate node[:fqdn] do notifies :reload, "service[apache2]" end +remote_file "#{Chef::Config[:file_cache_path]}/fastly-ip-list.json" do + source "https://api.fastly.com/public-ip-list" + compile_time true + ignore_failure true +end + tilecaches = search(:node, "roles:tilecache").sort_by { |n| n[:hostname] } +fastlyips = JSON.parse(IO.read("#{Chef::Config[:file_cache_path]}/fastly-ip-list.json")) apache_site "default" do action [:disable] @@ -53,7 +61,7 @@ end apache_site "tile.openstreetmap.org" do template "apache.erb" - variables :caches => tilecaches + variables :caches => tilecaches, :fastly => fastlyips["addresses"] end template "/etc/logrotate.d/apache2" do @@ -79,6 +87,7 @@ systemd_service "renderd" do exec_start "/usr/bin/renderd -f" runtime_directory "renderd" standard_error "null" + limit_nofile 4096 private_tmp true private_devices true private_network true @@ -115,7 +124,7 @@ remote_directory "/srv/tile.openstreetmap.org/html" do mode "755" files_owner "tile" files_group "tile" - files_mode 0o644 + files_mode "644" end template "/srv/tile.openstreetmap.org/html/index.html" do @@ -265,8 +274,10 @@ nodejs_package "carto" systemd_service "update-lowzoom@" do description "Low zoom tile update service for %i layer" + conflicts "render-lowzoom.service" user "tile" exec_start "/bin/bash /usr/local/bin/update-lowzoom-%i" + runtime_directory "update-lowzoom-%i" private_tmp true private_devices true private_network true @@ -417,6 +428,21 @@ end end end +package %w[ + gdal-bin + python3-yaml + python3-psycopg2 +] + +if node[:tile][:database][:external_data_script] + execute node[:tile][:database][:external_data_script] do + command "#{node[:tile][:database][:external_data_script]} -R www-data" + cwd "/srv/tile.openstreetmap.org" + user "tile" + group "tile" + end +end + postgresql_munin "gis" do cluster node[:tile][:database][:cluster] database "gis" @@ -456,7 +482,7 @@ remote_directory "/usr/local/bin" do mode "755" files_owner "root" files_group "root" - files_mode 0o755 + files_mode "755" end template "/usr/local/bin/expire-tiles" do @@ -545,6 +571,7 @@ end systemd_service "render-lowzoom" do description "Render low zoom tiles" + condition_path_exists_glob "!/run/update-lowzoom-*" user "tile" exec_start "/usr/local/bin/render-lowzoom" private_tmp true @@ -601,3 +628,11 @@ munin_plugin "renderd_zoom" munin_plugin "renderd_zoom_time" munin_plugin "replication_delay" + +prometheus_exporter "modtile" do + port 9494 +end + +prometheus_exporter "renderd" do + port 9393 +end