#!/bin/bash # LangMem Development Startup Script set -e echo "🚀 Starting LangMem Development Environment" # Check if .env exists, if not copy from example if [ ! -f .env ]; then echo "📋 Creating .env file from example..." cp .env.example .env echo "⚠️ Please update .env with your actual database password" fi # Check if required services are running echo "🔍 Checking required services..." # Check Ollama if ! curl -s http://localhost:11434/api/tags > /dev/null; then echo "❌ Ollama is not running. Please start Ollama first." exit 1 fi echo "✅ Ollama is running" # Check Supabase if ! docker ps | grep -q supabase-db; then echo "❌ Supabase is not running. Please start Supabase first." exit 1 fi echo "✅ Supabase is running" # Check if localai network exists if ! docker network ls | grep -q localai; then echo "📡 Creating localai network..." docker network create localai fi echo "✅ Docker network 'localai' is ready" # Build and start services echo "🏗️ Building and starting LangMem services..." docker compose up -d --build # Wait for services to be ready echo "⏳ Waiting for services to be ready..." sleep 10 # Check service health echo "🔍 Checking service health..." max_retries=30 retry_count=0 while [ $retry_count -lt $max_retries ]; do if curl -s http://localhost:8765/health > /dev/null; then echo "✅ LangMem API is healthy" break fi retry_count=$((retry_count + 1)) echo "⏳ Waiting for API to be ready (attempt $retry_count/$max_retries)" sleep 2 done if [ $retry_count -eq $max_retries ]; then echo "❌ API failed to become ready" docker compose logs langmem-api exit 1 fi # Display service status echo "" echo "🎉 LangMem Development Environment is ready!" echo "" echo "📊 Service Status:" echo " - LangMem API: http://localhost:8765" echo " - API Documentation: http://localhost:8765/docs" echo " - Neo4j Browser: http://localhost:7474" echo " - Health Check: http://localhost:8765/health" echo "" echo "🔧 Useful Commands:" echo " - View logs: docker compose logs -f langmem-api" echo " - Run tests: ./scripts/test.sh" echo " - Stop services: docker compose down" echo " - Restart API: docker compose restart langmem-api" echo "" echo "🔑 API Key: langmem_api_key_2025" echo "" # Show current health status echo "🏥 Current Health Status:" curl -s http://localhost:8765/health | python3 -m json.tool || echo "Failed to get health status"