Files
errors.bitreport.pt/deploy/lxc/verify.sh
T
1sonhadorandPaperclip b0b733d5e1 feat(BIT-247): consolidate error reporting repo from OTT
Merge ingest-api, collector-worker, admin-ui, database/error_reporting, deploy/lxc,
docker-compose, and deployment docs into the dedicated repository. Paths updated
for repo root (ER_REPO_ROOT, systemd WorkingDirectory). Root README documents layout.

Co-Authored-By: Paperclip <[email protected]>
2026-03-22 18:20:27 +00:00

39 lines
1.2 KiB
Bash
Executable File

#!/usr/bin/env bash
# Smoke checks after install: Postgres reachability (optional) + ingest /health.
set -euo pipefail
_ENV_FILE="/etc/error-reporting/env"
if [[ -f "${_ENV_FILE}" ]]; then
set -a
# shellcheck disable=SC1090
source "${_ENV_FILE}"
set +a
fi
_INGEST_URL="${INGEST_HEALTH_URL:-http://127.0.0.1:${PORT:-3041}/health}"
echo "verify: GET ${_INGEST_URL}"
if ! curl -sf "${_INGEST_URL}" >/dev/null; then
echo "verify: ingest /health failed" >&2
exit 1
fi
echo "verify: ingest OK"
if command -v pg_isready >/dev/null 2>&1 && [[ -n "${DATABASE_URL:-}" ]]; then
# pg_isready does not accept URI; probe TCP only when URL is simple localhost.
if [[ "${DATABASE_URL}" == *"@127.0.0.1:"* ]] || [[ "${DATABASE_URL}" == *"@localhost:"* ]]; then
echo "verify: pg_isready (best-effort, discrete vars may be needed on some hosts)"
_pgport="${PGPORT:-5432}"
pg_isready -h 127.0.0.1 -p "${_pgport}" || true
fi
fi
_ADMIN_PORT="${ADMIN_UI_PORT:-3040}"
if curl -sf "http://127.0.0.1:${_ADMIN_PORT}/" >/dev/null 2>&1; then
echo "verify: admin-ui HTTP on port ${_ADMIN_PORT} OK"
else
echo "verify: admin-ui not responding on ${_ADMIN_PORT} (expected if service stopped or demo mode off)"
fi
echo "verify: done"