claude-os/start_redis_workers.sh
Bob Roberts bb3f468dd4 Add setup.sh and fix database path consistency across services
Add comprehensive one-command setup.sh script that handles:
- Prerequisites validation (Python 3, Git)
- Virtual environment creation and dependency installation
- Ollama installation and model download (llama3.1, nomic-embed-text)
- Redis installation and startup
- Directory and database initialization
- Frontend npm dependencies
- Clear progress output and next steps

Fix critical database path issues:
- Use absolute path calculation in config.py to ensure consistency
- Export SQLITE_DB_PATH environment variable in startup scripts
- Prevents database separation between app and MCP server

Fix document metadata field naming:
- Change metadata field from 'source' to 'filename' in MCP ingest
- Ensures consistency with existing document format
- Fixes document visibility issue in API endpoints

Update startup scripts to support environment-based database configuration.

🤖 Generated with Claude Code

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-27 20:08:32 -05:00

60 lines
1.9 KiB
Bash
Executable file

#!/bin/bash
# Claude OS Real-Time Learning System - Worker Startup Script
# Starts RQ workers for real-time learning system
set -e
# Get the project directory
PROJECT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
# Colors for output
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
RED='\033[0;31m'
NC='\033[0m' # No Color
echo -e "${GREEN}========================================${NC}"
echo -e "${GREEN}Claude OS Real-Time Learning System${NC}"
echo -e "${GREEN}Redis Worker Startup${NC}"
echo -e "${GREEN}========================================${NC}\n"
# Check if Redis is running
echo -e "${YELLOW}1. Checking Redis connection...${NC}"
if ! redis-cli ping &> /dev/null; then
echo -e "${RED}❌ Redis is not running${NC}"
echo "Please start Redis first:"
echo " redis-server"
echo " or: brew services start redis"
exit 1
fi
echo -e "${GREEN}✅ Redis is running${NC}\n"
# Check if Python virtual environment exists
if [ ! -d "$PROJECT_DIR/venv" ]; then
echo -e "${YELLOW}2. Creating Python virtual environment...${NC}"
python3 -m venv "$PROJECT_DIR/venv"
echo -e "${GREEN}✅ Virtual environment created${NC}"
else
echo -e "${GREEN}✅ Virtual environment exists${NC}"
fi
# Activate virtual environment
echo -e "${YELLOW}3. Activating virtual environment...${NC}"
source "$PROJECT_DIR/venv/bin/activate"
echo -e "${GREEN}✅ Virtual environment activated${NC}\n"
# Install dependencies
echo -e "${YELLOW}4. Installing dependencies...${NC}"
pip install -q redis rq 2>/dev/null || true
echo -e "${GREEN}✅ Dependencies installed${NC}\n"
# Start workers
echo -e "${YELLOW}5. Starting RQ workers...${NC}"
echo -e "${GREEN}🚀 Worker queues: claude-os:learning, claude-os:prompts, claude-os:ingest${NC}"
echo -e "${YELLOW}Press Ctrl+C to stop${NC}\n"
python3 -m rq worker claude-os:learning claude-os:prompts claude-os:ingest --with-scheduler
# Cleanup on exit
trap 'echo -e "\n${GREEN}👋 Redis workers stopped${NC}"' EXIT