What I’d like to achieve is to have HAProxy running in a docker
container, proxying requests to website containers and to a container obtaining certificates. For apparent reasons I need to start with HTTP. Then when the certificates container obtains the certificate I want it to reload HAProxy, enabling HTTPS as a result.
I see that HAProxy has conditional blocks, but they can’t check for existence of files (.if exists(/path/to/certificate)
). I can’t integrate a new value of an environment variable into a process. So it seems like the options are:
- Enable HTTPS settings
.if defined(HTTPS)
. I don’t like the idea of changing the way a container starts, so I guess I need some wrapper that setsHTTPS=1
if the certificate exists and starts HAProxy. - Generate the config from a template. The first approach looks simpler.
In both cases I need to restart the HAProxy container.
Any better ideas?