Skip to content

Commit 7825995

Browse files
committed
Add load balancer configuration example
1 parent 0008fcb commit 7825995

File tree

2 files changed

+46
-2
lines changed

2 files changed

+46
-2
lines changed

README.md

+4-2
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,13 @@ set :docker_compose_user, '<username>'
5050
# Define port range in respect to load balancer on server
5151
# If 2 or more environments reside on same server, configure port range as per environment
5252
# Ruby's Range object is expected, see http://ruby-doc.org/core-2.3.0/Range.html
53-
# Example: set :docker_compose_port_range, 2070..2080
53+
# Example: set :docker_compose_port_range, 2070..2071
5454
set :docker_compose_port_range, <port>..<port>
5555
```
5656

57-
Configure load balancer on server using port range defined in `docker_compose_port_range`.
57+
Configure load balancer with port range defined in `docker_compose_port_range`, see [example configuration](https://github.com/interactive-pioneers/capistrano-docker-compose/blob/master/haproxy.example.cfg).
58+
59+
NB! Ensure load balancer's HTTP health check uses Layer 7 and corresponds to the needs of the particular application.
5860

5961
## Contributing
6062

haproxy.example.cfg

+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
global
2+
log /dev/log local0
3+
log /dev/log local1 notice
4+
chroot /var/lib/haproxy
5+
user haproxy
6+
group haproxy
7+
daemon
8+
9+
defaults
10+
log global
11+
mode http
12+
option httplog
13+
option dontlognull
14+
option http-server-close
15+
option redispatch
16+
timeout connect 5000
17+
timeout http-keep-alive 15s
18+
timeout server 50000
19+
timeout client 50000
20+
errorfile 400 /etc/haproxy/errors/400.http
21+
errorfile 403 /etc/haproxy/errors/403.http
22+
errorfile 408 /etc/haproxy/errors/408.http
23+
errorfile 500 /etc/haproxy/errors/500.http
24+
errorfile 502 /etc/haproxy/errors/502.http
25+
errorfile 503 /etc/haproxy/errors/503.http
26+
errorfile 504 /etc/haproxy/errors/504.http
27+
28+
frontend http-in
29+
bind *:80
30+
mode http
31+
acl my_domain_control hdr(host) -i my-domain.com
32+
use_backend containers if my_domain_control
33+
34+
backend containers
35+
mode http
36+
balance roundrobin
37+
option forwardfor
38+
option httpchk get /
39+
http-check expect ! rstatus ^5
40+
default-server fall 1 rise 1
41+
server container1 127.0.0.1:2070 observe layer7
42+
server container2 127.0.0.1:2071 observe layer7

0 commit comments

Comments
 (0)