Public Repository

Last pushed: 2 years ago
Short Description
Clustered haproxy
Full Description

This is build from the dockerfile/haproxy but adds some environment parsing and linked containers to allow the ha proxy to automatically setup up load balanced clusters based on the host name.

Environment Variables:

HACLUSTER_CLUSTERNAME : The host names of the clusters

CLUSTERNAME_PORT: The port exposed by the linked container.

CLUSTERNAME_LINKS: A comma separated list of linked containers that will be in the load balanced cluster.

Example:

docker run -p 80:80 -t -i --link test1:test1 --link test2:test2 --link test3:test3 -e HACLUSTER_TEST1=test1.domain.com -e HACLUSTER_TEST2=test2.domain.com -e TEST1_CLUSTER_PORT=80 -e TEST2_CLUSTER_PORT=8080 -e TEST1_CLUSTER_LINKS=TEST1 -e TEST2_CLUSTER_LINKS=TEST2,TEST3 mjgillespie/haproxy

The example flow creates 3 links, test1, test2, and test 3 and puts them into 2 clusters: test1.domain.com and test2.domain.com.

  • TEST1: Responds to test1.domain.com. Routes traffic to the linked container test1 to the container's exposed port 80.
  • TEST2: Responds to test2.domain.com. Routes traffic to the linked containers test2 and test 3 over the container's port 8080 and load balances the traffic.

Next up will be adding an overridable configuration.

Docker Pull Command
Owner
mjgillespie

Comments (0)