mirror of
https://github.com/bokysan/docker-postfix.git
synced 2024-09-20 06:46:10 +08:00
a1b30f31f9
Default timeout for healthcheck by kubernetes is too low. As we wait up for 2 seconds for the Postfix and DKIM to respond, this exceeds the threshold and the healthcheck fails with: ``` Readiness probe failed: command "sh -c /scripts/healthcheck.sh" timed out ``` By simply increasing `timeoutSeconds` this issue is resolved.
26 lines
501 B
Bash
26 lines
501 B
Bash
#!/bin/sh
|
|
set -e
|
|
if [ -f /tmp/container_is_terminating ]; then
|
|
exit 0
|
|
fi
|
|
|
|
check_postfix() {
|
|
printf "EHLO healthcheck\nquit\n" | \
|
|
{ while read l ; do sleep 1; echo $l; done } | \
|
|
nc -w 2 127.0.0.1 587 | \
|
|
grep -qE "^220.*ESMTP Postfix"
|
|
}
|
|
|
|
check_dkim() {
|
|
if [ -f /tmp/no_open_dkim ]; then
|
|
return
|
|
fi
|
|
printf '\x18Clocalhost\x004\x00\x00127.0.0.1\x00' | nc -w 2 127.0.0.1 8891
|
|
}
|
|
|
|
echo "Postfix check..."
|
|
check_postfix
|
|
echo "DKIM check..."
|
|
check_dkim
|
|
echo "All OK!"
|