deploy-diagnostics.sh 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. #!/bin/bash
  2. echo "================================"
  3. echo "Deployment Diagnostics Script"
  4. echo "================================"
  5. echo ""
  6. # Colors for output
  7. RED='\033[0;31m'
  8. GREEN='\033[0;32m'
  9. YELLOW='\033[1;33m'
  10. NC='\033[0m' # No Color
  11. INSTALL_DIR="/opt/webshop-scraper"
  12. PROJECT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
  13. echo "1. Checking Git Status in Source Directory"
  14. echo " Source: $PROJECT_DIR"
  15. echo " ----------------------------------------"
  16. cd "$PROJECT_DIR"
  17. echo " Current branch: $(git rev-parse --abbrev-ref HEAD)"
  18. echo " Latest commit: $(git log -1 --oneline)"
  19. echo " Uncommitted changes:"
  20. git status --short
  21. echo ""
  22. echo "2. Checking if latest changes are pulled"
  23. echo " ----------------------------------------"
  24. git fetch origin
  25. BEHIND=$(git rev-list --count HEAD..origin/$(git rev-parse --abbrev-ref HEAD) 2>/dev/null || echo "0")
  26. if [ "$BEHIND" -gt 0 ]; then
  27. echo -e " ${RED}WARNING: You are $BEHIND commits behind origin!${NC}"
  28. echo " Run: git pull"
  29. else
  30. echo -e " ${GREEN}✓ Up to date with origin${NC}"
  31. fi
  32. echo ""
  33. echo "3. Checking if build contains the fix"
  34. echo " ----------------------------------------"
  35. if [ -f "$PROJECT_DIR/dist/web/assets/index-RRX4b9px.js" ]; then
  36. if grep -q "qdrantEmbeddings=.*embeddings||\\[\\]" "$PROJECT_DIR/dist/web/assets/index-RRX4b9px.js"; then
  37. echo -e " ${GREEN}✓ Local build HAS the null safety fix (||[])${NC}"
  38. else
  39. echo -e " ${RED}✗ Local build MISSING the null safety fix${NC}"
  40. echo " Run: npm run build"
  41. fi
  42. else
  43. echo -e " ${YELLOW}⚠ Build not found. Run: npm run build${NC}"
  44. fi
  45. echo ""
  46. echo "4. Checking installed version"
  47. echo " Install Dir: $INSTALL_DIR"
  48. echo " ----------------------------------------"
  49. if [ -f "$INSTALL_DIR/dist/web/assets/index-RRX4b9px.js" ]; then
  50. if grep -q "qdrantEmbeddings=.*embeddings||\\[\\]" "$INSTALL_DIR/dist/web/assets/index-RRX4b9px.js"; then
  51. echo -e " ${GREEN}✓ Installed version HAS the null safety fix${NC}"
  52. else
  53. echo -e " ${RED}✗ Installed version MISSING the null safety fix${NC}"
  54. echo " This explains why embeddings show as 0!"
  55. echo " Run: sudo ./scripts/install.sh"
  56. fi
  57. else
  58. echo -e " ${YELLOW}⚠ Installation not found at $INSTALL_DIR${NC}"
  59. fi
  60. echo ""
  61. echo "5. Recommended Actions"
  62. echo " ----------------------------------------"
  63. if [ "$BEHIND" -gt 0 ]; then
  64. echo " 1. Pull latest changes: git pull"
  65. fi
  66. if [ ! -f "$PROJECT_DIR/dist/web/assets/index-RRX4b9px.js" ] || ! grep -q "qdrantEmbeddings=.*embeddings||\\[\\]" "$PROJECT_DIR/dist/web/assets/index-RRX4b9px.js"; then
  67. echo " 2. Rebuild: npm run build"
  68. fi
  69. if [ ! -f "$INSTALL_DIR/dist/web/assets/index-RRX4b9px.js" ] || ! grep -q "qdrantEmbeddings=.*embeddings||\\[\\]" "$INSTALL_DIR/dist/web/assets/index-RRX4b9px.js"; then
  70. echo " 3. Reinstall: sudo ./scripts/install.sh"
  71. fi
  72. echo ""