The byjg/easy-haproxy image polls Docker for label changes every 10 seconds by default, which races with the haproxy bats suite and intermittently produces curl exit 7. Expose `refresh-conf` as a global-only haproxy property that maps to `EASYHAPROXY_REFRESH_CONF`, lower it to 2 seconds in the bats setup, and wrap the localhost HTTP assertions in a retry loop so checks wait for haproxy to converge rather than failing on the first attempt.
31 lines
845 B
Plaintext
31 lines
845 B
Plaintext
---
|
|
services:
|
|
haproxy:
|
|
image: "{{ $.HAPROXY_IMAGE }}"
|
|
|
|
environment:
|
|
- EASYHAPROXY_DISCOVER=docker
|
|
- EASYHAPROXY_LABEL_PREFIX=haproxy
|
|
- EASYHAPROXY_LOG_LEVEL={{ $.HAPROXY_LOG_LEVEL }}
|
|
- EASYHAPROXY_REFRESH_CONF={{ $.HAPROXY_REFRESH_CONF }}
|
|
- CERTBOT_LOG_LEVEL={{ $.HAPROXY_LOG_LEVEL }}
|
|
- HAPROXY_LOG_LEVEL={{ $.HAPROXY_LOG_LEVEL }}
|
|
{{ if $.HAPROXY_LETSENCRYPT_EMAIL }}
|
|
- EASYHAPROXY_LETSENCRYPT_EMAIL={{ $.HAPROXY_LETSENCRYPT_EMAIL }}"
|
|
- EASYHAPROXY_LETSENCRYPT_SERVER={{ $.HAPROXY_LETSENCRYPT_SERVER }}
|
|
{{ end }}
|
|
- HAPROXY_STATS_PORT=false
|
|
|
|
network_mode: bridge
|
|
|
|
ports:
|
|
- "80:80"
|
|
{{ if $.HAPROXY_LETSENCRYPT_EMAIL }}
|
|
- "443:443"
|
|
{{ end }}
|
|
|
|
restart: unless-stopped
|
|
|
|
volumes:
|
|
- "/var/run/docker.sock:/var/run/docker.sock:ro"
|