Sha256: 71b1ae9366fba072b4b563ed17de6763ff03f8acb0ce3bb7e86f4cf6ab135d72
Contents?: true
Size: 1011 Bytes
Versions: 29
Compression:
Stored size: 1011 Bytes
Contents
<% @path = "/etc/haproxy/haproxy.cfg" @additive = ["# start haproxy mongrel", "# end haproxy mongrel"] %> 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 } 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| %> <% ports.each do |port| %> server <%= server %>_<%= port %> <%= server %>:<%= port %> maxconn 1 check <% end %> <% end %>
Version data entries
29 entries across 29 versions & 5 rubygems