include_recipe "squid"
tilecaches = search(:node, "roles:tilecache").sort_by { |n| n[:hostname] }
+tilerenders = search(:node, "roles:tile").sort_by { |n| n[:hostname] }
tilecaches.each do |cache|
cache.ipaddresses(:family => :inet, :role => :external).sort.each do |address|
squid_fragment "tilecache" do
template "squid.conf.erb"
- variables :caches => tilecaches
+ variables :caches => tilecaches, :renders => tilerenders
end
template "/etc/logrotate.d/squid" do
cache_peer nadder-01.openstreetmap.org sibling 3128 3130 proxy-only
cache_peer nadder-02.openstreetmap.org sibling 3128 3130 proxy-only
<% end -%>
+#Primary Parent
cache_peer <%= node[:tilecache][:tile_parent] %> parent 80 0 no-query originserver name=osmtileAccel login=PASS connect-timeout=60 no-digest weight=1000
-cache_peer render.openstreetmap.org parent 80 0 no-query originserver name=osmtileAccelBackup login=PASS connect-timeout=60 no-digest weight=10
-
cache_peer_access osmtileAccel allow osmtile_sites
-cache_peer_access osmtileAccelBackup allow osmtile_sites
-cache_peer_access osmtileAccel deny all
-cache_peer_access osmtileAccelBackup deny all
+
+#Backup Parents
+<% @renders.each do |renders| -%>
+cache_peer <%= renders[:hostname] %>.render.openstreetmap.org parent 80 0 no-query originserver name=osmtileAccelBackup<%= renders[:hostname] %> login=PASS connect-timeout=60 no-digest weight=10
+cache_peer_access osmtileAccelBackup<%= renders[:hostname] %> allow osmtile_sites
+<% end -%>
#----------------------------------
#Create an unlimited pool for cache IP addresses