From 09427e939f8dae89b524ebc2c8037c74fa22969c Mon Sep 17 00:00:00 2001 From: Grant Slater Date: Wed, 18 Dec 2013 12:59:11 +0000 Subject: [PATCH] Tilecache: breakout render parents to avoid squid roundrobin DNS issue --- cookbooks/tilecache/recipes/default.rb | 3 ++- cookbooks/tilecache/templates/default/squid.conf.erb | 12 +++++++----- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/cookbooks/tilecache/recipes/default.rb b/cookbooks/tilecache/recipes/default.rb index 19a475cd3..53b5abb42 100644 --- a/cookbooks/tilecache/recipes/default.rb +++ b/cookbooks/tilecache/recipes/default.rb @@ -23,6 +23,7 @@ include_recipe "ssl" 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| @@ -49,7 +50,7 @@ end squid_fragment "tilecache" do template "squid.conf.erb" - variables :caches => tilecaches + variables :caches => tilecaches, :renders => tilerenders end template "/etc/logrotate.d/squid" do diff --git a/cookbooks/tilecache/templates/default/squid.conf.erb b/cookbooks/tilecache/templates/default/squid.conf.erb index 5ddd3d4ca..5a59e59c7 100644 --- a/cookbooks/tilecache/templates/default/squid.conf.erb +++ b/cookbooks/tilecache/templates/default/squid.conf.erb @@ -45,13 +45,15 @@ cache_peer trogdor.openstreetmap.org sibling 3128 3130 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 -- 2.39.5