mirror of
https://github.com/opnsense/plugins.git
synced 2026-06-09 00:42:34 -04:00
net/haproxy: add max connections option to servers (#2641)
This commit is contained in:
parent
d3e3d46333
commit
51f6d0e8d2
6 changed files with 47 additions and 12 deletions
|
|
@ -10,6 +10,11 @@ Plugin Changelog
|
|||
|
||||
Added:
|
||||
* add support for unix sockets (#2040)
|
||||
* add "max connections" option to servers (#2641)
|
||||
|
||||
Changed:
|
||||
* allow setting "max connections" to "0" (unlimited)
|
||||
* raise maximum value for "max connections" to 10000000
|
||||
|
||||
3.7
|
||||
|
||||
|
|
|
|||
|
|
@ -242,7 +242,7 @@
|
|||
</field>
|
||||
<field>
|
||||
<id>frontend.tuning_maxConnections</id>
|
||||
<label>Max. Connections</label>
|
||||
<label>Maximum Connections</label>
|
||||
<type>text</type>
|
||||
<help><![CDATA[Set the maximum number of concurrent connections for this Public Service.]]></help>
|
||||
</field>
|
||||
|
|
|
|||
|
|
@ -138,6 +138,13 @@
|
|||
<hint>Type certificate name or choose from list.</hint>
|
||||
<advanced>true</advanced>
|
||||
</field>
|
||||
<field>
|
||||
<id>server.maxConnections</id>
|
||||
<label>Max Connections</label>
|
||||
<type>text</type>
|
||||
<help><![CDATA[Specifies the maximal number of concurrent connections that will be sent to this server. The default value is "0" which means unlimited.]]></help>
|
||||
<advanced>true</advanced>
|
||||
</field>
|
||||
<field>
|
||||
<id>server.weight</id>
|
||||
<label>Weight</label>
|
||||
|
|
|
|||
|
|
@ -5,9 +5,15 @@
|
|||
</field>
|
||||
<field>
|
||||
<id>haproxy.general.defaults.maxConnections</id>
|
||||
<label>Max. Connections</label>
|
||||
<label>Maximum Connections (Public Services)</label>
|
||||
<type>text</type>
|
||||
<help><![CDATA[Set the maximum number of concurrent connections for this frontend.]]></help>
|
||||
<help><![CDATA[Set the maximum number of concurrent connections for public services.]]></help>
|
||||
</field>
|
||||
<field>
|
||||
<id>haproxy.general.defaults.maxConnectionsServers</id>
|
||||
<label>Maximum Connections (Servers)</label>
|
||||
<type>text</type>
|
||||
<help><![CDATA[Set the maximum number of concurrent connections for servers.]]></help>
|
||||
</field>
|
||||
<field>
|
||||
<id>haproxy.general.defaults.timeoutClient</id>
|
||||
|
|
|
|||
|
|
@ -67,9 +67,9 @@
|
|||
<Required>Y</Required>
|
||||
</root>
|
||||
<maxConnections type="IntegerField">
|
||||
<MinimumValue>1</MinimumValue>
|
||||
<MaximumValue>500000</MaximumValue>
|
||||
<ValidationMessage>Please specify a value between 1 and 500000.</ValidationMessage>
|
||||
<MinimumValue>0</MinimumValue>
|
||||
<MaximumValue>10000000</MaximumValue>
|
||||
<ValidationMessage>Please specify a value between 0 and 10000000.</ValidationMessage>
|
||||
<Required>N</Required>
|
||||
</maxConnections>
|
||||
<nbproc type="IntegerField">
|
||||
|
|
@ -194,11 +194,17 @@
|
|||
</tuning>
|
||||
<defaults>
|
||||
<maxConnections type="IntegerField">
|
||||
<MinimumValue>1</MinimumValue>
|
||||
<MaximumValue>500000</MaximumValue>
|
||||
<ValidationMessage>Please specify a value between 1 and 500000.</ValidationMessage>
|
||||
<MinimumValue>0</MinimumValue>
|
||||
<MaximumValue>10000000</MaximumValue>
|
||||
<ValidationMessage>Please specify a value between 0 and 10000000.</ValidationMessage>
|
||||
<Required>N</Required>
|
||||
</maxConnections>
|
||||
<maxConnectionsServers type="IntegerField">
|
||||
<MinimumValue>0</MinimumValue>
|
||||
<MaximumValue>10000000</MaximumValue>
|
||||
<ValidationMessage>Please specify a value between 0 and 10000000.</ValidationMessage>
|
||||
<Required>N</Required>
|
||||
</maxConnectionsServers>
|
||||
<timeoutClient type="TextField">
|
||||
<default>30s</default>
|
||||
<mask>/^([0-9]{1,8}(?:us|ms|s|m|h|d)?)/u</mask>
|
||||
|
|
@ -598,9 +604,9 @@
|
|||
<Required>N</Required>
|
||||
</basicAuthGroups>
|
||||
<tuning_maxConnections type="IntegerField">
|
||||
<MinimumValue>1</MinimumValue>
|
||||
<MaximumValue>500000</MaximumValue>
|
||||
<ValidationMessage>Please specify a value between 1 and 500000.</ValidationMessage>
|
||||
<MinimumValue>0</MinimumValue>
|
||||
<MaximumValue>10000000</MaximumValue>
|
||||
<ValidationMessage>Please specify a value between 0 and 10000000.</ValidationMessage>
|
||||
<Required>N</Required>
|
||||
</tuning_maxConnections>
|
||||
<tuning_timeoutClient type="TextField">
|
||||
|
|
@ -1318,6 +1324,12 @@
|
|||
<Type>cert</Type>
|
||||
<ValidationMessage>Please select a valid certificate from the list.</ValidationMessage>
|
||||
</sslClientCertificate>
|
||||
<maxConnections type="IntegerField">
|
||||
<MinimumValue>0</MinimumValue>
|
||||
<MaximumValue>10000000</MaximumValue>
|
||||
<ValidationMessage>Please specify a value between 0 and 10000000.</ValidationMessage>
|
||||
<Required>N</Required>
|
||||
</maxConnections>
|
||||
<weight type="IntegerField">
|
||||
<MinimumValue>0</MinimumValue>
|
||||
<MaximumValue>256</MaximumValue>
|
||||
|
|
|
|||
|
|
@ -1095,6 +1095,9 @@ defaults
|
|||
{% if OPNsense.HAProxy.general.defaults.init_addr|default("") != "" %}
|
||||
default-server init-addr {{OPNsense.HAProxy.general.defaults.init_addr}}
|
||||
{% endif %}
|
||||
{% if OPNsense.HAProxy.general.defaults.maxConnectionsServers|default("") != "" %}
|
||||
default-server maxconn {{OPNsense.HAProxy.general.defaults.maxConnectionsServers}}
|
||||
{% endif %}
|
||||
{% if OPNsense.HAProxy.general.defaults.customOptions|default("") != "" %}
|
||||
# WARNING: pass through options below this line
|
||||
{% for customOpt in OPNsense.HAProxy.general.defaults.customOptions.split("\n") %}
|
||||
|
|
@ -1725,6 +1728,8 @@ backend {{backend.name}}
|
|||
{# # add all additions from healthchecks here #}
|
||||
{% do server_options.append(healthcheck_additions|join(' ')) if healthcheck_additions.length != '0' %}
|
||||
{% endif %}
|
||||
{# # server maxconn #}
|
||||
{% do server_options.append('maxconn ' ~ server_data.maxConnections) if server_data.maxConnections|default("") != "" %}
|
||||
{# # server weight #}
|
||||
{% do server_options.append('weight ' ~ server_data.weight) if server_data.weight|default("") != "" %}
|
||||
{# # server role/mode #}
|
||||
|
|
|
|||
Loading…
Reference in a new issue