Docker Swarm Haproxy Ingress Controller
The aim of the project is it to create dynamic ingress rules for swarm services through labels. This allows to create new services and change the haproxy configuration without any downtime or container rebuild.
The manager service is responsible for generating a valid haproxy configuration file from the labels. The loadbalancer instances scrape the configuration periodically and reload the worker "hitless" if the content has changed.
Synopsis
version: "3.9"
services:
# the lb service fetches the dynamic configuration,
# from the manager endpoint, periodically
loadbalancer:
image: bluebrown/swarm-haproxy-loadbalancer
# default values for env vars are below
environment:
MANAGER_ENDPOINT: http://manager:8080/
SCRAPE_INTERVAL: '60'
STARTUP_DELAY: '5'
ports:
- 3000:80 # ingress port
- 4450:4450 # stats page
# the manager service defines global defaults and frontend configs
manager:
image: bluebrown/swarm-haproxy-manager
# default
…