Complete CHORUS Services integration with unified orchestration
- Docker Compose orchestration for all services - Unified management script (chorus.sh) with full lifecycle controls - Monitoring stack (Prometheus on 9092, Grafana on 3002) - Database initialization and networking configuration - Comprehensive documentation and usage guides - Port conflict resolution (avoid Cockpit on 9090) Components integrated: - WHOOSH: Orchestration platform (ports 3001, 8087) - BZZZ: P2P coordination system (port 8080) - SLURP: Context management system (port 8088) - COOEE: RL feedback system (port 8089) - Infrastructure: PostgreSQL, Redis, monitoring stack Ready for deployment and development.
This commit is contained in:
231
chorus.sh
Executable file
231
chorus.sh
Executable file
@@ -0,0 +1,231 @@
|
||||
#!/bin/bash
|
||||
|
||||
# CHORUS Services Management Script
|
||||
# Unified management interface for all CHORUS Services components
|
||||
|
||||
set -e
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
cd "$SCRIPT_DIR"
|
||||
|
||||
# Colors for output
|
||||
RED='\033[0;31m'
|
||||
GREEN='\033[0;32m'
|
||||
YELLOW='\033[1;33m'
|
||||
BLUE='\033[0;34m'
|
||||
NC='\033[0m' # No Color
|
||||
|
||||
# Print colored output
|
||||
print_info() {
|
||||
echo -e "${BLUE}[INFO]${NC} $1"
|
||||
}
|
||||
|
||||
print_success() {
|
||||
echo -e "${GREEN}[SUCCESS]${NC} $1"
|
||||
}
|
||||
|
||||
print_warning() {
|
||||
echo -e "${YELLOW}[WARNING]${NC} $1"
|
||||
}
|
||||
|
||||
print_error() {
|
||||
echo -e "${RED}[ERROR]${NC} $1"
|
||||
}
|
||||
|
||||
# Show usage information
|
||||
show_usage() {
|
||||
echo "CHORUS Services Management Script"
|
||||
echo ""
|
||||
echo "Usage: $0 [COMMAND]"
|
||||
echo ""
|
||||
echo "Commands:"
|
||||
echo " start Start all CHORUS Services"
|
||||
echo " stop Stop all CHORUS Services"
|
||||
echo " restart Restart all CHORUS Services"
|
||||
echo " status Show status of all services"
|
||||
echo " logs Show logs from all services"
|
||||
echo " logs [service] Show logs from specific service"
|
||||
echo " build Build all docker images"
|
||||
echo " update Update all submodules to latest"
|
||||
echo " init Initialize submodules (first time setup)"
|
||||
echo " clean Clean up docker resources"
|
||||
echo " health Check health of all services"
|
||||
echo ""
|
||||
echo "Services:"
|
||||
echo " - whoosh-backend : Orchestration API (port 8087)"
|
||||
echo " - whoosh-frontend : Web Dashboard (port 3001)"
|
||||
echo " - bzzz-coordinator : P2P Coordination (port 8080)"
|
||||
echo " - slurp-api : Context Management (port 8088)"
|
||||
echo " - slurp-rl-tuner : RL Context Tuner (port 8089)"
|
||||
echo " - postgres : Database (port 5433)"
|
||||
echo " - redis : Cache (port 6380)"
|
||||
echo " - prometheus : Metrics (port 9091)"
|
||||
echo " - grafana : Monitoring (port 3002)"
|
||||
}
|
||||
|
||||
# Initialize git submodules
|
||||
init_submodules() {
|
||||
print_info "Initializing git submodules..."
|
||||
git submodule init
|
||||
git submodule update --recursive
|
||||
print_success "Submodules initialized"
|
||||
}
|
||||
|
||||
# Update git submodules
|
||||
update_submodules() {
|
||||
print_info "Updating git submodules..."
|
||||
git submodule update --remote --recursive
|
||||
print_success "Submodules updated"
|
||||
}
|
||||
|
||||
# Build all docker images
|
||||
build_images() {
|
||||
print_info "Building CHORUS Services docker images..."
|
||||
|
||||
# Build each service
|
||||
print_info "Building WHOOSH backend..."
|
||||
docker-compose build whoosh-backend
|
||||
|
||||
print_info "Building WHOOSH frontend..."
|
||||
docker-compose build whoosh-frontend
|
||||
|
||||
print_info "Building BZZZ coordinator..."
|
||||
docker-compose build bzzz-coordinator
|
||||
|
||||
print_info "Building SLURP API..."
|
||||
docker-compose build slurp-api
|
||||
|
||||
print_info "Building SLURP RL Tuner..."
|
||||
docker-compose build slurp-rl-tuner
|
||||
|
||||
print_success "All images built successfully"
|
||||
}
|
||||
|
||||
# Start all services
|
||||
start_services() {
|
||||
print_info "Starting CHORUS Services..."
|
||||
docker-compose up -d
|
||||
|
||||
print_info "Waiting for services to start..."
|
||||
sleep 10
|
||||
|
||||
print_success "CHORUS Services started"
|
||||
print_info "Access points:"
|
||||
echo " - WHOOSH Dashboard: http://localhost:3001"
|
||||
echo " - WHOOSH API: http://localhost:8087"
|
||||
echo " - BZZZ Coordinator: http://localhost:8080"
|
||||
echo " - SLURP API: http://localhost:8088"
|
||||
echo " - SLURP RL Tuner: http://localhost:8089"
|
||||
echo " - Grafana: http://localhost:3002 (admin/chorusadmin)"
|
||||
echo " - Prometheus: http://localhost:9092"
|
||||
}
|
||||
|
||||
# Stop all services
|
||||
stop_services() {
|
||||
print_info "Stopping CHORUS Services..."
|
||||
docker-compose down
|
||||
print_success "CHORUS Services stopped"
|
||||
}
|
||||
|
||||
# Restart all services
|
||||
restart_services() {
|
||||
print_info "Restarting CHORUS Services..."
|
||||
stop_services
|
||||
start_services
|
||||
}
|
||||
|
||||
# Show service status
|
||||
show_status() {
|
||||
print_info "CHORUS Services Status:"
|
||||
docker-compose ps
|
||||
}
|
||||
|
||||
# Show logs
|
||||
show_logs() {
|
||||
if [ -z "$1" ]; then
|
||||
print_info "Showing logs from all services..."
|
||||
docker-compose logs -f
|
||||
else
|
||||
print_info "Showing logs from $1..."
|
||||
docker-compose logs -f "$1"
|
||||
fi
|
||||
}
|
||||
|
||||
# Check health of services
|
||||
check_health() {
|
||||
print_info "Checking CHORUS Services health..."
|
||||
|
||||
services=(
|
||||
"http://localhost:8087/health|WHOOSH Backend"
|
||||
"http://localhost:3001|WHOOSH Frontend"
|
||||
"http://localhost:8080/health|BZZZ Coordinator"
|
||||
"http://localhost:8088/health|SLURP API"
|
||||
"http://localhost:8089/health|SLURP RL Tuner"
|
||||
"http://localhost:9092/-/healthy|Prometheus"
|
||||
"http://localhost:3002/api/health|Grafana"
|
||||
)
|
||||
|
||||
for service in "${services[@]}"; do
|
||||
url=$(echo "$service" | cut -d'|' -f1)
|
||||
name=$(echo "$service" | cut -d'|' -f2)
|
||||
|
||||
if curl -s -f "$url" > /dev/null 2>&1; then
|
||||
print_success "$name is healthy"
|
||||
else
|
||||
print_error "$name is not responding"
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
# Clean up docker resources
|
||||
clean_resources() {
|
||||
print_warning "This will remove all CHORUS Services containers, networks, and volumes"
|
||||
read -p "Are you sure? (y/N): " -n 1 -r
|
||||
echo
|
||||
if [[ $REPLY =~ ^[Yy]$ ]]; then
|
||||
print_info "Cleaning up docker resources..."
|
||||
docker-compose down -v --remove-orphans
|
||||
docker system prune -f
|
||||
print_success "Cleanup completed"
|
||||
else
|
||||
print_info "Cleanup cancelled"
|
||||
fi
|
||||
}
|
||||
|
||||
# Main command handler
|
||||
case "$1" in
|
||||
start)
|
||||
start_services
|
||||
;;
|
||||
stop)
|
||||
stop_services
|
||||
;;
|
||||
restart)
|
||||
restart_services
|
||||
;;
|
||||
status)
|
||||
show_status
|
||||
;;
|
||||
logs)
|
||||
show_logs "$2"
|
||||
;;
|
||||
build)
|
||||
build_images
|
||||
;;
|
||||
update)
|
||||
update_submodules
|
||||
;;
|
||||
init)
|
||||
init_submodules
|
||||
;;
|
||||
clean)
|
||||
clean_resources
|
||||
;;
|
||||
health)
|
||||
check_health
|
||||
;;
|
||||
*)
|
||||
show_usage
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
Reference in New Issue
Block a user