#!/usr/bin/env bash # Smoke checks after install: MariaDB 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 mariadb-admin >/dev/null 2>&1 && [[ -n "${DATABASE_URL:-}" ]]; then if [[ "${DATABASE_URL}" == mysql://* || "${DATABASE_URL}" == mariadb://* ]]; then _PARSED="$(python3 -c " import os from urllib.parse import urlparse, unquote u = urlparse(os.environ['DATABASE_URL']) if u.scheme not in ('mysql', 'mariadb', 'mysqli'): raise SystemExit(0) host = u.hostname or '127.0.0.1' port = u.port or 3306 user = unquote(u.username or '') password = unquote(u.password or '') print(host, port, user, password) " 2>/dev/null)" || true if [[ -n "${_PARSED}" ]]; then read -r _h _p _u _pw <<< "${_PARSED}" echo "verify: mariadb-admin ping (best-effort)" mariadb-admin ping -h "${_h}" -P "${_p}" -u "${_u}" -p"${_pw}" --silent || true fi 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"