-node[:tile][:styles].each do |name,details|
- directory = "/srv/tile.openstreetmap.org/styles/#{name}"
+node[:tile][:styles].each do |name, details|
+ style_directory = "/srv/tile.openstreetmap.org/styles/#{name}"
+ tile_directory = "/srv/tile.openstreetmap.org/tiles/#{name}"
+
+ template "/usr/local/bin/update-lowzoom-#{name}" do
+ source "update-lowzoom.erb"
+ owner "root"
+ group "root"
+ mode 0755
+ variables :style => name
+ end
+
+ template "/etc/init.d/update-lowzoom-#{name}" do
+ source "update-lowzoom.init.erb"
+ owner "root"
+ group "root"
+ mode 0755
+ variables :style => name
+ end
+
+ service "update-lowzoom-#{name}" do
+ action :disable
+ supports :restart => true
+ end
+
+ directory tile_directory do
+ owner "tile"
+ group "tile"
+ mode 0755
+ end
+
+ details[:tile_directories].each do |directory|
+ directory directory[:name] do
+ owner "www-data"
+ group "www-data"
+ mode 0755
+ end
+
+ directory[:min_zoom].upto(directory[:max_zoom]) do |zoom|
+ directory "#{directory[:name]}/#{zoom}" do
+ owner "www-data"
+ group "www-data"
+ mode 0755
+ end
+
+ link "#{tile_directory}/#{zoom}" do
+ to "#{directory[:name]}/#{zoom}"
+ owner "tile"
+ group "tile"
+ end
+ end
+ end
+
+ file "#{tile_directory}/planet-import-complete" do
+ action :create_if_missing
+ owner "tile"
+ group "tile"
+ mode 0444
+ end