Sign inSign up

danie1k/homelab-haproxy

By danie1k

•Updated over 5 years ago

Automated HA-Proxy for Docker containers

Image
0

1.1K

danie1k/homelab-haproxy repository overview

QA Build Status Docker Hub Build Status Docker Image Version MIT License

⁠Automated HA-Proxy for Docker containers

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

⁠Usage

  • 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_port
    • haproxy.target_port
  • HA-Proxy config blocks are generated using Jinja⁠ template engine
  • Built-in templates can be easily overridden by adding the templates directory to HAPROXY_CONFIG_VOLUME with .j2 file(s)

⁠Environment variables

  • 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 seconds
  • NETWORK_NAME="bridge"

⁠Volumes

  • /usr/local/etc/haproxy
  • /var/run/docker.sock

Tag summary

Content type

Image

Digest

Size

141.3 MB

Last updated

over 5 years ago

docker pull danie1k/homelab-haproxy