#!/bin/bash # Verify local development environment setup for LightRAG sidecar set -e echo "╔════════════════════════════════════════════════════════════════╗" echo "║ LightRAG Sidecar — Local Environment Check ║" echo "╚════════════════════════════════════════════════════════════════╝" echo "" ERRORS=0 WARNINGS=0 # Check Python version echo "Checking Python..." if command -v python3 &> /dev/null; then PY_VERSION=$(python3 --version 2>&1 | awk '{print $2}') echo "✓ Python 3 (version $PY_VERSION)" else echo "✗ Python 3 not found. Install Python 3.10+" ERRORS=$((ERRORS+1)) fi # Check PostgreSQL echo "" echo "Checking PostgreSQL..." if command -v psql &> /dev/null; then PG_VERSION=$(psql --version 2>&1 | awk '{print $3}') echo "✓ PostgreSQL (version $PG_VERSION)" # Check if database exists if psql -l 2>/dev/null | grep -q "tip_lightrag"; then echo "✓ Database 'tip_lightrag' exists" else echo "⚠ Database 'tip_lightrag' not found (will be created by init_db.py)" WARNINGS=$((WARNINGS+1)) fi else echo "✗ PostgreSQL not found. Install PostgreSQL 17+" ERRORS=$((ERRORS+1)) fi # Check Qdrant echo "" echo "Checking Qdrant..." if curl -s http://localhost:6333/health | grep -q "ok"; then echo "✓ Qdrant running on localhost:6333" else echo "✗ Qdrant not responding. Start with: docker run -p 6333:6333 qdrant/qdrant:latest" ERRORS=$((ERRORS+1)) fi # Check Ollama echo "" echo "Checking Ollama..." if curl -s http://192.168.178.213:11434/api/tags | grep -q "qwen2.5:14b"; then echo "✓ Ollama running on 192.168.178.213:11434" echo "✓ qwen2.5:14b model available" else if curl -s http://localhost:11434/api/tags | grep -q "qwen2.5:14b"; then echo "⚠ Ollama available on localhost:11434 (Erik URL may be offline)" WARNINGS=$((WARNINGS+1)) else echo "✗ Ollama not found or qwen2.5:14b not loaded" echo " Start Ollama: ollama serve" echo " Load model: ollama pull qwen2.5:14b" ERRORS=$((ERRORS+1)) fi fi # Check Python venv echo "" echo "Checking Python virtual environment..." if [ -d "venv" ]; then echo "✓ venv directory exists" if [ -f "venv/bin/python" ]; then echo "✓ venv is initialized" else echo "⚠ venv exists but not fully initialized" WARNINGS=$((WARNINGS+1)) fi else echo "⚠ venv directory not found (create with: python3 -m venv venv)" WARNINGS=$((WARNINGS+1)) fi # Check requirements.txt echo "" echo "Checking Python dependencies..." if [ -f "requirements.txt" ]; then echo "✓ requirements.txt found" if [ -d "venv" ] && [ -f "venv/bin/python" ]; then # Check if key packages are installed if venv/bin/python -c "import fastapi, sqlalchemy, qdrant_client, sentence_transformers" 2>/dev/null; then echo "✓ Key packages installed (fastapi, sqlalchemy, qdrant_client, sentence_transformers)" else echo "⚠ Key packages not installed. Run: pip install -r requirements.txt" WARNINGS=$((WARNINGS+1)) fi fi else echo "✗ requirements.txt not found" ERRORS=$((ERRORS+1)) fi # Summary echo "" echo "╔════════════════════════════════════════════════════════════════╗" if [ $ERRORS -eq 0 ] && [ $WARNINGS -eq 0 ]; then echo "║ ✅ All checks passed! ║" echo "╚════════════════════════════════════════════════════════════════╝" echo "" echo "Ready to run tests. Next steps:" echo "" echo "1. Activate venv: source venv/bin/activate" echo "2. Initialize database: python scripts/init_db.py" echo "3. Start sidecar: uvicorn app.main:app --reload" echo "4. In another terminal: python scripts/populate_eval_set.py" echo "" exit 0 elif [ $ERRORS -eq 0 ]; then echo "║ ⚠️ Setup complete with warnings ║" echo "╚════════════════════════════════════════════════════════════════╝" echo "" echo "Warnings ($WARNINGS):" echo " - Some optional components not found" echo " - Follow instructions above to resolve" echo "" exit 0 else echo "║ ❌ Setup incomplete ($ERRORS errors) ║" echo "╚════════════════════════════════════════════════════════════════╝" echo "" echo "Errors ($ERRORS) must be fixed before proceeding:" echo " - Install missing dependencies above" echo " - Start required services (PostgreSQL, Qdrant, Ollama)" echo "" exit 1 fi