danie1k / homelab-haproxy

Automated HA-Proxy for Docker containers

Home Page:https://hub.docker.com/r/danie1k/homelab-haproxy

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

About

Automated HA-Proxy for Docker containers

https://hub.docker.com/r/danie1k/homelab-haproxy

License:MIT License


Languages

Language:Python 65.8%Language:Dockerfile 22.3%Language:HTML 7.1%Language:Makefile 4.9%