1
0
Fork 0
docker-easy-haproxy/examples/static
Joao Gilberto Magalhaes 71ca8f6a9d Bump version to 5.0.0 across repository for major release
- Updated all references from `4.6.0` to `5.0.0` in Docker, Kubernetes, and Swarm configurations, as well as Helm chart and documentation.
- Updated `RELEASE.md` with new version history and highlights.
- Aligned all deployment examples and documentation with the new version to ensure consistency.
2025-12-04 13:12:12 -05:00
..
conf Refactor plugin configuration examples and improve formatting in documentation 2025-11-27 19:49:32 -05:00
docker-compose.yml Bump version to 5.0.0 across repository for major release 2025-12-04 13:12:12 -05:00
README.md Revamp Swarm example documentation and streamline deployment instructions 2025-12-04 10:07:17 -05:00

Static Configuration Example

Self-contained example for EasyHAProxy using static YAML configuration. All documentation is in the docker-compose file as header comments.

Quick Start

  1. Open docker-compose.yml
  2. Read the header comments for complete instructions
  3. Choose a configuration scenario from conf/ directory
  4. Run the commands step-by-step

What is Static Mode?

Static mode uses explicit YAML configuration files instead of dynamic service discovery. This is useful for:

  • Non-containerized backends - VMs, bare metal servers, external APIs
  • Fixed infrastructure - When your backend IPs/ports don't change
  • Explicit routing control - Precise control over HAProxy configuration

Configuration Files

All scenarios use /etc/haproxy/static/config.yml mounted from ./conf/config.yml.

Choose one of these pre-made configurations:

Configuration File Description
config-basic.yml Simple HTTP→HTTPS redirect with SSL termination
config-certbot.yml Let's Encrypt SSL (requires public domain)
config-deny-pages.yml Block specific paths (e.g., /admin, /.env)
config-jwt-validator.yml JWT token validation for API authentication

Prerequisites

  • SSL certificates generated (./examples/generate-keys.sh)
  • /etc/hosts entry for host1.local
  • Backend container running on port 8080

See header comments in docker-compose.yml for detailed setup.

Documentation Structure

The docker-compose.yml file contains:

  • WHAT THIS DEMONSTRATES - Key features and concepts
  • REQUIREMENTS - Idempotent setup commands (safe to run multiple times)
  • HOW TO START - Commands to start backend and EasyHAProxy
  • HOW TO VERIFY IT'S WORKING - Test commands with expected outputs
  • CLEAN UP - Commands to stop and remove resources

Example Workflow

# 1. Generate certificates
cd ../.. && ./examples/generate-keys.sh && cd examples/static

# 2. Choose a configuration
cp conf/config-basic.yml conf/config.yml

# 3. Start backend
docker run -d --name container -p 8080:8080 byjg/static-httpserver

# 4. Start EasyHAProxy
docker compose up -d

# 5. Test
curl -k https://host1.local/

# 6. Clean up
docker compose down
docker stop container && docker rm container

Configuration File Reference

Basic structure of config.yml:

stats:
  username: admin
  password: password
  port: 1936

easymapping:
  - port: 443
    ssl: true
    hosts:
      host1.local:
        containers:
          - container:8080  # Can also be IP:PORT for external backends

See conf/ directory for complete examples.

Additional Documentation