mirror of
https://github.com/netbirdio/plugins.git
synced 2026-05-22 18:44:07 -07:00
net/haproxy: fix peers by automatically configuring the local peer, closes #3114
This commit is contained in:
@@ -13,6 +13,7 @@ Added:
|
||||
|
||||
Fixed:
|
||||
* fix unix sockets in chrooted environment (#3093)
|
||||
* fix peers by automatically configuring the local peer (#3114)
|
||||
|
||||
3.11
|
||||
|
||||
|
||||
+4
-4
@@ -10,14 +10,14 @@
|
||||
<help><![CDATA[Enable or disable HAProxy peers. This will propagate entries of any data-types in stick-tables between several HAProxy instances over TCP connections in a multi-master fashion.]]></help>
|
||||
</field>
|
||||
<field>
|
||||
<label>Peer 1 (this host)</label>
|
||||
<label>Peer 1</label>
|
||||
<type>header</type>
|
||||
</field>
|
||||
<field>
|
||||
<id>haproxy.general.peers.name1</id>
|
||||
<label>Peer name (FQDN)</label>
|
||||
<type>text</type>
|
||||
<help><![CDATA[The name of the peer. This is usually the full hostname to make it possible for HAProxy to recognize the local peer. If HAProxy is unable to find the local peer it will fail to start.]]></help>
|
||||
<help><![CDATA[The name of the peer. This is usually the fully qualified domain name. If the name matches the <a href="/system_general.php">system hostname</a>, then this peer is automatically configured as local peer.]]></help>
|
||||
</field>
|
||||
<field>
|
||||
<id>haproxy.general.peers.listen1</id>
|
||||
@@ -32,14 +32,14 @@
|
||||
<help><![CDATA[The TCP port that should be used for connections to this peer. It must not be used by any other service.]]></help>
|
||||
</field>
|
||||
<field>
|
||||
<label>Peer 2 (remote host)</label>
|
||||
<label>Peer 2</label>
|
||||
<type>header</type>
|
||||
</field>
|
||||
<field>
|
||||
<id>haproxy.general.peers.name2</id>
|
||||
<label>Peer name (FQDN)</label>
|
||||
<type>text</type>
|
||||
<help><![CDATA[The name of the peer. This is usually the full hostname to make it possible for HAProxy to recognize the local peer. If HAProxy is unable to find the local peer it will fail to start.]]></help>
|
||||
<help><![CDATA[The name of the peer. This is usually the fully qualified domain name. If the name matches the <a href="/system_general.php">system hostname</a>, then this peer is automatically configured as local peer.]]></help>
|
||||
</field>
|
||||
<field>
|
||||
<id>haproxy.general.peers.listen2</id>
|
||||
|
||||
@@ -1041,6 +1041,10 @@ global
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{# # specify local peer #}
|
||||
{% if peers_enabled is defined %}
|
||||
localpeer {{ system.hostname|lower }}.{{ system.domain|lower }}
|
||||
{% endif %}
|
||||
{# # pass-through options #}
|
||||
{% if OPNsense.HAProxy.general.tuning.customOptions|default("") != "" %}
|
||||
# WARNING: pass through options below this line
|
||||
@@ -1892,7 +1896,7 @@ backend {{backend.name}}
|
||||
{# PEERS #}
|
||||
{# ############################### #}
|
||||
|
||||
{%- if helpers.exists('OPNsense.HAProxy.general.peers') and OPNsense.HAProxy.general.peers.enabled|default("") == "1" %}
|
||||
{%- if peers_enabled is defined %}
|
||||
{# # ensure that no value is missing #}
|
||||
{% if OPNsense.HAProxy.general.peers.name1|default("") != '' and
|
||||
OPNsense.HAProxy.general.peers.listen1|default("") != '' and
|
||||
@@ -1901,8 +1905,10 @@ backend {{backend.name}}
|
||||
OPNsense.HAProxy.general.peers.listen2|default("") != '' and
|
||||
OPNsense.HAProxy.general.peers.port2|default("") != '' %}
|
||||
peers {{peers_name}}
|
||||
peer {{OPNsense.HAProxy.general.peers.name1}} {{OPNsense.HAProxy.general.peers.listen1}}:{{OPNsense.HAProxy.general.peers.port1}}
|
||||
peer {{OPNsense.HAProxy.general.peers.name2}} {{OPNsense.HAProxy.general.peers.listen2}}:{{OPNsense.HAProxy.general.peers.port2}}
|
||||
peer {{OPNsense.HAProxy.general.peers.name1|lower}} {{OPNsense.HAProxy.general.peers.listen1}}:{{OPNsense.HAProxy.general.peers.port1}}
|
||||
peer {{OPNsense.HAProxy.general.peers.name2|lower}} {{OPNsense.HAProxy.general.peers.listen2}}:{{OPNsense.HAProxy.general.peers.port2}}
|
||||
{% else %}
|
||||
# ERROR: peers configuration is incomplete
|
||||
{% endif %}
|
||||
{%- endif -%}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user