# Brightbox loadbalancer
# Generated config
# <%= Time.now.asctime %>

global
        log 127.0.0.1   local0
        log 127.0.0.1   local1 notice
        maxconn 16384
        user haproxy
        group haproxy

defaults
        log     global
        option  dontlognull
        retries 3
        option redispatch
        maxconn 8192
        contimeout      5000
        clitimeout      50000
        srvtimeout      50000
        
# Set up application listeners here.
<% listeners.each do |listener| %>
  listen <%= app_name(listener) %> 0.0.0.0:<%= listener['in'] %>

  balance <%= balance_method %>
  <% if listener['protocol'] == 'http' %>

    option httpchk
    option forwardfor
    mode http
    option httplog
  <% elsif listener['protocol'] == 'tcp' %>
    mode tcp
    option tcplog
  <% end %>
  <% nodes.each do | node | %>
    server <%= node['node'] %> <%= node['node'] %>:<%= listener['out'] %> check maxconn 200
  <% end %>

<% end %>

# Brightbox loadbalancer
# Generated config
# <%= Time.now.asctime %>

global
        log 127.0.0.1   local0
        log 127.0.0.1   local1 notice
        maxconn 16384
        user haproxy
        group haproxy

defaults
        log     global
        option  dontlognull
        retries 3
        option redispatch
        maxconn 8192
        contimeout      5000
        clitimeout      50000
        srvtimeout      50000
        
# Set up application listeners here.
<% listeners.each do |listener| %>
  listen <%= app_name(listener) %> 0.0.0.0:<%= listener['in'] %>

  balance <%= balance_method %>

  <% if listener['protocol'] == 'http' %>
    option forwardfor
    mode http
    option httplog
  <% elsif listener['protocol'] == 'tcp' %>
    mode tcp
    option tcplog
  <% end %>
  <% if healthcheck_type == 'http' %>
    option httpchk
  <% end %>
  <% if healthcheck %>
    default-server inter <%= healthcheck_interval %> rise <%= healthcheck_threshold_up %> fall <%= healthcheck_threshold_down %> <% if healthcheck_port %>port <%= healthcheck_port %><% end %>

  <% end %>
  <% nodes.each do | node | %>
    server <%= node['node'] %> <%= node['node'] %>:<%= listener['out'] %> <%= 'check' if healthcheck %>

  <% end %>

<% end %>

Add healthcheck configuration to ERB template
Add healthcheck configuration to ERB template
