From b6922931b87429d2c524e9e09146662a4c0c03b4 Mon Sep 17 00:00:00 2001 From: Tim Clark Date: Tue, 11 Apr 2017 08:15:14 +0100 Subject: [PATCH 1/3] added http_check option --- README.md | 1 + templates/etc/haproxy/backend.cfg.j2 | 3 +++ 2 files changed, 4 insertions(+) diff --git a/README.md b/README.md index eb5cb469..3f28876a 100644 --- a/README.md +++ b/README.md @@ -159,6 +159,7 @@ Set up (the latest version of) [HAProxy](http://www.haproxy.org/) in Ubuntu syst * `haproxy_backend.{n}.mode`: [required]: Set the running mode or protocol of the section (e.g. `http`) * `haproxy_backend.{n}.balance`: [required]: The load balancing algorithm to be used (e.g. `roundrobin`) * `haproxy_backend.{n}.option`: [optional]: Options to set (e.g. `[forwardfor]`) +* `haproxy_backend.{n}.httpcheck`: [optional]: Options to set (e.g. `[httpcheck]`) * `haproxy_backend.{n}.no_option`: [optional]: Options to unset (e.g. `[forceclose]`) * `haproxy_backend.{n}.tcp_check`: [optional]: Perform health checks using tcp-check send/expect sequences (e.g. `['expect string +OK\ POP3\ ready']`) * `haproxy_backend.{n}.timeout`: [optional]: Timeout declarations diff --git a/templates/etc/haproxy/backend.cfg.j2 b/templates/etc/haproxy/backend.cfg.j2 index 8db24dc9..e5a28d5f 100644 --- a/templates/etc/haproxy/backend.cfg.j2 +++ b/templates/etc/haproxy/backend.cfg.j2 @@ -16,6 +16,9 @@ backend {{ backend.name }} option {{ option }} {% endfor %} +{% if backend.http_check is defined %} + http-check {{ backend.http_check }} +{% endif %} {% for option in backend.no_option | default([]) %} no option {{ option }} {% endfor %} From bf1f09b0ae26d1ca6f8351c314f7cfe2565fa521 Mon Sep 17 00:00:00 2001 From: Tim Clark Date: Tue, 11 Apr 2017 08:16:53 +0100 Subject: [PATCH 2/3] added http_check option --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 3f28876a..11b1325c 100644 --- a/README.md +++ b/README.md @@ -159,7 +159,7 @@ Set up (the latest version of) [HAProxy](http://www.haproxy.org/) in Ubuntu syst * `haproxy_backend.{n}.mode`: [required]: Set the running mode or protocol of the section (e.g. `http`) * `haproxy_backend.{n}.balance`: [required]: The load balancing algorithm to be used (e.g. `roundrobin`) * `haproxy_backend.{n}.option`: [optional]: Options to set (e.g. `[forwardfor]`) -* `haproxy_backend.{n}.httpcheck`: [optional]: Options to set (e.g. `[httpcheck]`) +* `haproxy_backend.{n}.http_check`: [optional]: Options to set (e.g. `[httpcheck]`) * `haproxy_backend.{n}.no_option`: [optional]: Options to unset (e.g. `[forceclose]`) * `haproxy_backend.{n}.tcp_check`: [optional]: Perform health checks using tcp-check send/expect sequences (e.g. `['expect string +OK\ POP3\ ready']`) * `haproxy_backend.{n}.timeout`: [optional]: Timeout declarations From 3fc1ba3357349bf3a3627b787ba2989840e38e61 Mon Sep 17 00:00:00 2001 From: Tim Clark Date: Thu, 13 Apr 2017 11:23:39 +0100 Subject: [PATCH 3/3] added http_check to listen and improved docs --- README.md | 3 ++- templates/etc/haproxy/listen.cfg.j2 | 4 ++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 11b1325c..550c3b08 100644 --- a/README.md +++ b/README.md @@ -72,6 +72,7 @@ Set up (the latest version of) [HAProxy](http://www.haproxy.org/) in Ubuntu syst * `haproxy_listen.{n}.option`: [optional]: Options to set (e.g. `[dontlog-normal]`) * `haproxy_listen.{n}.no_option`: [optional]: Options to set (e.g. `[dontlog-normal]`) * `haproxy_listen.{n}.tcp_check`: [optional]: Perform health checks using tcp-check send/expect sequences (e.g. `['expect string +OK\ POP3\ ready']`) +* `haproxy_listen.{n}.http_check`: [optional]: Make HTTP health checks consider response contents or specific status codes (e.g. `expect status 403`) * `haproxy_listen.{n}.timeout`: [optional]: Timeout declarations * `haproxy_listen.{n}.timeout.type`: [required]: The type (e.g. `connect`, `client`, `server`) * `haproxy_listen.{n}.timeout.timeout`: [required]: The timeout (in in milliseconds by default, but can be in any other unit if the number is suffixed by the unit) (e.g. `5000`, `50000`) @@ -159,7 +160,7 @@ Set up (the latest version of) [HAProxy](http://www.haproxy.org/) in Ubuntu syst * `haproxy_backend.{n}.mode`: [required]: Set the running mode or protocol of the section (e.g. `http`) * `haproxy_backend.{n}.balance`: [required]: The load balancing algorithm to be used (e.g. `roundrobin`) * `haproxy_backend.{n}.option`: [optional]: Options to set (e.g. `[forwardfor]`) -* `haproxy_backend.{n}.http_check`: [optional]: Options to set (e.g. `[httpcheck]`) +* `haproxy_backend.{n}.http_check`: [optional]: Make HTTP health checks consider response contents or specific status codes (e.g. `expect status 403`) * `haproxy_backend.{n}.no_option`: [optional]: Options to unset (e.g. `[forceclose]`) * `haproxy_backend.{n}.tcp_check`: [optional]: Perform health checks using tcp-check send/expect sequences (e.g. `['expect string +OK\ POP3\ ready']`) * `haproxy_backend.{n}.timeout`: [optional]: Timeout declarations diff --git a/templates/etc/haproxy/listen.cfg.j2 b/templates/etc/haproxy/listen.cfg.j2 index c13a7278..d85febb6 100644 --- a/templates/etc/haproxy/listen.cfg.j2 +++ b/templates/etc/haproxy/listen.cfg.j2 @@ -23,6 +23,10 @@ listen {{ listen.name }} maxconn {{ listen.maxconn }} {% endif %} +{% if listen.http_check is defined %} + http-check {{ listen.http_check }} +{% endif %} + {% for option in listen.option | default([]) %} option {{ option }} {% endfor %}