include_recipe "munin"
include_recipe "nodejs"
include_recipe "postgresql"
+include_recipe "prometheus"
include_recipe "python"
include_recipe "tools"
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]
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
exec_start "/usr/bin/renderd -f"
runtime_directory "renderd"
standard_error "null"
+ limit_nofile 4096
private_tmp true
private_devices true
private_network true
mode "755"
files_owner "tile"
files_group "tile"
- files_mode 0o644
+ files_mode "644"
end
template "/srv/tile.openstreetmap.org/html/index.html" do
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]
+ cwd "/srv/tile.openstreetmap.org"
+ user "tile"
+ group "tile"
+ end
+
+ Array(node[:tile][:database][:external_data_tables]).each do |table|
+ postgresql_table table do
+ cluster node[:tile][:database][:cluster]
+ database "gis"
+ owner "tile"
+ permissions "tile" => :all, "www-data" => :select
+ end
+ end
+end
+
postgresql_munin "gis" do
cluster node[:tile][:database][:cluster]
database "gis"
mode "755"
files_owner "root"
files_group "root"
- files_mode 0o755
+ files_mode "755"
end
template "/usr/local/bin/expire-tiles" do
munin_plugin "renderd_zoom_time"
munin_plugin "replication_delay"
+
+prometheus_exporter "modtile" do
+ port 9494
+end
+
+prometheus_exporter "renderd" do
+ port 9393
+end