| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980 |
- #!/bin/bash
- echo "================================"
- echo "Deployment Diagnostics Script"
- echo "================================"
- echo ""
- # Colors for output
- RED='\033[0;31m'
- GREEN='\033[0;32m'
- YELLOW='\033[1;33m'
- NC='\033[0m' # No Color
- INSTALL_DIR="/opt/webshop-scraper"
- PROJECT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
- echo "1. Checking Git Status in Source Directory"
- echo " Source: $PROJECT_DIR"
- echo " ----------------------------------------"
- cd "$PROJECT_DIR"
- echo " Current branch: $(git rev-parse --abbrev-ref HEAD)"
- echo " Latest commit: $(git log -1 --oneline)"
- echo " Uncommitted changes:"
- git status --short
- echo ""
- echo "2. Checking if latest changes are pulled"
- echo " ----------------------------------------"
- git fetch origin
- BEHIND=$(git rev-list --count HEAD..origin/$(git rev-parse --abbrev-ref HEAD) 2>/dev/null || echo "0")
- if [ "$BEHIND" -gt 0 ]; then
- echo -e " ${RED}WARNING: You are $BEHIND commits behind origin!${NC}"
- echo " Run: git pull"
- else
- echo -e " ${GREEN}✓ Up to date with origin${NC}"
- fi
- echo ""
- echo "3. Checking if build contains the fix"
- echo " ----------------------------------------"
- if [ -f "$PROJECT_DIR/dist/web/assets/index-RRX4b9px.js" ]; then
- if grep -q "qdrantEmbeddings=.*embeddings||\\[\\]" "$PROJECT_DIR/dist/web/assets/index-RRX4b9px.js"; then
- echo -e " ${GREEN}✓ Local build HAS the null safety fix (||[])${NC}"
- else
- echo -e " ${RED}✗ Local build MISSING the null safety fix${NC}"
- echo " Run: npm run build"
- fi
- else
- echo -e " ${YELLOW}⚠ Build not found. Run: npm run build${NC}"
- fi
- echo ""
- echo "4. Checking installed version"
- echo " Install Dir: $INSTALL_DIR"
- echo " ----------------------------------------"
- if [ -f "$INSTALL_DIR/dist/web/assets/index-RRX4b9px.js" ]; then
- if grep -q "qdrantEmbeddings=.*embeddings||\\[\\]" "$INSTALL_DIR/dist/web/assets/index-RRX4b9px.js"; then
- echo -e " ${GREEN}✓ Installed version HAS the null safety fix${NC}"
- else
- echo -e " ${RED}✗ Installed version MISSING the null safety fix${NC}"
- echo " This explains why embeddings show as 0!"
- echo " Run: sudo ./scripts/install.sh"
- fi
- else
- echo -e " ${YELLOW}⚠ Installation not found at $INSTALL_DIR${NC}"
- fi
- echo ""
- echo "5. Recommended Actions"
- echo " ----------------------------------------"
- if [ "$BEHIND" -gt 0 ]; then
- echo " 1. Pull latest changes: git pull"
- fi
- if [ ! -f "$PROJECT_DIR/dist/web/assets/index-RRX4b9px.js" ] || ! grep -q "qdrantEmbeddings=.*embeddings||\\[\\]" "$PROJECT_DIR/dist/web/assets/index-RRX4b9px.js"; then
- echo " 2. Rebuild: npm run build"
- fi
- if [ ! -f "$INSTALL_DIR/dist/web/assets/index-RRX4b9px.js" ] || ! grep -q "qdrantEmbeddings=.*embeddings||\\[\\]" "$INSTALL_DIR/dist/web/assets/index-RRX4b9px.js"; then
- echo " 3. Reinstall: sudo ./scripts/install.sh"
- fi
- echo ""
|