Public | Automated Build

Last pushed: 3 years ago
Short Description
Short description is empty for this repo.
Full Description

Consul-template + HAProxy

It provides automatic configuration of HAProxy with Consul template.

Depends on: Consul cluster


  1. Install Docker

  2. Download automated build from public Docker Hub Registry: docker pull qapps/auto-balance
    (alternatively, you can build an image from Dockerfile: docker build -t="qapps/auto-balance"


docker run -d -P --name haproxy --restart=on-failure:100 qapps/auto-balance

additional options:

`-e "CONSUL_ADDR=ip"`: ip - consul IP address or DNS name. Default: consul

`-e "CONSUL_PORT=port"`: port - consul port: Default: 8500

`-p 1883:1883 -p 15672:15672 -p 5601:5601 -p 3000:3000`: ports exposed (1883, 15672)

###Register a new app in HAProxy

You need to add a new key and subkeys into the Consul key/value storage.


add a new app key to the key **service/haproxy/listen** (service/haproxy/listen/**app_key**);

then you need to add subkeys to your app_key with values:

key: `bind`, value (*:80) `required`

key: `balance`, value (roundrobin, leastconn) Default: roundrobin

key: `mode`, value (http, tcp) Default: http

key: `service`, value (your service name in the Consul, may be with tag) `required`
Docker Pull Command
Source Repository