]> git.openstreetmap.org Git - chef.git/blobdiff - cookbooks/vectortile/recipes/default.rb
vectortile: Run tilekiln prometheus endpoint
[chef.git] / cookbooks / vectortile / recipes / default.rb
index 7abc2c5cc92660d101fdc9cf603520f0ea73af8c..1015b38e2b9bd97fe753efb30434dde871352f16 100644 (file)
@@ -99,7 +99,7 @@ end
 python_package "tilekiln" do
   python_virtualenv tilekiln_directory
   python_version "3"
-  version "0.6.1"
+  version "0.6.5"
 end
 
 template "/srv/vector.openstreetmap.org/html/index.html" do
@@ -189,6 +189,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]
@@ -280,3 +287,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",
+}