1
0
Fork 0

Preparing for reloading haproxy

This commit is contained in:
Joao Gilberto Magalhaes 2019-07-15 23:22:51 -05:00
parent 417db0de77
commit eb10288717
7 changed files with 103 additions and 6 deletions

18
scripts/exit-event-listener.py Executable file
View file

@ -0,0 +1,18 @@
#!/usr/bin/env python
import os
import signal
from supervisor import childutils
def main():
while True:
headers, payload = childutils.listener.wait()
childutils.listener.ok()
events = ['PROCESS_STATE_FATAL', 'PROCESS_STATE_EXITED', 'PROCESS_STATE_STOPPED']
if not (headers['eventname'] in events):
continue
os.kill(os.getppid(), signal.SIGTERM)
if __name__ == "__main__":
main()

5
scripts/haproxy-reload.sh Executable file
View file

@ -0,0 +1,5 @@
#!/usr/bin/env bash
echo "Reloading..."
/usr/local/sbin/haproxy -W -f /etc/haproxy/haproxy.cfg -p /run/haproxy.pid -x /var/run/haproxy.sock -sf $(cat /run/haproxy.pid) &

7
scripts/haproxy.sh Executable file
View file

@ -0,0 +1,7 @@
#!/usr/bin/env bash
/usr/local/sbin/haproxy -W -f /etc/haproxy/haproxy.cfg -p /run/haproxy.pid -S /var/run/haproxy.sock
while true; do
sleep 60
done