Skip to content

Commit 43e84c7

Browse files
committed
Init version
0 parents  commit 43e84c7

File tree

3 files changed

+96
-0
lines changed

3 files changed

+96
-0
lines changed

Dockerfile

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
FROM centos:centos7
2+
MAINTAINER Marcin Ryzycki [email protected]
3+
4+
RUN yum install -y haproxy && yum clean all
5+
ADD haproxy/ /etc/haproxy/
6+
7+
EXPOSE 80 443
8+
9+
ENTRYPOINT ["/usr/sbin/haproxy"]
10+
CMD ["-vv"]

README.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# CentOS-7 with HAProxy
2+
3+
This is a [million12/centos-haproxy](https://registry.hub.docker.com/u/million12/centos-haproxy/) docker container with HAProxy load balancer. This work is very similar to official [dockerfile/haproxy](https://registry.hub.docker.com/u/dockerfile/haproxy/), but it's based on CentOS-7 and, more importantly, offers ability to provide any arguments to haproxy process. It's also pretty lightweight, only ~230M (vs. ~420M Ubuntu-based dockerfile/haproxy).
4+
5+
This container is built with `ENTRYPOINT` set to `haproxy`, so when you run it, it behaves as you'd run haproxy binary. Therefore **you can pass any extra options, which will be passed directly to haproxy**.
6+
7+
The default [haproxy.cfg](haproxy/haproxy.cfg) is provided just for demonstration purposes, so of course you will want to override it.
8+
9+
## Usage
10+
11+
### Basic
12+
13+
`docker run -ti -p 80:80 -p 443:443 million12/centos-haproxy -f /etc/haproxy/haproxy.cfg`
14+
15+
### Mount custom config, override some options
16+
17+
`docker run -d -p=80:80 -p=443:443 -v=/data/haproxy/haproxy.cfg:/etc/haproxy/haproxy.cfg million12/centos-haproxy -f /etc/haproxy/haproxy.cfg -n 10000`
18+
19+
### Check version and build options
20+
21+
`docker run -ti million12/centos-haproxy`
22+
23+
24+
## Author
25+
26+
Author: Marcin ryzy Ryzycki (<[email protected]>)

haproxy/haproxy.cfg

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
global
2+
#debug
3+
chroot /var/lib/haproxy
4+
user haproxy
5+
group haproxy
6+
7+
# Default SSL material locations
8+
ca-base /etc/ssl/certs
9+
crt-base /etc/ssl/private
10+
11+
# Default ciphers to use on SSL-enabled listening sockets.
12+
ssl-default-bind-ciphers kEECDH+aRSA+AES:kRSA+AES:+AES256:RC4-SHA:!kEDH:!LOW:!EXP:!MD5:!aNULL:!eNULL
13+
14+
spread-checks 4
15+
tune.maxrewrite 1024
16+
17+
defaults
18+
mode http
19+
balance roundrobin
20+
21+
option dontlognull
22+
option dontlog-normal
23+
option forwardfor
24+
option redispatch
25+
26+
maxconn 5000
27+
timeout connect 5s
28+
timeout client 20s
29+
timeout server 20s
30+
timeout queue 30s
31+
timeout http-request 5s
32+
timeout http-keep-alive 15s
33+
34+
#errorfile 400 /etc/haproxy/errors/400.http
35+
#errorfile 403 /etc/haproxy/errors/403.http
36+
#errorfile 408 /etc/haproxy/errors/408.http
37+
#errorfile 500 /etc/haproxy/errors/500.http
38+
#errorfile 502 /etc/haproxy/errors/502.http
39+
#errorfile 503 /etc/haproxy/errors/503.http
40+
#errorfile 504 /etc/haproxy/errors/504.http
41+
42+
stats enable
43+
stats refresh 30s
44+
#stats hide-version
45+
stats uri /
46+
47+
frontend http-in
48+
bind *:80
49+
http-request set-header X-Forwarded-Port %[dst_port]
50+
default_backend nodes
51+
52+
frontend https-in
53+
bind *:443
54+
http-request set-header X-Forwarded-Port %[dst_port]
55+
http-request add-header X-Forwarded-Proto https if { ssl_fc }
56+
default_backend nodes
57+
58+
backend nodes
59+
option httpchk HEAD / HTTP/1.1\r\nHost:localhost
60+
server node-0 127.0.0.1:81 check

0 commit comments

Comments
 (0)