+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 _renderd"
+ cwd "/srv/tile.openstreetmap.org"
+ user "tile"
+ group "tile"
+ ignore_failure true
+ 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, "_renderd" => :select
+ end
+ end
+end
+
+directory File.dirname(node[:tile][:database][:node_file]) do
+ owner "root"
+ group "root"
+ mode "755"
+ recursive true