Skip to content

Commit

Permalink
Only proxy app roles since mongrel may be used by non-app roles.
Browse files Browse the repository at this point in the history
  • Loading branch information
nirvdrum committed Mar 17, 2010
1 parent 13a7f49 commit 3dd218d
Showing 1 changed file with 2 additions and 2 deletions.
Expand Up @@ -8,14 +8,14 @@ listen mongrel_proxy 0.0.0.0:<%= rubber_env.haproxy_listen_port %>
# Since we do "fair" load balancing to the mongrels, we don't want to share mongrels
# between haproxy instances otherwise we still end up with requests getting queued behind
# slow ones.
mongrel_hosts = rubber_instances.for_role('mongrel').collect { |i| i.name }
app_hosts = rubber_instances.for_role('app').collect { |i| i.name }
haproxy_hosts = rubber_instances.for_role('haproxy').collect { |i| i.name }
ports = (rubber_env.mongrel_base_port.to_i ... rubber_env.mongrel_base_port.to_i + rubber_env.mongrel_count.to_i).to_a
host_count = haproxy_hosts.size
host_mod = haproxy_hosts.sort.index(rubber_env.host) rescue 0
ports = ports.find_all {|x| x % host_count == host_mod}
%>
<% mongrel_hosts.each do |server| %>
<% app_hosts.each do |server| %>
<% ports.each do |port| %>
server <%= server %>_<%= port %> <%= server %>:<%= port %> maxconn 1 check
<% end %>
Expand Down

0 comments on commit 3dd218d

Please sign in to comment.