Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vectortile: Run tilekiln prometheus endpoint #715

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 27 additions & 1 deletion cookbooks/vectortile/recipes/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@
python_package "tilekiln" do
python_virtualenv tilekiln_directory
python_version "3"
version "0.6.3"
version "0.6.5"
end

template "/srv/vector.openstreetmap.org/html/index.html" do
Expand Down Expand Up @@ -189,6 +189,13 @@
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]
Expand Down Expand Up @@ -294,3 +301,22 @@
"--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",
}
8 changes: 8 additions & 0 deletions test/integration/vectortile/inspec/prometheus_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
describe service("tilekiln-prometheus") do
it { should be_enabled }
it { should be_running }
end

describe port(10013) do
it { should be_listening }
end
8 changes: 2 additions & 6 deletions test/integration/vectortile/inspec/tilekiln_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,10 @@
its("status") { should cmp 200 }
end

describe json(:content => http("https://localhost/shortbread_v1/tilejson.json", :ssl_verify => false)) do
describe json(:content => http("https://localhost/shortbread_v1/tilejson.json", :ssl_verify => false).body) do
its(["tiles"]) { should eq(["https://vector.openstreetmap.org/shortbread_v1/{z}/{x}/{y}.mvt"]) }
end

# There are no tiles so everything should return a 404
describe http("https://localhost/shortbread_v1/0/0/0.mvt", :ssl_verify => false) do
its("status") { should cmp 404 }
end
describe http("https://localhost/shortbread_v1/16/0/0.mvt", :ssl_verify => false) do
its("status") { should cmp 404 }
its("status") { should cmp 410 }
end
Loading