Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagebash
titlebuildDocker.sh
CONTAINER=haproxy
IMAGE=haproxy:1.9.4

DIR=`pwd -P`

docker stop $CONTAINER
docker rm $CONTAINER

docker run -d \
--net host \
--restart=always \
-v $DIR/conf:/usr/local/etc/haproxy:ro \
--name $CONTAINER \
$IMAGE

docker logs -f $CONTAINER


Proxying a port using HAProxy



Code Block
global
    maxconn 100
 
defaults
    log global
    mode tcp
    retries 2
    timeout client 30m
    timeout connect 4s
    timeout server 30m
    timeout check 5s
 
listen stats
    mode http
    bind *:7000
    stats enable
    stats uri /
 
listen postgres
    bind *:5001
    server postgres dbhost:5432 maxconn 100 check port 5432


Reference

...