- Modified `pytest.fixture` scope to `class` across tests to improve fixture lifecycle and reduce setup overhead. - Introduced a new `tests_e2e/test_swarm.py` test suite for Docker Swarm stack configurations. - Added E2E tests for Swarm mode with scenarios such as basic services and combined plugins. - Updated HAProxy image in Swarm stack `.yml` files to `byjg/easy-haproxy:local` for local testing consistency. - Added `swarm` marker in `pyproject.toml` for differentiating Docker Swarm-specific tests. - Updated GitHub workflows to include a new Swarm E2E test pipeline. |
||
|---|---|---|
| .. | ||
| cloudflare.yml | ||
| easyhaproxy.yml | ||
| ip-whitelist.yml | ||
| jwt-validator.yml | ||
| plugins-combined.yml | ||
| portainer.yml | ||
| README.md | ||
| services.yml | ||
Docker Swarm Examples
Self-contained examples for EasyHAProxy in Docker Swarm mode. All documentation is in the YAML files as header comments.
Quick Start
- Pick an example below
- Open the YAML file
- Read the header comments for complete instructions
- Run the commands step-by-step
Prerequisites
All examples require:
- Docker Swarm initialized (
docker swarm init) - Overlay network created (
docker network create --driver overlay --attachable easyhaproxy) - EasyHAProxy deployed (
docker stack deploy -c easyhaproxy.yml easyhaproxy)
See header comments in each file for detailed setup instructions.
Basic Examples
| File | Description |
|---|---|
| easyhaproxy.yml | EasyHAProxy service for Swarm with stats and certbot |
| services.yml | Basic services with SSL (embedded cert and file-based) |
| portainer.yml | Portainer management UI behind EasyHAProxy |
Plugin Examples
| File | Description |
|---|---|
| jwt-validator.yml | JWT token validation for API protection |
| ip-whitelist.yml | IP whitelist for admin panels or sensitive services |
| cloudflare.yml | Restore real client IPs when behind Cloudflare CDN |
| plugins-combined.yml | Multiple plugins combined for layered security |
Documentation Structure
Each YAML file contains:
- WHAT THIS DEMONSTRATES - Key features and concepts
- REQUIREMENTS - Idempotent setup commands (safe to run multiple times)
- HOW TO START - Command to deploy the stack
- HOW TO VERIFY IT'S WORKING - Test commands with expected outputs
- CLEAN UP - Commands to remove resources
Important: Service Labels
In Swarm mode, labels must be under deploy.labels, NOT top-level labels:
# ✅ CORRECT - Service labels
deploy:
labels:
easyhaproxy.http.host: example.com
# ❌ WRONG - Container labels (ignored in Swarm)
labels:
easyhaproxy.http.host: example.com