Files
hoerdle/scripts/migration-smoke-test.sh
T
Hördle Bot 1c7bfdf421 Ops: add Proxmox migration tooling and runbook
Add end-to-end migration scripts for inventory, precopy, cutover, smoke tests, rollback, and post-migration checks. Include an operational runbook and Proxmox env template to move Hördle behind Nginx Proxy Manager while preserving persistent volumes safely.
2026-04-25 09:46:52 +00:00

66 lines
1.3 KiB
Bash
Executable File

#!/usr/bin/env bash
set -euo pipefail
# Smoke-Tests nach dem Umschalten auf Proxmox/NPM.
# Kann lokal oder auf beliebigem Host mit curl ausgefuehrt werden.
BASE_URL="${1:-https://hoerdle.de}"
EXPECTED_STATUS="${EXPECTED_STATUS:-200}"
require_cmd() {
if ! command -v "$1" >/dev/null 2>&1; then
echo "Fehlend: $1"
exit 1
fi
}
require_cmd curl
require_cmd grep
echo "== Hördle Smoke-Test =="
echo "BASE_URL=$BASE_URL"
echo
check_http() {
local name="$1"
local url="$2"
local code
code="$(curl -sS -o /dev/null -w "%{http_code}" "$url" || true)"
if [ "$code" = "$EXPECTED_STATUS" ]; then
echo "[OK] $name -> $code"
else
echo "[FAIL] $name -> $code (erwartet: $EXPECTED_STATUS)"
return 1
fi
}
check_body_contains() {
local name="$1"
local url="$2"
local needle="$3"
if curl -fsS "$url" | grep -q "$needle"; then
echo "[OK] $name enthält '$needle'"
else
echo "[FAIL] $name enthält '$needle' nicht"
return 1
fi
}
FAILED=0
check_http "Homepage" "$BASE_URL/" || FAILED=1
check_http "Daily API" "$BASE_URL/api/daily" || FAILED=1
# Prüft, ob Daily API als JSON zurückkommt.
check_body_contains "Daily API" "$BASE_URL/api/daily" "{" || FAILED=1
echo
if [ "$FAILED" -eq 0 ]; then
echo "Smoke-Test erfolgreich."
else
echo "Smoke-Test fehlgeschlagen."
exit 1
fi