Newer
Older
gnexus-book / scripts / rollback-cutover.sh
#!/bin/bash
set -euo pipefail

cd "$(dirname "$0")/.."
SERVER_DIR="$(pwd)/server"

cd "$SERVER_DIR"
GNEXUS_BOOK_STORAGE_BACKEND=file .venv/bin/python - <<'PY'
from app.config import Settings
from app.docs_repository import DocsRepository
from app.validation import validate_repository

settings = Settings(storage_backend="file")
report = validate_repository(settings)
documents = DocsRepository(settings).list_docs()
print(f"file validation: {report['status']} ({report['issue_count']} issues)")
print(f"documents readable: {len(documents)}")
raise SystemExit(0 if report["status"] == "ok" else 1)
PY

echo
echo "The file backend is readable and validated."
echo "Set GNEXUS_BOOK_STORAGE_BACKEND=file on the service and restart"
echo "gnexus-book-backend and gnexus-book-mcp to roll back."
echo "If the database itself must be restored, use scripts/restore-db.sh"
echo "with the pre-cutover dump and GNEXUS_BOOK_RESTORE_YES=1."