Skip to content

Commit f85c498

Browse files
slusarzsirainen
authored andcommitted
haproxy: Remove detailed config, since it is not applicable for CE single server
1 parent 8275e14 commit f85c498

File tree

1 file changed

+5
-164
lines changed

1 file changed

+5
-164
lines changed

docs/core/config/proxy/haproxy.md

Lines changed: 5 additions & 164 deletions
Original file line numberDiff line numberDiff line change
@@ -14,65 +14,14 @@ dovecotlinks:
1414
open source software "TCP and HTTP" Load Balancer and proxying solution.
1515
It is available as a package on almost all Linux distros.
1616

17-
::: tip
18-
HAProxy is the recommended way to do software load balancing for Dovecot.
17+
::: warning
18+
Dovecot CE supports single-server operation only, so load balancing is not
19+
applicable.
1920

20-
This page is not intended to be a comprehensive HAProxy manual; it is designed
21-
to broadly explain how HAProxy can be used in a Dovecot-specific environment.
21+
This page exists to document HAProxy-related features that exist in the
22+
software.
2223
:::
2324

24-
The configuration is located at `/etc/haproxy/haproxy.cfg`.
25-
26-
## Frontends
27-
28-
A frontend defines how requests should be forwarded to backends. Frontends
29-
are defined in the frontend section of the HAProxy configuration. Their
30-
definitions are composed of the following components:
31-
32-
* A set of IP addresses and a port (e.g. `10.10.10.1, *:443`)
33-
* ACLs
34-
* `use_backend` rules, which define which backends to use depending on
35-
which ACL conditions are matched, and/or a `default_backend` rule that
36-
handles every other case.
37-
38-
An example of a front-end:
39-
40-
```
41-
frontend front_dc_pop3
42-
bind :1110
43-
mode tcp
44-
default_backend back_dc_pop3
45-
```
46-
47-
This configures a frontend named `front_dc_pop3`, which handles all
48-
incoming traffic on port 1110. This will send all traffic to the backends
49-
defined by `back_dc_pop3`.
50-
51-
## Access Control Lists (ACL)
52-
53-
In relation to load balancing, ACLs are used to test some condition and
54-
perform an action (e.g. select a server, or block a request) based on the
55-
test result.
56-
57-
This is similar in concept to an if-else snippet where execution takes
58-
place based upon the success or failure of a particular block. Use of ACLs
59-
allows flexible network traffic forwarding based on a variety of factors
60-
like pattern-matching and the number of connections to a backend.
61-
62-
Example of an ACL:
63-
64-
```
65-
acl url_stats path_beg /stats
66-
```
67-
68-
This ACL is matched if the path of a request begins with `/stats`. This
69-
would match a request of http://10.10.10.1/stats, for example.
70-
71-
Here, `url_stats` is just the label given to the pattern.
72-
73-
For more details on ACLs please refer to the official
74-
[HAProxy documentation](https://www.haproxy.org/).
75-
7625
## TLS Forwarding
7726

7827
For Dovecot to recognize that TLS termination has been performed, you need to
@@ -85,111 +34,3 @@ server s1 127.0.0.1:143 send-proxy-v2-ssl
8534
```
8635

8736
See also: [[link,secured_connections]].
88-
89-
## Backends
90-
91-
A backend is a set of servers that receives forwarded requests.
92-
93-
Backends are defined in the backend section of the HAProxy configuration. In
94-
its most basic form, a backend can be defined by:
95-
96-
* Which load balance algorithm to use (mentioned below)
97-
* A list of servers and ports
98-
99-
A backend can contain one or many servers. Adding more servers to your
100-
backend will generally increase the both the reliability and load capacity
101-
of the configured service by distributing the load over multiple servers.
102-
103-
Here is an example of a two backend configurations, `back_dc_pop3` and
104-
`back_dc_lmtp`, with two servers in each, listening for `pop3` and `lmtp`
105-
traffic respectively:
106-
107-
```
108-
backend back_dc_pop3
109-
mode tcp
110-
balance leastconn
111-
option allbackups
112-
server 10.41.1.131 10.41.1.131:110 check inter 5s
113-
server 10.41.1.116 10.41.1.116:110 check inter 5s
114-
115-
backend back_dc_lmtp
116-
mode tcp
117-
balance leastconn
118-
option allbackups
119-
server 10.41.1.131 10.41.1.131:24 check inter 5s
120-
server 10.41.1.116 10.41.1.116:24 check inter 5s
121-
```
122-
123-
::: info
124-
Details about load balancing methods and options are available in the
125-
haproxy documentation if you need more information.
126-
:::
127-
128-
## Health Checking
129-
130-
HAProxy uses health checks to determine if a backend server is available to
131-
process requests. This avoids having to manually remove a server from
132-
the backend if it becomes unavailable.
133-
134-
The default health check is to try to establish a TCP connection to the
135-
server. E.g., it checks if the backend server is listening on the
136-
configured IP address and port.
137-
138-
## Sample Configuration
139-
140-
HAProxy configured between Dovecot Backends and Scality sproxyd:
141-
142-
```
143-
global
144-
log 127.0.0.1 local2
145-
chroot /var/lib/haproxy
146-
pidfile /var/run/haproxy.pid
147-
maxconn 60000
148-
user haproxy
149-
group haproxy
150-
daemon
151-
stats socket /var/lib/haproxy/stats
152-
153-
defaults
154-
mode http
155-
log global
156-
option httplog
157-
option dontlognull
158-
option http-server-close
159-
option forwardfor except 127.0.0.0/8
160-
option redispatch
161-
retries 3
162-
timeout http-request 1m
163-
timeout queue 1m
164-
timeout connect 10s
165-
timeout client 1m
166-
timeout server 1m
167-
timeout http-keep-alive 10m
168-
timeout check 10s
169-
maxconn 5000
170-
171-
frontend scality_in
172-
bind :::81
173-
option forwardfor
174-
option httplog
175-
default_backend scality_ring
176-
177-
# Capture X-Dovecot-Reason, X-Dovecot-Username and
178-
# X-Dovecot-Session-Id headers
179-
capture request header X-Dovecot-Reason len 40
180-
capture request header X-Dovecot-Username len 40
181-
capture request header X-Dovecot-Session-Id len 70
182-
183-
backend scality_ring
184-
balance roundrobin
185-
mode http
186-
option forwardfor
187-
option httpchk
188-
default-server inter 30s
189-
server 10.10.10.1 10.10.10.1:81 check
190-
server 10.10.10.2 10.10.10.2:81 check
191-
server 10.10.10.3 10.10.10.3:81 check
192-
server 10.10.10.4 10.10.10.4:81 check
193-
server 10.10.10.5 10.10.10.5:81 check
194-
server 10.10.10.6 10.10.10.6:81 check
195-
```

0 commit comments

Comments
 (0)