Skip to content

Commit

Permalink
tilecache: add tile_siblings to nginx
Browse files Browse the repository at this point in the history
  • Loading branch information
Firefishy committed Apr 5, 2020
1 parent 10016dc commit ae900e3
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions cookbooks/tilecache/templates/default/nginx_tile.conf.erb
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,19 @@ upstream tile_cache_backend {

# Add the other caches to relieve pressure if local squid failing
# Balancer: round-robin
<% server_weight = 10 -%>
<% @node[:tilecache][:tile_siblings].each do |cache_peer| -%>
<% @caches.each do |cache| -%>
<% if cache_peer == cache[:fqdn] -%>
<% if cache[:hostname] != node[:hostname] -%>
<% cache.ipaddresses(:family => :inet, :role => :external).sort.each do |address| -%>
server <%= address %>:80 backup; # Server <%= cache[:hostname] %>
server <%= address %>:80 weight=<%= server_weight.div(5) %>; # Server <%= cache[:hostname] %>
<% server_weight += 5 -%>
<% end -%>
<% end -%>
<% end -%>
<% end -%>
<% end -%>

keepalive 512;
keepalive_requests 1024;
}

# Geo Map of tile caches
Expand Down

0 comments on commit ae900e3

Please sign in to comment.