Files
chorus-services/chorus.sh
tony b45c9c537e feat: correct SLURP/HCFS architecture and complete Docker integration
Major architectural correction based on user clarification:

ARCHITECTURE CHANGES:
- SLURP: Context curator service that processes Hypercore logs, filters by role/triggers, serves via SQL
- HCFS: FUSE filesystem overlay embedded in sandbox Docker images, not a separate service
- Agents access context transparently through filesystem operations via HCFS → SLURP

DOCKER CONFIGURATION:
- Renamed slurp-api → slurp-curator throughout all configurations
- Created proper Dockerfiles for SLURP curator and COOEE RL tuner services
- Updated environment variables to reflect curator service role
- Fixed missing slurp_data volume in docker-compose.yml

UPDATED FILES:
- README.md: Corrected SLURP description from "Context Management" to "Context Curator Service"
- docker-compose.yml: Service rename, environment updates, added missing volume
- docker-compose.swarm.yml: Production deployment with correct service names
- build-and-push.sh: Updated to build slurp-curator service
- chorus.sh: Updated service references and endpoints
- init-db.sql: Database initialization for curator service
- modules/slurp/Dockerfile: New curator service container
- modules/slurp/Dockerfile.rl-tuner: New COOEE RL tuner container

VALIDATION:
- WHOOSH submodule validated: proper Dockerfiles and dependencies present
- BZZZ submodule integrated: build issues identified in original repo (requires separate fix)
- All Docker configurations updated to reflect correct architecture

MEMORY UPDATES:
- project_overview: Updated with correct SLURP/HCFS roles and current project status
- Removed references to deprecated HMMM component

This commit ensures all configuration reflects the correct architectural understanding
where SLURP curates context from logs and HCFS provides transparent filesystem access
to that curated context within agent sandbox environments.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-01 10:01:34 +10:00

300 lines
8.2 KiB
Bash
Executable File

#!/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 and push all docker images to registry"
echo " pull Pull latest images from registry"
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 " login Login to Docker registry"
echo " deploy Deploy to Docker Swarm (production)"
echo " undeploy Remove from Docker Swarm"
echo " dev Start in development mode with local builds"
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-curator : Context Curator Service (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 and push all docker images
build_images() {
print_info "Building and pushing CHORUS Services docker images to registry..."
./build-and-push.sh
print_success "All images built and pushed successfully"
}
# Pull latest images from registry
pull_images() {
print_info "Pulling latest CHORUS Services images from registry..."
docker-compose pull
print_success "All images pulled successfully"
}
# Login to Docker registry
docker_login() {
print_info "Logging into Docker registry..."
./build-and-push.sh login
}
# 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 Curator: http://localhost:8088"
echo " - SLURP RL Tuner: http://localhost:8089"
echo " - Grafana: http://localhost:3002 (admin/chorusadmin)"
echo " - Prometheus: http://localhost:9092"
}
# Start in development mode
start_dev() {
print_info "Starting CHORUS Services in development mode..."
docker-compose -f docker-compose.yml -f docker-compose.dev.yml up -d --build
print_info "Waiting for services to start..."
sleep 15
print_success "CHORUS Services started in development mode"
print_info "Development features enabled:"
echo " - Live code reloading"
echo " - Debug logging enabled"
echo " - Local builds (no registry required)"
}
# Deploy to Docker Swarm
deploy_swarm() {
print_info "Deploying CHORUS Services to Docker Swarm..."
# Check if we're in a swarm
if ! docker info --format '{{.Swarm.LocalNodeState}}' | grep -q active; then
print_error "Docker Swarm is not active. Please initialize or join a swarm first."
return 1
fi
docker stack deploy -c docker-compose.swarm.yml chorus
print_info "Waiting for stack to deploy..."
sleep 20
print_success "CHORUS Services deployed to swarm"
print_info "Production access points:"
echo " - Marketing Website: https://www.chorus.services"
echo " - Dashboard: https://dashboard.chorus.services"
echo " - API: https://api.chorus.services"
echo " - Documentation: https://api.chorus.services/docs"
echo ""
print_info "Internal services (*.home.deepblack.cloud):"
echo " - BZZZ Coordinator: https://chorus-bzzz.home.deepblack.cloud"
echo " - SLURP Curator: https://slurp.chorus.services"
echo " - COOEE RL Tuner: https://chorus-cooee.home.deepblack.cloud"
echo " - Grafana: https://chorus-grafana.home.deepblack.cloud"
echo " - Prometheus: https://chorus-prometheus.home.deepblack.cloud"
}
# Remove from Docker Swarm
undeploy_swarm() {
print_info "Removing CHORUS Services from Docker Swarm..."
docker stack rm chorus
print_success "CHORUS Services removed from swarm"
}
# 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 Curator"
"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
;;
pull)
pull_images
;;
update)
update_submodules
;;
init)
init_submodules
;;
clean)
clean_resources
;;
health)
check_health
;;
login)
docker_login
;;
deploy)
deploy_swarm
;;
undeploy)
undeploy_swarm
;;
dev)
start_dev
;;
*)
show_usage
exit 1
;;
esac