#!/bin/bash # Grimlock Quick Start Script # This script starts both backend and frontend for local development set -e # Exit on error echo "🤖 GRIMLOCK - Quick Start" echo "==========================" echo "" # Check if we're in the grimlock directory if [ ! -f "docker-compose.yml" ]; then echo "❌ Error: Please run this script from the grimlock directory" exit 1 fi # Step 1: Setup backend .env if it doesn't exist echo "📝 Step 1: Configuring backend..." if [ ! -f "backend/.env" ]; then echo "Creating backend/.env with API key..." cat > backend/.env << 'EOF' # Grimlock Backend Configuration # API Keys ANTHROPIC_API_KEY=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 # Server Configuration HOST=0.0.0.0 PORT=8000 DEBUG=true # Database DATABASE_URL=postgresql://grimlock:grimlock@postgres:5432/grimlock # Security SECRET_KEY=09d25e094faa6ca2556c818166b7a9563b93f7099f6f0f4caa6cf63b88e8d3e7 # Context Configuration CONTEXT_PATH=/app/context REPOS_PATH=/app/repos # AI Configuration AI_MODEL=claude-sonnet-4-5-20250514 AI_MAX_TOKENS=4096 TEMPERATURE=0.7 # Logging LOG_LEVEL=INFO # Redis REDIS_URL=redis://redis:6379 EOF echo "✅ Backend .env created" else echo "✅ Backend .env already exists" fi # Step 2: Setup frontend .env.local if it doesn't exist echo "" echo "📝 Step 2: Configuring frontend..." if [ ! -f "frontend/.env.local" ]; then echo "Creating frontend/.env.local..." cat > frontend/.env.local << 'EOF' NEXT_PUBLIC_API_URL=http://localhost:8000 NEXT_PUBLIC_WS_URL=http://localhost:8000 EOF echo "✅ Frontend .env.local created" else echo "✅ Frontend .env.local already exists" fi # Step 3: Check for Docker echo "" echo "🐳 Step 3: Checking Docker..." if ! command -v docker &> /dev/null; then echo "❌ Docker not found. Please install Docker first." echo "Visit: https://docs.docker.com/get-docker/" exit 1 fi if ! command -v docker-compose &> /dev/null && ! docker compose version &> /dev/null; then echo "❌ Docker Compose not found. Please install Docker Compose first." exit 1 fi echo "✅ Docker is installed" # Step 4: Start backend echo "" echo "🚀 Step 4: Starting backend services..." if command -v docker-compose &> /dev/null; then docker-compose up -d else docker compose up -d fi echo "⏳ Waiting 10 seconds for services to start..." sleep 10 # Step 5: Health check echo "" echo "🏥 Step 5: Checking backend health..." HEALTH_CHECK=$(curl -s http://localhost:8000/api/health || echo "failed") if echo "$HEALTH_CHECK" | grep -q "healthy"; then echo "✅ Backend is healthy!" else echo "⚠️ Backend health check inconclusive, but continuing..." echo "You can check manually: curl http://localhost:8000/api/health" fi # Step 6: Install frontend dependencies echo "" echo "📦 Step 6: Installing frontend dependencies..." cd frontend if [ ! -d "node_modules" ]; then echo "Running npm install..." npm install echo "✅ Dependencies installed" else echo "✅ Dependencies already installed" fi # Step 7: Instructions for starting frontend echo "" echo "════════════════════════════════════════════" echo "🎉 GRIMLOCK IS READY!" echo "════════════════════════════════════════════" echo "" echo "Backend is running at: http://localhost:8000" echo "Backend health check: curl http://localhost:8000/api/health" echo "Backend API docs: http://localhost:8000/docs" echo "" echo "To start the frontend, run:" echo " cd frontend" echo " npm run dev" echo "" echo "Then open your browser to: http://localhost:3000" echo "" echo "════════════════════════════════════════════" echo "FIRST TIME SETUP:" echo "1. Go to http://localhost:3000" echo "2. Click 'Sign up'" echo "3. Create your account (any role)" echo "4. Create a channel called 'general'" echo "5. Send a message: @grimlock what is Grimlock?" echo "6. Watch the AI respond!" echo "════════════════════════════════════════════" echo "" echo "To stop backend: docker-compose down" echo "To stop frontend: Ctrl+C in the terminal" echo ""