0

Im trying, unsuccessfully, to run the official haproxy container (https://hub.docker.com/_/haproxy) with an environment file per (something like this https://www.loadbalancer.org/blog/how-to-install-haproxy-rhel/) to allow me to substitute vars in my haproxy.cfg, example:

## env.txt
node1=www1.domain.com
node2=www2.domain.com
node_port=80
## haproxy.cfg
global
...

defaults
...

frontend somefrontend
   default_backend somebackend


backend somebackend
   mode http
   balance roundrobin
   server node1 ${node1}:${node_port} 
   server node2 ${node2}:${node_port} 

i cant seem to figure out how haproxy is even running on that container to figure out where i would even put the environment file. i found /etc/environment, overrode it w/ an env file and reloaded the config but those vars didnt take.

What im trying to accomplish is having a docker environment that if i want i haproxy to reference a node to our dev server instead of a local container, i can do so just by editing the environment file as opposed to the haproxy.cfg. This too would be useful, as i can use the same haproxy.cfg in production as well as locally and the only difference would be the env file. I've had similar setups before basically following the set up listed above (https://www.loadbalancer.org/blog/how-to-install-haproxy-rhel/) with systemd loading the env file, i just cant figure out how to get docker to be doing the same when haproxy is started

richv
  • 146
  • 2
  • 8

0 Answers0