- Refactored HAProxy configuration files, templates, and paths to use `/etc/easyhaproxy` instead of `/etc/haproxy`. - Updated Dockerfile to generate DH params and placeholder certificates in the new configuration directory. - Added health check support with timeout to `DockerComposeFixture` in E2E test utilities. - Adjusted tests, templates, and plugins to use the new `Consts`-based configuration paths. - Introduced pytest fixtures for environment isolation and temporary directory management.
110 lines
2.9 KiB
YAML
110 lines
2.9 KiB
YAML
# ==============================================================================
|
|
# EXAMPLE: Portainer Behind EasyHAProxy
|
|
# ==============================================================================
|
|
#
|
|
# WHAT THIS DEMONSTRATES:
|
|
# - Running Portainer (Docker management UI) behind EasyHAProxy
|
|
# - Using external volumes and networks for shared infrastructure
|
|
# - Real-world application example with Let's Encrypt
|
|
# - HTTP to HTTPS redirect with Certbot
|
|
#
|
|
# REQUIREMENTS (run these first):
|
|
# ```bash
|
|
# # Create required volumes (idempotent)
|
|
# docker volume create certs_certbot
|
|
# docker volume create certs_haproxy
|
|
# docker volume create portainer_data
|
|
#
|
|
# # Create shared network (idempotent)
|
|
# docker network create easyhaproxy
|
|
#
|
|
# # Edit this file and change:
|
|
# # - Line 18: EASYHAPROXY_CERTBOT_EMAIL to your email
|
|
# # - Line 38: easyhaproxy.http.host to your real domain
|
|
# ```
|
|
#
|
|
# HOW TO START:
|
|
# ```bash
|
|
# docker compose -f docker-compose-portainer.yml up -d
|
|
# ```
|
|
#
|
|
# HOW TO VERIFY IT'S WORKING:
|
|
# ```bash
|
|
# # Check containers are running
|
|
# docker compose -f docker-compose-portainer.yml ps
|
|
# # Expected: Both easyhaproxy and portainer containers running
|
|
#
|
|
# # Access Portainer (replace with your domain or use /etc/hosts)
|
|
# # First time: Create admin user
|
|
# curl http://portainer.xpto.us
|
|
# # OR with /etc/hosts: echo "127.0.0.1 portainer.xpto.us" | sudo tee -a /etc/hosts
|
|
#
|
|
# # View HAProxy stats
|
|
# # URL: http://localhost:1936
|
|
# # Username: admin
|
|
# # Password: password
|
|
# ```
|
|
#
|
|
# CLEAN UP:
|
|
# ```bash
|
|
# docker compose -f docker-compose-portainer.yml down
|
|
# # To also remove volumes:
|
|
# # docker compose -f docker-compose-portainer.yml down -v
|
|
# # docker volume rm certs_certbot certs_haproxy portainer_data
|
|
# # docker network rm easyhaproxy
|
|
# ```
|
|
#
|
|
# ==============================================================================
|
|
|
|
|
|
services:
|
|
easyhaproxy:
|
|
image: byjg/easy-haproxy:5.0.0
|
|
volumes:
|
|
- /var/run/docker.sock:/var/run/docker.sock
|
|
- certs_certbot:/etc/easyhaproxy/certs/certbot
|
|
# - certs_haproxy:/etc/easyhaproxy/certs/haproxy
|
|
|
|
environment:
|
|
EASYHAPROXY_DISCOVER: docker
|
|
EASYHAPROXY_LABEL_PREFIX: easyhaproxy
|
|
EASYHAPROXY_CERTBOT_EMAIL: changeme@example.org
|
|
EASYHAPROXY_SSL_MODE: "default"
|
|
HAPROXY_CUSTOMERRORS: "true"
|
|
HAPROXY_USERNAME: admin
|
|
HAPROXY_PASSWORD: password
|
|
HAPROXY_STATS_PORT: 1936
|
|
|
|
ports:
|
|
- "80:80/tcp"
|
|
- "443:443/tcp"
|
|
- "1936:1936/tcp"
|
|
|
|
portainer:
|
|
image: portainer/portainer-ce:latest
|
|
volumes:
|
|
- portainer_data:/data
|
|
- /var/run/docker.sock:/var/run/docker.sock
|
|
labels:
|
|
easyhaproxy.http.redirect_ssl: true
|
|
easyhaproxy.http.certbot: true
|
|
easyhaproxy.http.host: portainer.xpto.us
|
|
easyhaproxy.http.port: 80
|
|
easyhaproxy.http.localport: 9000
|
|
|
|
|
|
volumes:
|
|
certs_certbot:
|
|
external: true
|
|
certs_haproxy:
|
|
external: true
|
|
portainer_data:
|
|
external: true
|
|
|
|
|
|
networks:
|
|
default:
|
|
name: easyhaproxy
|
|
external: true
|
|
|
|
|