fix service health check, and properly disable coredns
parent
727d2de608
commit
e4f61af9e7
@ -1,16 +1,20 @@
|
||||
#!/usr/bin/with-contenv bash
|
||||
|
||||
if netstat -apn | grep -q ":53 "; then
|
||||
echo "Another service is using port 53, disabling CoreDNS"
|
||||
sleep infinity
|
||||
USE_COREDNS="false"
|
||||
fi
|
||||
|
||||
if [[ ${USE_COREDNS} == "false" ]]; then
|
||||
s6-notifyoncheck -d -n 300 -w 1000 -c "echo **** Disabling CoreDNS ****" \
|
||||
sleep infinity
|
||||
elif grep -q "health" /config/coredns/Corefile; then
|
||||
exec \
|
||||
s6-notifyoncheck -d -n 300 -w 1000 -c "redirfd -w 1 /dev/null curl -s http://localhost:8080/health" \
|
||||
cd /config/coredns \
|
||||
/app/coredns -dns.port=53
|
||||
else
|
||||
exec \
|
||||
s6-notifyoncheck -d -n 300 -w 1000 -c "nc -z -u 127.0.0.1 53" \
|
||||
cd /config/coredns \
|
||||
/app/coredns -dns.port=53
|
||||
exec \
|
||||
s6-notifyoncheck -d -n 300 -w 1000 -c "redirfd -w 1 /dev/null curl -s http://localhost:8080/health" \
|
||||
cd /config/coredns \
|
||||
/usr/bin/coredns -dns.port=53
|
||||
else
|
||||
exec \
|
||||
s6-notifyoncheck -d -n 300 -w 1000 -c "nc -zu localhost 53" \
|
||||
cd /config/coredns \
|
||||
/usr/bin/coredns -dns.port=53
|
||||
fi
|
||||
|
Loading…
Reference in New Issue