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

Version Path
rubber-1.1.1 generators/vulcanize/templates/complete_mongrel_mysql/config/rubber/role/haproxy/haproxy-mongrel.conf
rubber-1.1.0 generators/vulcanize/templates/complete_mongrel_mysql/config/rubber/role/haproxy/haproxy-mongrel.conf
axtro-rubber-1.0.2.6 generators/vulcanize/templates/complete_mongrel_mysql/config/rubber/role/haproxy/haproxy-mongrel.conf
axtro-rubber-1.0.2.5 generators/vulcanize/templates/complete_mongrel_mysql/config/rubber/role/haproxy/haproxy-mongrel.conf
axtro-rubber-1.0.2.4 generators/vulcanize/templates/complete_mongrel_mysql/config/rubber/role/haproxy/haproxy-mongrel.conf
axtro-rubber-1.0.2.3 generators/vulcanize/templates/complete_mongrel_mysql/config/rubber/role/haproxy/haproxy-mongrel.conf
axtro-rubber-1.0.2.2 generators/vulcanize/templates/complete_mongrel_mysql/config/rubber/role/haproxy/haproxy-mongrel.conf
axtro-rubber-1.0.2.1 generators/vulcanize/templates/complete_mongrel_mysql/config/rubber/role/haproxy/haproxy-mongrel.conf
rubber-1.0.2 generators/vulcanize/templates/complete_mongrel_mysql/config/rubber/role/haproxy/haproxy-mongrel.conf