net/haproxy: add hard-stop-after to ensure proper service restart/shutdown

This commit is contained in:
Frank Wall
2021-10-13 23:03:44 +02:00
parent fc773e6a1a
commit ca805ea20d
4 changed files with 18 additions and 1 deletions
+2
View File
@@ -10,12 +10,14 @@ Plugin Changelog
Added:
* add support for advanced resolver properties (#2330)
* add graceful stop timeout to service settings
Fixed:
* no haproxy.conf after restoring a config backup (#2474)
Changed:
* deploy haproxy.conf if it does not exist (#2474)
* add new timeout (60s) which will terminate open connections when using graceful stop
3.5
@@ -15,6 +15,12 @@
<type>checkbox</type>
<help><![CDATA[Enable HAProxy's graceful stop mode. In this mode HAProxy will continue to process existing connections until they close. Note that this may severely slow down HAProxy's shutdown, depending on the configured timeout values. If graceful stop mode is not enabled, HAProxy will use the hard stop mode where it immediately quits and all established connections are closed. Hard stop mode is recommended.]]></help>
</field>
<field>
<id>haproxy.general.hardStopAfter</id>
<label>Graceful stop timeout</label>
<type>text</type>
<help><![CDATA[Set the maximum time allowed to perform a clean graceful stop. HAProxy will terminate all open connections when the timeout is reached. This may be used to ensure that the instance will quit even if connections remain opened. Defaults to milliseconds. Optionally the unit may be specified as either "d", "h", "m", "s", "ms" or "us".]]></help>
</field>
<field>
<id>haproxy.general.seamlessReload</id>
<label>Seamless reload</label>
@@ -1,6 +1,6 @@
<model>
<mount>//OPNsense/HAProxy</mount>
<version>3.1.0</version>
<version>3.2.0</version>
<description>the HAProxy load balancer</description>
<items>
<general>
@@ -12,6 +12,12 @@
<default>0</default>
<Required>Y</Required>
</gracefulStop>
<hardStopAfter type="TextField">
<default>60s</default>
<mask>/^([0-9]{1,8}(?:us|ms|s|m|h|d)?)/u</mask>
<ValidationMessage>Should be a number between 1 and 8 characters, optionally followed by either "d", "h", "m", "s", "ms" or "us".</ValidationMessage>
<Required>N</Required>
</hardStopAfter>
<seamlessReload type="BooleanField">
<default>0</default>
<Required>Y</Required>
@@ -859,6 +859,9 @@ global
{% endif %}
{% endfor %}
{% endif %}
{% if OPNsense.HAProxy.general.hardStopAfter|default('') != '' %}
hard-stop-after {{OPNsense.HAProxy.general.hardStopAfter}}
{% endif %}
{% if helpers.exists('OPNsense.HAProxy.general.tuning.maxConnections') %}
maxconn {{OPNsense.HAProxy.general.tuning.maxConnections}}
{% endif %}