71 lines
2.1 KiB
Bash
71 lines
2.1 KiB
Bash
#!/usr/bin/env bash
|
|
# Verify Findings Ledger installation
|
|
# Usage: ./verify-install.sh [service-url]
|
|
|
|
set -euo pipefail
|
|
|
|
SERVICE_URL="${1:-http://localhost:8188}"
|
|
|
|
# Color output helpers
|
|
RED='\033[0;31m'
|
|
GREEN='\033[0;32m'
|
|
YELLOW='\033[1;33m'
|
|
NC='\033[0m'
|
|
|
|
log_info() { echo -e "${GREEN}[INFO]${NC} $*"; }
|
|
log_warn() { echo -e "${YELLOW}[WARN]${NC} $*"; }
|
|
log_error() { echo -e "${RED}[ERROR]${NC} $*"; }
|
|
log_pass() { echo -e "${GREEN} ✓${NC} $*"; }
|
|
log_fail() { echo -e "${RED} ✗${NC} $*"; }
|
|
|
|
CHECKS_PASSED=0
|
|
CHECKS_FAILED=0
|
|
|
|
run_check() {
|
|
local name="$1"
|
|
local cmd="$2"
|
|
|
|
if eval "$cmd" &>/dev/null; then
|
|
log_pass "$name"
|
|
((CHECKS_PASSED++))
|
|
else
|
|
log_fail "$name"
|
|
((CHECKS_FAILED++))
|
|
fi
|
|
}
|
|
|
|
main() {
|
|
log_info "Findings Ledger - Installation Verification"
|
|
log_info "==========================================="
|
|
log_info "Service URL: $SERVICE_URL"
|
|
echo ""
|
|
|
|
log_info "Health Checks:"
|
|
run_check "Readiness endpoint" "curl -sf ${SERVICE_URL}/health/ready"
|
|
run_check "Liveness endpoint" "curl -sf ${SERVICE_URL}/health/live"
|
|
|
|
echo ""
|
|
log_info "Metrics Checks:"
|
|
run_check "Metrics endpoint available" "curl -sf ${SERVICE_URL}/metrics | head -1"
|
|
run_check "ledger_write_latency_seconds present" "curl -sf ${SERVICE_URL}/metrics | grep -q ledger_write_latency_seconds"
|
|
run_check "ledger_projection_lag_seconds present" "curl -sf ${SERVICE_URL}/metrics | grep -q ledger_projection_lag_seconds"
|
|
run_check "ledger_merkle_anchor_duration_seconds present" "curl -sf ${SERVICE_URL}/metrics | grep -q ledger_merkle_anchor_duration_seconds"
|
|
|
|
echo ""
|
|
log_info "API Checks:"
|
|
run_check "OpenAPI spec available" "curl -sf ${SERVICE_URL}/swagger/v1/swagger.json | head -1"
|
|
|
|
echo ""
|
|
log_info "========================================"
|
|
log_info "Results: ${CHECKS_PASSED} passed, ${CHECKS_FAILED} failed"
|
|
|
|
if [[ $CHECKS_FAILED -gt 0 ]]; then
|
|
log_error "Some checks failed. Review service logs for details."
|
|
exit 1
|
|
fi
|
|
|
|
log_info "All checks passed. Installation verified."
|
|
}
|
|
|
|
main "$@"
|