summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZuul <zuul@review.openstack.org>2019-03-19 03:03:52 +0000
committerGerrit Code Review <review@openstack.org>2019-03-19 03:03:52 +0000
commitca518798762d1c558ae13a19aeabc8f69035951c (patch)
tree0917dd8081ba33b154d1f41d5a40ff58c50d0651
parent87925b67baf58077e00bea1d5e75dfe64a27f88c (diff)
parente911f3f2d269073cd436045b3803c8f5007770f0 (diff)
Merge "Variable to set HTTP keepalive mode"
-rw-r--r--defaults/main.yml4
-rw-r--r--templates/haproxy.cfg.j21
-rw-r--r--templates/service.j24
3 files changed, 8 insertions, 1 deletions
diff --git a/defaults/main.yml b/defaults/main.yml
index 7e69824..64688ae 100644
--- a/defaults/main.yml
+++ b/defaults/main.yml
@@ -104,6 +104,10 @@ haproxy_connect_timeout: "10s"
104haproxy_http_request_timeout: "5s" 104haproxy_http_request_timeout: "5s"
105# Set the maximum inactivity time on the server side 105# Set the maximum inactivity time on the server side
106haproxy_server_timeout: "50s" 106haproxy_server_timeout: "50s"
107# Set the HTTP keepalive mode to use
108# Disable persistent connections by default because they can cause issues when the server side closes the connection
109# at the same time a request is sent.
110haproxy_keepalive_mode: 'forceclose'
107 111
108 112
109## haproxy tuning params 113## haproxy tuning params
diff --git a/templates/haproxy.cfg.j2 b/templates/haproxy.cfg.j2
index 5119d04..49f9bd0 100644
--- a/templates/haproxy.cfg.j2
+++ b/templates/haproxy.cfg.j2
@@ -28,6 +28,7 @@ defaults
28 log global 28 log global
29 option dontlognull 29 option dontlognull
30 option redispatch 30 option redispatch
31 option {{ haproxy_keepalive_mode }}
31 retries {{ haproxy_retries }} 32 retries {{ haproxy_retries }}
32 timeout client {{ haproxy_client_timeout }} 33 timeout client {{ haproxy_client_timeout }}
33 timeout connect {{ haproxy_connect_timeout }} 34 timeout connect {{ haproxy_connect_timeout }}
diff --git a/templates/service.j2 b/templates/service.j2
index 3524adc..fbb9283 100644
--- a/templates/service.j2
+++ b/templates/service.j2
@@ -44,7 +44,9 @@ frontend {{ item.service.haproxy_service_name }}-front-{{ loop.index }}
44{% if request_option == "http" %} 44{% if request_option == "http" %}
45 option httplog 45 option httplog
46 option forwardfor except 127.0.0.0/8 46 option forwardfor except 127.0.0.0/8
47 option http-server-close 47{% if item.service.haproxy_http_keepalive_mode is defined %}
48 option {{ item.service.haproxy_http_keepalive_mode }}
49{% endif %}
48{% elif request_option == "tcp" %} 50{% elif request_option == "tcp" %}
49 option tcplog 51 option tcplog
50{% endif %} 52{% endif %}