mirror of
https://github.com/opnsense/plugins.git
synced 2026-05-28 04:34:15 -04:00
net/haproxy: finish version 1.17 via merge from master
This commit is contained in:
parent
fbcea7cf64
commit
5a0576d419
6 changed files with 38 additions and 5 deletions
3
net/haproxy/src/etc/rc.syshook.d/50-haproxy.stop
Executable file
3
net/haproxy/src/etc/rc.syshook.d/50-haproxy.stop
Executable file
|
|
@ -0,0 +1,3 @@
|
|||
#!/bin/sh
|
||||
|
||||
/usr/local/opnsense/scripts/OPNsense/HAProxy/rc-wrapper.sh stop
|
||||
|
|
@ -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>
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
<model>
|
||||
<mount>//OPNsense/HAProxy</mount>
|
||||
<version>1.0.0</version>
|
||||
<description>
|
||||
the HAProxy load balancer
|
||||
</description>
|
||||
|
|
@ -9,6 +10,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>
|
||||
|
|
|
|||
15
net/haproxy/src/opnsense/scripts/OPNsense/HAProxy/rc-wrapper.sh
Executable file
15
net/haproxy/src/opnsense/scripts/OPNsense/HAProxy/rc-wrapper.sh
Executable file
|
|
@ -0,0 +1,15 @@
|
|||
#!/bin/sh
|
||||
|
||||
if [ -f /etc/rc.conf.d/haproxy ]; then
|
||||
. /etc/rc.conf.d/haproxy
|
||||
fi
|
||||
|
||||
case "$1" in
|
||||
stop|restart)
|
||||
if [ "${haproxy_hardstop}" == "YES" ]; then
|
||||
rcprefix="hard"
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
/usr/local/etc/rc.d/haproxy ${rcprefix}${1}
|
||||
|
|
@ -5,25 +5,25 @@ type:script_output
|
|||
message:setup haproxy service requirements
|
||||
|
||||
[start]
|
||||
command:/usr/local/opnsense/scripts/OPNsense/HAProxy/setup.sh; /usr/local/etc/rc.d/haproxy start
|
||||
command:/usr/local/opnsense/scripts/OPNsense/HAProxy/setup.sh; /usr/local/opnsense/scripts/OPNsense/HAProxy/rc-wrapper.sh start
|
||||
parameters:
|
||||
type:script
|
||||
message:starting haproxy
|
||||
|
||||
[stop]
|
||||
command:/usr/local/etc/rc.d/haproxy stop; /usr/bin/killall haproxy; exit 0
|
||||
command:/usr/local/opnsense/scripts/OPNsense/HAProxy/rc-wrapper.sh 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/opnsense/scripts/OPNsense/HAProxy/rc-wrapper.sh restart
|
||||
parameters:
|
||||
type:script
|
||||
message:restarting haproxy
|
||||
|
||||
[reconfigure]
|
||||
command:/usr/local/opnsense/scripts/OPNsense/HAProxy/setup.sh; /usr/local/etc/rc.d/haproxy reload
|
||||
command:/usr/local/opnsense/scripts/OPNsense/HAProxy/setup.sh; /usr/local/opnsense/scripts/OPNsense/HAProxy/rc-wrapper.sh reload
|
||||
parameters:
|
||||
type:script
|
||||
message:reconfiguring 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