72 lines
2.3 KiB
Bash
72 lines
2.3 KiB
Bash
|
|
#!/bin/bash
|
||
|
|
# Start All Development Services
|
||
|
|
# Starts webapp, orchestrator, and optionally database services
|
||
|
|
|
||
|
|
echo -e "\033[0;32mStarting all development services...\033[0m"
|
||
|
|
|
||
|
|
# Check if Docker is available
|
||
|
|
if command -v docker &> /dev/null; then
|
||
|
|
echo -e "\n\033[0;33mDocker detected - checking for database services...\033[0m"
|
||
|
|
DOCKER_AVAILABLE=true
|
||
|
|
else
|
||
|
|
echo -e "\n\033[0;33mDocker not available - starting services without containers\033[0m"
|
||
|
|
DOCKER_AVAILABLE=false
|
||
|
|
fi
|
||
|
|
|
||
|
|
# Start webapp
|
||
|
|
echo -e "\n[1/3] \033[0;36mStarting webapp (Next.js)...\033[0m"
|
||
|
|
cd webapp || exit 1
|
||
|
|
echo -e "\033[0;32mStarting Next.js dev server...\033[0m"
|
||
|
|
npm run dev &
|
||
|
|
WEBAPP_PID=$!
|
||
|
|
cd ..
|
||
|
|
sleep 2
|
||
|
|
|
||
|
|
# Start orchestrator
|
||
|
|
echo -e "[2/3] \033[0;36mStarting orchestrator (Express)...\033[0m"
|
||
|
|
cd orchestrator || exit 1
|
||
|
|
echo -e "\033[0;32mStarting Orchestrator service...\033[0m"
|
||
|
|
npm run dev &
|
||
|
|
ORCH_PID=$!
|
||
|
|
cd ..
|
||
|
|
sleep 2
|
||
|
|
|
||
|
|
# Start database services if Docker is available
|
||
|
|
if [ "$DOCKER_AVAILABLE" = true ]; then
|
||
|
|
echo -e "[3/3] \033[0;36mStarting database services (PostgreSQL + Redis)...\033[0m"
|
||
|
|
echo -e " Using Docker Compose..."
|
||
|
|
docker-compose up -d postgres redis
|
||
|
|
sleep 3
|
||
|
|
|
||
|
|
# Check if services started successfully
|
||
|
|
if docker-compose ps postgres | grep -q "Up"; then
|
||
|
|
echo -e " ✅ PostgreSQL running"
|
||
|
|
else
|
||
|
|
echo -e " ⚠️ PostgreSQL may not be running"
|
||
|
|
fi
|
||
|
|
|
||
|
|
if docker-compose ps redis | grep -q "Up"; then
|
||
|
|
echo -e " ✅ Redis running"
|
||
|
|
else
|
||
|
|
echo -e " ⚠️ Redis may not be running"
|
||
|
|
fi
|
||
|
|
else
|
||
|
|
echo -e "[3/3] \033[0;33mDatabase services skipped (Docker not available)\033[0m"
|
||
|
|
echo -e " To use PostgreSQL/Redis, install Docker or start them manually"
|
||
|
|
fi
|
||
|
|
|
||
|
|
echo -e "\n\033[0;32m✅ All services starting!\033[0m"
|
||
|
|
echo -e "\n\033[0;36m📍 Service URLs:\033[0m"
|
||
|
|
echo -e " Webapp: http://localhost:3000"
|
||
|
|
echo -e " Orchestrator: http://localhost:8080"
|
||
|
|
echo -e " Health Check: http://localhost:8080/health"
|
||
|
|
if [ "$DOCKER_AVAILABLE" = true ]; then
|
||
|
|
echo -e " PostgreSQL: localhost:5432"
|
||
|
|
echo -e " Redis: localhost:6379"
|
||
|
|
fi
|
||
|
|
|
||
|
|
echo -e "\n\033[0;33m📝 Note: Services are running in background (PIDs: $WEBAPP_PID, $ORCH_PID)\033[0m"
|
||
|
|
echo -e " To stop services: kill $WEBAPP_PID $ORCH_PID"
|
||
|
|
echo ""
|
||
|
|
|