up
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
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
This commit is contained in:
@@ -1,23 +1,33 @@
|
||||
#!/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}
|
||||
|
||||
COMPOSE_FILE="$(cd "$(dirname "$0")" && pwd)/compose-syslog-smtp.yaml"
|
||||
export COMPOSE_FILE
|
||||
# ensure stack up
|
||||
if ! docker compose ps >/dev/null 2>&1; then
|
||||
docker compose up -d
|
||||
fi
|
||||
sleep 2
|
||||
|
||||
echo "Starting syslog+smtp stack..."
|
||||
docker compose -f "$COMPOSE_FILE" up -d
|
||||
# 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 "Waiting for health checks..."
|
||||
docker compose -f "$COMPOSE_FILE" wait >/dev/null 2>&1 || true
|
||||
|
||||
echo "Current health status:"
|
||||
docker compose -f "$COMPOSE_FILE" ps
|
||||
|
||||
echo "Sending test syslog message (UDP)..."
|
||||
logger -n 127.0.0.1 -P 514 -d "test syslog message $(date -u +%s)"
|
||||
|
||||
echo "SMTP health endpoint:"
|
||||
curl -sf http://127.0.0.1:8025/api/v2/health || exit 1
|
||||
|
||||
echo "Done."
|
||||
echo "smtp/syslog stack healthy"
|
||||
|
||||
Reference in New Issue
Block a user