Howdy;
We run haproxytech/haproxy-ubuntu:2.8 in a docker container. It’s launched by an entrypoint script that has to do other jobs every X amount of time and then tell haproxy to restart so that it can load up new SSL certs and updated map files:
entrypoint.sh
#!/bin/bash
function sync_maps_and_certs ()
{
# go grab the updated files
}
function restart_haproxy ()
{
haproxy \
-D \
-f /usr/local/etc/haproxy/haproxy.cfg \
-p /run/haproxy.pid \
-x /var/run/haproxy.sock \
-sf $(cat /run/haproxy.pid)
}
while true
do
sync_maps_and_certs || echo "problem syncing"
restart_haproxy || echo "problem restarting haproxy ... oh no!"
sleep 600
done
This works, but when running in Daemon mode we no longer get the haproxy logs to stdout in the Docker container. If I remove -D it works (but then the script loop can’t continue because it’s foregrounded) and if I background the haproxy process with a trailing & the old haproxy processes don’t seem to get the SIGTERM and we get a lot of processes built up over time.
I’d prefer to run in daemon mode and still get my logs to show up in the container stdout. Any suggestions?
1 post - 1 participant