Fixup for newer haproxy, actually use timeouts from configuration

This commit is contained in:
James Page 2016-02-18 13:52:53 +00:00
parent 129fbc73b1
commit 04473e1a30
2 changed files with 24 additions and 8 deletions

View File

@ -217,4 +217,3 @@ options:
description: | description: |
Connect timeout configuration in ms for haproxy, used in HA Connect timeout configuration in ms for haproxy, used in HA
configurations. If not provided, default value of 5000ms is used. configurations. If not provided, default value of 5000ms is used.

View File

@ -1,6 +1,6 @@
global global
log 127.0.0.1 local0 log {{ local_host }} local0
log 127.0.0.1 local1 notice log {{ local_host }} local1 notice
maxconn 20000 maxconn 20000
user haproxy user haproxy
group haproxy group haproxy
@ -12,23 +12,40 @@ defaults
option tcplog option tcplog
option dontlognull option dontlognull
retries 3 retries 3
timeout queue 1000 {%- if haproxy_queue_timeout %}
timeout connect 1000 timeout queue {{ haproxy_queue_timeout }}
{%- else %}
timeout queue 5000
{%- endif %}
{%- if haproxy_connect_timeout %}
timeout connect {{ haproxy_connect_timeout }}
{%- else %}
timeout connect 5000
{%- endif %}
{%- if haproxy_client_timeout %}
timeout client {{ haproxy_client_timeout }}
{%- else %}
timeout client 30000 timeout client 30000
{%- endif %}
{%- if haproxy_server_timeout %}
timeout server {{ haproxy_server_timeout }}
{%- else %}
timeout server 30000 timeout server 30000
{%- endif %}
listen stats :8888 listen stats
bind {{ local_host }}:{{ stat_port }}
mode http mode http
stats enable stats enable
stats hide-version stats hide-version
stats realm Haproxy\ Statistics stats realm Haproxy\ Statistics
stats uri / stats uri /
stats auth admin:password stats auth admin:{{ stat_password }}
{% if units %} {% if units %}
{% for service, ports in service_ports.iteritems() -%} {% for service, ports in service_ports.iteritems() -%}
listen {{ service }} listen {{ service }}
bind 0.0.0.0:{{ ports[0] }} bind *:{{ ports[0] }}
{% if prefer_ipv6 -%} {% if prefer_ipv6 -%}
bind :::{{ ports[0] }} bind :::{{ ports[0] }}
{%- endif %} {%- endif %}