mirror of
https://github.com/vimagick/dockerfiles.git
synced 2025-05-13 22:06:55 +02:00
add haproxy
This commit is contained in:
parent
d55ec4be12
commit
04e6105b65
@ -51,6 +51,7 @@ A collection of delicious docker recipes.
|
|||||||
- [x] grafana
|
- [x] grafana
|
||||||
- [x] grafana-arm
|
- [x] grafana-arm
|
||||||
- [x] h2o
|
- [x] h2o
|
||||||
|
- [x] haproxy-arm
|
||||||
- [x] httpbin :+1:
|
- [x] httpbin :+1:
|
||||||
- [x] hubot
|
- [x] hubot
|
||||||
- [x] hugo
|
- [x] hugo
|
||||||
@ -141,6 +142,7 @@ A collection of delicious docker recipes.
|
|||||||
- [ ] gliderlabs/logspout
|
- [ ] gliderlabs/logspout
|
||||||
- [x] gliderlabs/registrator
|
- [x] gliderlabs/registrator
|
||||||
- [x] gogs :cn:
|
- [x] gogs :cn:
|
||||||
|
- [x] haproxy
|
||||||
- [x] jazzdd/phpvirtualbox
|
- [x] jazzdd/phpvirtualbox
|
||||||
- [x] jenkins
|
- [x] jenkins
|
||||||
- [x] jupyter/notebook
|
- [x] jupyter/notebook
|
||||||
|
58
haproxy/README.md
Normal file
58
haproxy/README.md
Normal file
@ -0,0 +1,58 @@
|
|||||||
|
haproxy
|
||||||
|
=======
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
[HAProxy][1] is a free, open source high availability solution, providing load
|
||||||
|
balancing and proxying for TCP and HTTP-based applications by spreading
|
||||||
|
requests across multiple servers.
|
||||||
|
|
||||||
|
## docker-compose.yml
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
haproxy:
|
||||||
|
image: haproxy:alpine
|
||||||
|
volumes:
|
||||||
|
- ./haproxy.cfg:/usr/local/etc/haproxy/haproxy.cfg
|
||||||
|
net: host
|
||||||
|
restart: always
|
||||||
|
```
|
||||||
|
|
||||||
|
## haproxy.cfg
|
||||||
|
|
||||||
|
This sample config shows you how to setup a simple tcp load balancer.
|
||||||
|
|
||||||
|
```
|
||||||
|
# +- jp (:1081)
|
||||||
|
# |
|
||||||
|
# |- tw (:1082)
|
||||||
|
# frontend --- backend -+
|
||||||
|
# (*:1080) |- hk (:1083)
|
||||||
|
# |
|
||||||
|
# +- us (:1084)
|
||||||
|
|
||||||
|
global
|
||||||
|
# daemon # WARNING: DO NOT USE IT!
|
||||||
|
maxconn 4000
|
||||||
|
|
||||||
|
defaults
|
||||||
|
mode tcp
|
||||||
|
timeout connect 5000ms
|
||||||
|
timeout client 50000ms
|
||||||
|
timeout server 50000ms
|
||||||
|
|
||||||
|
frontend front
|
||||||
|
bind *:1080
|
||||||
|
default_backend back
|
||||||
|
|
||||||
|
backend back
|
||||||
|
balance roundrobin
|
||||||
|
server jp 127.0.0.1:1081 weight 50
|
||||||
|
server tw 127.0.0.1:1082 weight 20
|
||||||
|
server hk 127.0.0.1:1083 weight 15
|
||||||
|
server us 127.0.0.1:1084 weight 15
|
||||||
|
```
|
||||||
|
|
||||||
|
> :warning: haproxy must not be daemonized!
|
||||||
|
|
||||||
|
[1]: http://www.haproxy.org/
|
10
haproxy/arm/Dockerfile
Normal file
10
haproxy/arm/Dockerfile
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
#
|
||||||
|
# Dockerfile for haproxy-arm
|
||||||
|
#
|
||||||
|
|
||||||
|
FROM easypi/alpine-arm
|
||||||
|
MAINTAINER EasyPi Software Foundation
|
||||||
|
|
||||||
|
RUN apk add --no-cache haproxy
|
||||||
|
|
||||||
|
CMD ["haproxy", "-f", "/etc/haproxy/haproxy.cfg"]
|
6
haproxy/arm/docker-compose.yml
Normal file
6
haproxy/arm/docker-compose.yml
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
haproxy:
|
||||||
|
image: easypi/haproxy-arm
|
||||||
|
volumes:
|
||||||
|
- ./haproxy.cfg:/etc/haproxy/haproxy.cfg
|
||||||
|
net: host
|
||||||
|
restart: always
|
27
haproxy/arm/haproxy.cfg
Normal file
27
haproxy/arm/haproxy.cfg
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
# +- jp (:1081)
|
||||||
|
# |
|
||||||
|
# |- tw (:1082)
|
||||||
|
# frontend --- backend -+
|
||||||
|
# (*:1080) |- hk (:1083)
|
||||||
|
# |
|
||||||
|
# +- us (:1084)
|
||||||
|
|
||||||
|
global
|
||||||
|
maxconn 4000
|
||||||
|
|
||||||
|
defaults
|
||||||
|
mode tcp
|
||||||
|
timeout connect 5000ms
|
||||||
|
timeout client 50000ms
|
||||||
|
timeout server 50000ms
|
||||||
|
|
||||||
|
frontend front
|
||||||
|
bind *:1080
|
||||||
|
default_backend back
|
||||||
|
|
||||||
|
backend back
|
||||||
|
balance roundrobin
|
||||||
|
server jp 127.0.0.1:1081 weight 50
|
||||||
|
server tw 127.0.0.1:1082 weight 20
|
||||||
|
server hk 127.0.0.1:1083 weight 15
|
||||||
|
server us 127.0.0.1:1084 weight 15
|
6
haproxy/docker-compose.yml
Normal file
6
haproxy/docker-compose.yml
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
haproxy:
|
||||||
|
image: haproxy:alpine
|
||||||
|
volumes:
|
||||||
|
- ./haproxy.cfg:/usr/local/etc/haproxy/haproxy.cfg
|
||||||
|
net: host
|
||||||
|
restart: always
|
27
haproxy/haproxy.cfg
Normal file
27
haproxy/haproxy.cfg
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
# +- jp (:1081)
|
||||||
|
# |
|
||||||
|
# |- tw (:1082)
|
||||||
|
# frontend --- backend -+
|
||||||
|
# (*:1080) |- hk (:1083)
|
||||||
|
# |
|
||||||
|
# +- us (:1084)
|
||||||
|
|
||||||
|
global
|
||||||
|
maxconn 4000
|
||||||
|
|
||||||
|
defaults
|
||||||
|
mode tcp
|
||||||
|
timeout connect 5000ms
|
||||||
|
timeout client 50000ms
|
||||||
|
timeout server 50000ms
|
||||||
|
|
||||||
|
frontend front
|
||||||
|
bind *:1080
|
||||||
|
default_backend back
|
||||||
|
|
||||||
|
backend back
|
||||||
|
balance roundrobin
|
||||||
|
server jp 127.0.0.1:1081 weight 50
|
||||||
|
server tw 127.0.0.1:1082 weight 20
|
||||||
|
server hk 127.0.0.1:1083 weight 15
|
||||||
|
server us 127.0.0.1:1084 weight 15
|
Loading…
x
Reference in New Issue
Block a user