1
0
Fork 0
No description
Find a file
Joao Gilberto Magalhaes 97845b8a52 Refactor E2E tests and configuration format
- Replaced `easymapping` configuration with `containers` for better maintainability and clarity.
- Introduced `DockerComposeFixture` class in `utils.py` to manage Docker Compose lifecycle and smart build strategy.
- Enhanced YAML-to-environment variable conversion in `ContainerEnv` for dynamic configuration support.
- Updated HAProxy configurations and test fixtures to reflect the new format.
- Improved test coverage for YAML parsing, environment variable handling, and HAProxy config generation.
2026-02-13 12:01:47 -05:00
.github Enhance logging and error handling in E2E tests and CI workflows 2026-02-12 18:26:59 -05:00
.run Upload PyCharm default tests 2024-11-12 20:35:56 -06:00
.vscode Fix errors in the test 2023-02-08 19:27:50 -06:00
build Update logo ASCII art in main.py and bump Alpine base image to 3.23 2026-02-06 21:07:45 -05:00
deploy Add ingress status update functionality to support various deployment modes 2025-12-15 21:11:02 -05:00
docs Refactor E2E tests and configuration format 2026-02-13 12:01:47 -05:00
helm/easyhaproxy Add ingress status update functionality to support various deployment modes 2025-12-15 21:11:02 -05:00
scripts Migrate examples to tests_e2e directory structure 2026-02-12 17:05:04 -05:00
src Refactor E2E tests and configuration format 2026-02-13 12:01:47 -05:00
tests Refactor E2E tests and configuration format 2026-02-13 12:01:47 -05:00
tests_e2e Refactor E2E tests and configuration format 2026-02-13 12:01:47 -05:00
.dockerignore Minor changes in github actions 2022-08-26 16:05:18 -05:00
.gitignore Migrate examples to tests_e2e directory structure 2026-02-12 17:05:04 -05:00
.python-version Modernizing PyThon Projec 2026-01-22 20:14:22 -05:00
build-multiarch.sh Code reorganization 2022-08-26 15:56:13 -05:00
CONTRIBUTING.md Update CONTRIBUTING.md 2024-06-04 21:31:19 -05:00
LICENSE Initial Commit 2018-09-16 21:03:17 -05:00
Makefile Refactor: modernize codebase by replacing deprecated patterns, simplifying imports, and applying type hinting refinements. 2026-01-22 21:47:33 -05:00
pyproject.toml Refactor E2E tests and configuration format 2026-02-13 12:01:47 -05:00
README.md Migrate examples to tests_e2e directory structure 2026-02-12 17:05:04 -05:00
RELEASE.md Add --current flag to bump-version.sh for displaying current versions 2026-02-07 22:02:53 -05:00
uv.lock Refactor Docker Compose examples and plugins, add pytest tests 2026-02-11 19:19:08 -05:00

EasyHAProxy

Sponsor Opensource ByJG Build Status GitHub source GitHub license GitHub release Helm Version Artifact Hub

EasyHAProxy

Service discovery for HAProxy

EasyHAProxy dynamically creates the haproxy.cfg based on metadata collected from your workloads (Docker labels, Swarm service labels, or Kubernetes ingress annotations).

EasyHAProxy can detect and configure HAProxy automatically on the following platforms:

  • Docker
  • Docker Swarm
  • Kubernetes
  • Static YAML definitions (EASYHAPROXY_DISCOVER=static)

Who is using?

EasyHAProxy is part of some projects:

  • Dokku
  • MicroK8s
  • DigitalOcean Marketplace

See detailed instructions on how to install below.

EasyHAProxy Mission

Easy to set up and low configuration to numerous features.

Features

EasyHAProxy will discover services based on Docker (or Swarm) labels and Kubernetes ingress annotations, then dynamically build the haproxy.cfg. Below, EasyHAProxy main features:

  • Support Automatic Certificate Management Environment (ACME) protocol compatible with Let's Encrypt and other CAs.
  • Set your custom SSL certificates
  • Balance traffic between multiple replicas
  • Set SSL policies (strict, default, loose) via EASYHAPROXY_SSL_MODE.
  • Set up HAProxy to listen to TCP.
  • Add redirects.
  • Enable/disable Stats on port 1936 with a custom password.
  • Enable/disable custom errors.

Also, it is possible to set up HAProxy from a simple Yaml file instead of creating haproxy.cfg file.

How Does It Work?

You don't need to change your current infrastructure and don't need to learn the HAProxy configuration.

The steps are:

  • Run the EasyHAProxy container;
  • Add some labels to the containers you want to be parsed by EasyHAProxy (see detailed instructions below);
  • EasyHAProxy will automatically detect the containers, set up, and reload the HAProxy configurations for you without downtime.

Detailed Instructions

For detailed instructions on how to use EasyHAProxy, follow the instructions for the platform you want to use:

Kubernetes Docker Swarm Docker Static

Or you can install using tools:

Helm MicroK8s Dokku DigitalOcean

Special Topics

If you already set up the EasyHAProxy, is time to go deeper:

Configuration Reference

Detailed configuration guides for advanced setups:

Development

Requirements

  • Python 3.11 or higher
  • uv package manager

Installation for Development

# Install uv (if not already installed)
curl -LsSf https://astral.sh/uv/install.sh | sh

# Clone the repository
git clone https://github.com/byjg/docker-easy-haproxy.git
cd docker-easy-haproxy

# Install dependencies (creates virtual environment automatically)
uv sync --dev

# Run tests
make test
# or directly: uv run pytest tests/ -vv

# Run linting
make lint

# Format code
make format

Installing the Package

# Install with uv
uv pip install easymapping

# Or install from source
uv pip install -e ".[dev]"

See EasyHAProxy in action

Click on the image to see the videos (use HD for better visualization)

Docker In Action Docker and Letsencrypt K8s In Action K8s and Letsencrypt Static Configuration TCP Mode

Here is the code applied in the test examples above.


Open source ByJG