Spaces:
Running
Running
File size: 3,229 Bytes
af9cde9 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 | #!/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
|