Score:0

Using environment file in haproxy container

in flag

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

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.