Some checks failed
Docs CI / lint-and-preview (push) Has been cancelled
Export Center CI / export-ci (push) Has been cancelled
Airgap Sealed CI Smoke / sealed-smoke (push) Has been cancelled
Console CI / console-ci (push) Has been cancelled
devportal-offline / build-offline (push) Has been cancelled
34 lines
977 B
Bash
34 lines
977 B
Bash
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
# Health check for compose-syslog-smtp.yaml (DEVOPS-AIRGAP-58-001)
|
|
ROOT=${ROOT:-$(git rev-parse --show-toplevel)}
|
|
COMPOSE_FILE="${COMPOSE_FILE:-$ROOT/ops/devops/airgap/compose-syslog-smtp.yaml}"
|
|
SMTP_PORT=${SMTP_PORT:-2525}
|
|
SYSLOG_TCP=${SYSLOG_TCP:-5515}
|
|
SYSLOG_UDP=${SYSLOG_UDP:-5514}
|
|
|
|
export COMPOSE_FILE
|
|
# ensure stack up
|
|
if ! docker compose ps >/dev/null 2>&1; then
|
|
docker compose up -d
|
|
fi
|
|
sleep 2
|
|
|
|
# probe smtp banner
|
|
if ! timeout 5 bash -lc "echo QUIT | nc -w2 127.0.0.1 ${SMTP_PORT}" >/dev/null 2>&1; then
|
|
echo "smtp service not responding on ${SMTP_PORT}" >&2
|
|
exit 1
|
|
fi
|
|
# probe syslog tcp
|
|
if ! echo "test" | nc -w2 127.0.0.1 ${SYSLOG_TCP} >/dev/null 2>&1; then
|
|
echo "syslog tcp not responding on ${SYSLOG_TCP}" >&2
|
|
exit 1
|
|
fi
|
|
# probe syslog udp
|
|
if ! echo "test" | nc -w2 -u 127.0.0.1 ${SYSLOG_UDP} >/dev/null 2>&1; then
|
|
echo "syslog udp not responding on ${SYSLOG_UDP}" >&2
|
|
exit 1
|
|
fi
|
|
|
|
echo "smtp/syslog stack healthy"
|