mirror of
https://github.com/opnsense/plugins.git
synced 2026-06-03 22:08:11 -04:00
net/haproxy: enable hard stop mode by default, fixes #195
This commit is contained in:
parent
cc6ca832b2
commit
472d5d601e
6 changed files with 31 additions and 3 deletions
7
net/haproxy/src/etc/rc.syshook.d/50-haproxy.restart
Executable file
7
net/haproxy/src/etc/rc.syshook.d/50-haproxy.restart
Executable file
|
|
@ -0,0 +1,7 @@
|
|||
#!/bin/sh
|
||||
|
||||
. /etc/rc.conf.d/haproxy
|
||||
|
||||
if [ "x${haproxy_hardstop}" == "xYES" ]; then
|
||||
/usr/local/etc/rc.d/haproxy configtest && /usr/local/etc/rc.d/haproxy hardstop
|
||||
fi
|
||||
7
net/haproxy/src/etc/rc.syshook.d/50-haproxy.stop
Executable file
7
net/haproxy/src/etc/rc.syshook.d/50-haproxy.stop
Executable file
|
|
@ -0,0 +1,7 @@
|
|||
#!/bin/sh
|
||||
|
||||
. /etc/rc.conf.d/haproxy
|
||||
|
||||
if [ "x${haproxy_hardstop}" == "xYES" ]; then
|
||||
/usr/local/etc/rc.d/haproxy hardstop
|
||||
fi
|
||||
|
|
@ -11,6 +11,12 @@
|
|||
<type>checkbox</type>
|
||||
<help>Enable or disable the HAProxy service.</help>
|
||||
</field>
|
||||
<field>
|
||||
<id>haproxy.general.gracefulStop</id>
|
||||
<label>Graceful Stop</label>
|
||||
<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>
|
||||
</subtab>
|
||||
<subtab id="haproxy-general-global" description="Global Parameters">
|
||||
<field>
|
||||
|
|
|
|||
|
|
@ -9,6 +9,10 @@
|
|||
<default>0</default>
|
||||
<Required>Y</Required>
|
||||
</enabled>
|
||||
<gracefulStop type="BooleanField">
|
||||
<default>0</default>
|
||||
<Required>Y</Required>
|
||||
</gracefulStop>
|
||||
<tuning>
|
||||
<root type="BooleanField">
|
||||
<default>0</default>
|
||||
|
|
|
|||
|
|
@ -11,13 +11,13 @@ type:script
|
|||
message:starting haproxy
|
||||
|
||||
[stop]
|
||||
command:/usr/local/etc/rc.d/haproxy stop; /usr/bin/killall haproxy; exit 0
|
||||
command:/usr/local/etc/rc.syshook.d/50-haproxy.stop; /usr/local/etc/rc.d/haproxy stop; /usr/bin/killall haproxy; exit 0
|
||||
parameters:
|
||||
type:script
|
||||
message:stopping haproxy
|
||||
|
||||
[restart]
|
||||
command:/usr/local/opnsense/scripts/OPNsense/HAProxy/setup.sh; /usr/local/etc/rc.d/haproxy restart
|
||||
command:/usr/local/opnsense/scripts/OPNsense/HAProxy/setup.sh; /usr/local/etc/rc.syshook.d/50-haproxy.restart; /usr/local/etc/rc.d/haproxy restart
|
||||
parameters:
|
||||
type:script
|
||||
message:restarting haproxy
|
||||
|
|
|
|||
|
|
@ -3,7 +3,11 @@ haproxy_enable=YES
|
|||
haproxy_opnsense_bootup_run="/usr/local/opnsense/scripts/OPNsense/HAProxy/setup.sh"
|
||||
haproxy_pidfile="/var/run/haproxy.pid"
|
||||
haproxy_config="/usr/local/etc/haproxy.conf"
|
||||
# haproxy_flags=""
|
||||
{% if helpers.exists('OPNsense.HAProxy.general.gracefulStop') and OPNsense.HAProxy.general.gracefulStop|default("0") == "1" %}
|
||||
haproxy_hardstop=NO
|
||||
{% else %}
|
||||
haproxy_hardstop=YES
|
||||
{% endif %}
|
||||
{% else %}
|
||||
haproxy_enable=NO
|
||||
{% endif %}
|
||||
|
|
|
|||
Loading…
Reference in a new issue