X-Git-Url: https://git.openstreetmap.org./chef.git/blobdiff_plain/3d9c577508cc7d813473e5daa9f236cdd4a676fb..9340a696f8e648e784b30f84a0a00ddd5987b7f3:/cookbooks/vectortile/recipes/default.rb?ds=sidebyside diff --git a/cookbooks/vectortile/recipes/default.rb b/cookbooks/vectortile/recipes/default.rb index 37fe86b43..81f69ec5b 100644 --- a/cookbooks/vectortile/recipes/default.rb +++ b/cookbooks/vectortile/recipes/default.rb @@ -40,7 +40,7 @@ nginx_site "vector.openstreetmap.org" do end ssl_certificate node[:fqdn] do - domains [node[:fqdn], "vector.openstreetmap.org"] + domains [node[:fqdn]] notifies :reload, "service[nginx]" end @@ -86,6 +86,7 @@ shortbread_config = "#{style_directory}/shortbread.yaml" themepark_directory = "/srv/vector.openstreetmap.org/osm2pgsql-themepark" git themepark_directory do repository "https://github.com/osm2pgsql-dev/osm2pgsql-themepark.git" + revision "6df586489889dae1c5ffed33071067ef09771acf" user "tileupdate" group "tileupdate" end @@ -99,7 +100,7 @@ end python_package "tilekiln" do python_virtualenv tilekiln_directory python_version "3" - version "0.5.1" + version "0.6.5" end template "/srv/vector.openstreetmap.org/html/index.html" do @@ -189,6 +190,13 @@ end end end +postgresql_table "tile_stats" do + cluster node[:vectortile][:database][:cluster] + database "tiles" + schema "tilekiln" + owner "tilekiln" +end + (0..14).each do |zoom| postgresql_table "shortbread_v1_z#{zoom}" do cluster node[:vectortile][:database][:cluster] @@ -222,7 +230,7 @@ systemd_service "tilekiln" do wants "postgresql.service" sandbox :enable_network => true restrict_address_families "AF_UNIX" - exec_start "#{tilekiln_directory}/bin/tilekiln serve #{tilekiln_mode} --storage-dbname tiles --num-threads #{node[:vectortile][:serve][:threads]}" + exec_start "#{tilekiln_directory}/bin/tilekiln serve #{tilekiln_mode} --storage-dbname tiles --num-threads #{node[:vectortile][:serve][:threads]} --base-url 'https://vector.openstreetmap.org'" end service "tilekiln" do @@ -280,3 +288,36 @@ else action [:stop, :disable] end end + +package %w[ + ruby-pg + ruby-webrick +] + +prometheus_exporter "osm2pgsql" do + port 10027 + user "tileupdate" + restrict_address_families "AF_UNIX" + options [ + "--database-name=spirit" + ] +end + +systemd_service "tilekiln-prometheus" do + description "Tilekiln vector tile server" + user "tilekiln" + after "postgresql.service" + wants "postgresql.service" + sandbox :enable_network => true + restrict_address_families "AF_UNIX" + exec_start "#{tilekiln_directory}/bin/tilekiln prometheus --bind-host #{node[:prometheus][:address]} --storage-dbname tiles" +end + +service "tilekiln-prometheus" do + action [:enable, :start] +end + +node.default[:prometheus][:exporters][10013] = { + :name => "tilekiln", + :address => "#{node[:prometheus][:address]}:10013", +}