reachy_mini_minder / start-dev.sh
Boopster's picture
initial commit
af9cde9
#!/bin/bash
# start-dev.sh - Start everything needed for Mini Minder development
# Usage: ./start-dev.sh [--no-browser]
set -e
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
cd "$SCRIPT_DIR"
# Colors for output
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
RED='\033[0;31m'
NC='\033[0m' # No Color
echo -e "${GREEN}🤖 Starting Mini Minder Development Environment${NC}"
echo ""
# Check if daemon is already running
if lsof -i :8000 >/dev/null 2>&1; then
echo -e "${YELLOW}⚠️ Daemon already running on port 8000${NC}"
else
echo -e "${GREEN}▶ Starting reachy-mini-daemon...${NC}"
source .venv/bin/activate
reachy-mini-daemon &
DAEMON_PID=$!
# Wait for daemon to be ready
echo " Waiting for daemon to start..."
for i in {1..30}; do
if curl -s http://localhost:8000/api/daemon/status >/dev/null 2>&1; then
echo -e "${GREEN} ✓ Daemon ready${NC}"
break
fi
sleep 1
if [ $i -eq 30 ]; then
echo -e "${RED} ✗ Daemon failed to start${NC}"
exit 1
fi
done
fi
# Check if frontend dev server is running
if lsof -i :3000 >/dev/null 2>&1; then
echo -e "${YELLOW}⚠️ Frontend already running on port 3000${NC}"
else
echo -e "${GREEN}▶ Starting frontend dev server...${NC}"
cd frontend
npm run dev &
FRONTEND_PID=$!
cd ..
# Wait for frontend
echo " Waiting for frontend to start..."
for i in {1..30}; do
if curl -s http://localhost:3000 >/dev/null 2>&1; then
echo -e "${GREEN} ✓ Frontend ready${NC}"
break
fi
sleep 1
done
fi
# Check if LangGraph sidecar is running
if lsof -i :2024 >/dev/null 2>&1; then
echo -e "${YELLOW}⚠️ LangGraph sidecar already running on port 2024${NC}"
else
echo -e "${GREEN}▶ Starting LangGraph sidecar...${NC}"
source .venv/bin/activate
langgraph dev --port 2024 &
SIDECAR_PID=$!
# Wait for sidecar
echo " Waiting for sidecar to start..."
for i in {1..30}; do
if curl -s http://localhost:2024/ok >/dev/null 2>&1; then
echo -e "${GREEN} ✓ Sidecar ready${NC}"
break
fi
sleep 1
done
fi
# Start the Mini Minder app
echo -e "${GREEN}▶ Starting Mini Minder...${NC}"
source .venv/bin/activate
reachy-mini-minder --react &
APP_PID=$!
# Wait a moment for the app to connect
sleep 3
# Open browser unless --no-browser flag is passed
if [[ "$1" != "--no-browser" ]]; then
echo -e "${GREEN}▶ Opening browser...${NC}"
open http://localhost:3000
fi
echo ""
echo -e "${GREEN}✅ All services started!${NC}"
echo ""
echo " Frontend: http://localhost:3000"
echo " Daemon: http://localhost:8000"
echo " Sidecar: http://localhost:2024"
echo ""
echo " Press Ctrl+C to stop all services"
echo ""
# Trap to clean up on exit
cleanup() {
echo ""
echo -e "${YELLOW}Shutting down...${NC}"
kill $APP_PID 2>/dev/null || true
kill $SIDECAR_PID 2>/dev/null || true
kill $FRONTEND_PID 2>/dev/null || true
kill $DAEMON_PID 2>/dev/null || true
echo -e "${GREEN}Done${NC}"
}
trap cleanup EXIT
# Wait for any process to exit
wait