Based on https://github.com/clearlinux/dockerfiles/tree/master/haproxy
The idea behind this container is to
- Monitor changes in certain given Docker Network
- React when containers connect/disconnect to this network
- Automatically map names of these containers in HA-Proxy to FQDNs
- Run this container at least in two Docker Networks.
- By default, it will listen for requests on
eth0, so make your end-user-facing network to be first on a list. - Monitoring tool will automatically modify HA-Proxy settings
- If any new container will show up, it will be added to configuration if it has the following labels set:
haproxy.source_porthaproxy.target_port
- HA-Proxy config blocks are generated using Jinja template engine
- Built-in templates can be easily overridden by adding the
templatesdirectory toHAPROXY_CONFIG_VOLUMEwith.j2file(s)
DOCKER_API_BASE_URL="unix:///var/run/docker.sock"DOMAIN_NAME="local"HAPROXY_CONFIG_VOLUME="/usr/local/etc/haproxy"HAPROXY_PID_FILE="/var/run/haproxy.pid"NETWORK_MONITOR_DEBOUNCE="10"- in secondsNETWORK_NAME="bridge"
/usr/local/etc/haproxy/var/run/docker.sock