Files
chorus-services/installer/install-chorus-enhanced.sh
tony 4ed167e734 Update branding assets and deployment configurations
- Enhanced moebius ring logo design in Blender
- Updated Docker Compose for website-only deployment with improved config
- Enhanced teaser layout with updated branding integration
- Added installation and setup documentation
- Consolidated planning and reports documentation
- Updated gitignore to exclude Next.js build artifacts and archives

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-27 07:45:08 +10:00

959 lines
27 KiB
Bash

#!/bin/bash
# CHORUS Distributed AI System Installer (Enhanced)
# One-command installation script for the CHORUS cluster with repository configuration
#
# Usage:
# curl -fsSL https://chorus.services/install.sh | sh
#
# Or with options:
# curl -fsSL https://chorus.services/install.sh | sh -s -- --coordinator --models "llama3.2,qwen2.5:7b"
set -e
# Colors and formatting
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
PURPLE='\033[0;35m'
CYAN='\033[0;36m'
WHITE='\033[1;37m'
NC='\033[0m' # No Color
# ASCII Art Banner
print_banner() {
echo -e "${PURPLE}"
cat << 'EOF'
██████╗██╗ ██╗ ██████╗ ██████╗ ██╗ ██╗███████╗
██╔════╝██║ ██║██╔═══██╗██╔══██╗██║ ██║██╔════╝
██║ ███████║██║ ██║██████╔╝██║ ██║███████╗
██║ ██╔══██║██║ ██║██╔══██╗██║ ██║╚════██║
╚██████╗██║ ██║╚██████╔╝██║ ██║╚██████╔╝███████║
╚═════╝╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝ ╚══════╝
🎵 Distributed AI Orchestration Platform
EOF
echo -e "${NC}"
echo -e "${CYAN} A living knowledge fabric for collaborative AI agents${NC}"
echo ""
}
# Configuration
CHORUS_VERSION="latest"
CHORUS_USER="$USER"
CHORUS_HOME="$HOME/chorus"
BZZZ_DIR="$CHORUS_HOME/project-queues/active/BZZZ"
WHOOSH_DIR="$CHORUS_HOME/project-queues/active/WHOOSH"
GITEA_URL="https://gitea.deepblack.cloud"
REGISTRY_URL="registry.home.deepblack.cloud"
# Installation flags
IS_COORDINATOR=false
INSTALL_MODELS=""
SKIP_DEPENDENCIES=false
QUIET_MODE=false
# Repository configuration
REPO_PROVIDER="gitea"
REPO_BASE_URL="http://ironwood:3000"
REPO_OWNER="tony"
REPO_NAME="bzzz"
REPO_TOKEN_FILE="$CHORUS_HOME/business/secrets/gitea-token"
# Parse command line arguments
while [[ $# -gt 0 ]]; do
case $1 in
--coordinator)
IS_COORDINATOR=true
shift
;;
--models)
INSTALL_MODELS="$2"
shift 2
;;
--skip-deps)
SKIP_DEPENDENCIES=true
shift
;;
--quiet)
QUIET_MODE=true
shift
;;
--github)
REPO_PROVIDER="github"
shift
;;
--gitea-url)
REPO_BASE_URL="$2"
shift 2
;;
--help)
echo "CHORUS Installation Script (Enhanced)"
echo ""
echo "Usage: $0 [OPTIONS]"
echo ""
echo "Options:"
echo " --coordinator Install as cluster coordinator node"
echo " --models MODEL Comma-separated list of models to install"
echo " --skip-deps Skip dependency installation"
echo " --quiet Minimal output"
echo " --github Use GitHub instead of GITEA"
echo " --gitea-url URL Custom GITEA URL (default: http://ironwood:3000)"
echo " --help Show this help"
echo ""
echo "Examples:"
echo " $0 --coordinator --models \"llama3.2,qwen2.5:7b\""
echo " $0 --github --models \"codellama:7b\""
echo " $0 --gitea-url \"https://git.mycompany.com\""
exit 0
;;
*)
echo "Unknown option: $1"
exit 1
;;
esac
done
# Logging functions
log_info() {
if [[ "$QUIET_MODE" != "true" ]]; then
echo -e "${GREEN}${NC} $1"
fi
}
log_warn() {
echo -e "${YELLOW}${NC} $1"
}
log_error() {
echo -e "${RED}${NC} $1"
}
log_step() {
if [[ "$QUIET_MODE" != "true" ]]; then
echo -e "${BLUE}${NC} $1"
fi
}
# System detection
detect_system() {
log_step "Detecting system..."
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
if command -v apt-get >/dev/null 2>&1; then
PACKAGE_MANAGER="apt"
INSTALL_CMD="sudo apt-get update && sudo apt-get install -y"
elif command -v yum >/dev/null 2>&1; then
PACKAGE_MANAGER="yum"
INSTALL_CMD="sudo yum install -y"
elif command -v pacman >/dev/null 2>&1; then
PACKAGE_MANAGER="pacman"
INSTALL_CMD="sudo pacman -S --noconfirm"
else
log_error "Unsupported Linux distribution"
exit 1
fi
elif [[ "$OSTYPE" == "darwin"* ]]; then
PACKAGE_MANAGER="brew"
INSTALL_CMD="brew install"
else
log_error "Unsupported operating system: $OSTYPE"
exit 1
fi
log_info "Detected system: $OSTYPE with $PACKAGE_MANAGER"
}
# Check prerequisites
check_prerequisites() {
log_step "Checking prerequisites..."
local missing_deps=()
# Check for required commands
for cmd in curl git jq; do
if ! command -v $cmd >/dev/null 2>&1; then
missing_deps+=($cmd)
fi
done
if [[ ${#missing_deps[@]} -gt 0 ]] && [[ "$SKIP_DEPENDENCIES" != "true" ]]; then
log_step "Installing missing dependencies: ${missing_deps[*]}"
case $PACKAGE_MANAGER in
apt)
$INSTALL_CMD ${missing_deps[*]}
;;
yum)
$INSTALL_CMD ${missing_deps[*]}
;;
pacman)
$INSTALL_CMD ${missing_deps[*]}
;;
brew)
brew install ${missing_deps[*]}
;;
esac
fi
log_info "Prerequisites satisfied"
}
# Detect GITEA instance
detect_gitea() {
log_step "Detecting local GITEA instance..."
# Try different common GITEA endpoints
local gitea_endpoints=(
"http://ironwood:3000"
"http://localhost:3000"
"http://gitea.deepblack.cloud"
"https://gitea.deepblack.cloud"
)
for endpoint in "${gitea_endpoints[@]}"; do
if curl -s --connect-timeout 5 "$endpoint/api/v1/version" >/dev/null 2>&1; then
REPO_BASE_URL="$endpoint"
log_info "Found GITEA instance at: $endpoint"
return 0
fi
done
log_warn "No GITEA instance detected, will use configured URL: $REPO_BASE_URL"
return 1
}
# Setup repository credentials
setup_repo_credentials() {
log_step "Setting up repository credentials..."
# Create secrets directory
mkdir -p "$CHORUS_HOME/business/secrets"
if [[ "$REPO_PROVIDER" == "gitea" ]]; then
# Check if GITEA token exists
if [[ ! -f "$REPO_TOKEN_FILE" ]]; then
echo ""
echo -e "${CYAN}GITEA Authentication Setup${NC}"
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
echo "To configure repository integration, BZZZ needs a GITEA access token."
echo ""
echo "Please create a token at: $REPO_BASE_URL/user/settings/applications"
echo "Required permissions: read:repository, write:issue"
echo ""
read -s -p "Enter your GITEA access token: " gitea_token
echo ""
if [[ -n "$gitea_token" ]]; then
echo "$gitea_token" > "$REPO_TOKEN_FILE"
chmod 600 "$REPO_TOKEN_FILE"
log_info "GITEA token saved"
else
log_warn "No token provided - repository integration will be disabled"
return 1
fi
else
log_info "GITEA token already exists"
fi
else
# GitHub setup
local github_token_file="$CHORUS_HOME/business/secrets/gh-token"
if [[ ! -f "$github_token_file" ]]; then
echo ""
echo -e "${CYAN}GitHub Authentication Setup${NC}"
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
echo "To configure repository integration, BZZZ needs a GitHub access token."
echo ""
echo "Please create a token at: https://github.com/settings/tokens"
echo "Required permissions: repo, read:org"
echo ""
read -s -p "Enter your GitHub access token: " github_token
echo ""
if [[ -n "$github_token" ]]; then
echo "$github_token" > "$github_token_file"
chmod 600 "$github_token_file"
log_info "GitHub token saved"
REPO_TOKEN_FILE="$github_token_file"
else
log_warn "No token provided - repository integration will be disabled"
return 1
fi
else
log_info "GitHub token already exists"
REPO_TOKEN_FILE="$github_token_file"
fi
fi
return 0
}
# Configure repository integration
configure_repositories() {
log_step "Configuring repository integration..."
echo ""
echo -e "${CYAN}Repository Configuration${NC}"
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
if [[ "$REPO_PROVIDER" == "gitea" ]]; then
echo "Provider: GITEA"
echo "Base URL: $REPO_BASE_URL"
read -p "Repository owner [$REPO_OWNER]: " repo_owner_input
repo_owner_input=${repo_owner_input:-$REPO_OWNER}
REPO_OWNER="$repo_owner_input"
read -p "Repository name [$REPO_NAME]: " repo_name_input
repo_name_input=${repo_name_input:-$REPO_NAME}
REPO_NAME="$repo_name_input"
else
echo "Provider: GitHub"
echo "Base URL: https://api.github.com"
read -p "Repository owner: " repo_owner_input
REPO_OWNER="$repo_owner_input"
read -p "Repository name: " repo_name_input
REPO_NAME="$repo_name_input"
fi
# Test repository access
if test_repository_access; then
log_info "Repository access verified: $REPO_OWNER/$REPO_NAME"
else
log_warn "Could not verify repository access - will continue with configuration"
fi
return 0
}
# Test repository access
test_repository_access() {
if [[ ! -f "$REPO_TOKEN_FILE" ]]; then
return 1
fi
local token=$(cat "$REPO_TOKEN_FILE" | tr -d '\n')
if [[ "$REPO_PROVIDER" == "gitea" ]]; then
local api_url="$REPO_BASE_URL/api/v1/repos/$REPO_OWNER/$REPO_NAME"
if curl -s -H "Authorization: token $token" "$api_url" >/dev/null 2>&1; then
return 0
fi
else
local api_url="https://api.github.com/repos/$REPO_OWNER/$REPO_NAME"
if curl -s -H "Authorization: token $token" "$api_url" >/dev/null 2>&1; then
return 0
fi
fi
return 1
}
# Install Ollama
install_ollama() {
if command -v ollama >/dev/null 2>&1; then
log_info "Ollama already installed"
return
fi
log_step "Installing Ollama..."
curl -fsSL https://ollama.com/install.sh | sh
# Start Ollama service
sudo systemctl enable ollama || true
sudo systemctl start ollama || true
log_info "Ollama installed and started"
}
# Setup CHORUS directory structure
setup_chorus_structure() {
log_step "Setting up CHORUS directory structure..."
mkdir -p "$CHORUS_HOME"/{docs,business/secrets,project-queues/active}
mkdir -p "$HOME/.chorus"/{logs,config,cache}
log_info "Directory structure created"
}
# Download CHORUS binaries
download_binaries() {
log_step "Downloading CHORUS binaries..."
# Create BZZZ directory structure
mkdir -p "$BZZZ_DIR"/{config,logs}
cd "$BZZZ_DIR"
# Detect system architecture
local arch=""
case $(uname -m) in
x86_64) arch="amd64" ;;
aarch64|arm64) arch="arm64" ;;
armv7l) arch="armv7" ;;
*)
log_error "Unsupported architecture: $(uname -m)"
exit 1
;;
esac
local os="linux"
if [[ "$OSTYPE" == "darwin"* ]]; then
os="darwin"
fi
# Download BZZZ binary
local bzzz_url="https://chorus.services/releases/bzzz/latest/bzzz-${os}-${arch}"
log_step "Downloading BZZZ binary for ${os}-${arch}..."
if curl -fsSL -o bzzz "$bzzz_url"; then
chmod +x bzzz
log_info "BZZZ binary downloaded successfully"
else
log_error "Failed to download BZZZ binary from $bzzz_url"
log_info "Falling back to minimal installation..."
# Create a placeholder binary that will be updated later
echo '#!/bin/bash' > bzzz
echo 'echo "BZZZ binary not available for this platform"' >> bzzz
chmod +x bzzz
fi
# Download systemd service file
local service_url="https://chorus.services/releases/bzzz/latest/bzzz.service"
if curl -fsSL -o bzzz.service "$service_url"; then
log_info "BZZZ service file downloaded"
else
log_warn "Failed to download service file, creating default..."
create_default_service_file
fi
# Download install script
local install_script_url="https://chorus.services/releases/bzzz/latest/install-service.sh"
if curl -fsSL -o install-service.sh "$install_script_url"; then
chmod +x install-service.sh
log_info "Install script downloaded"
else
log_warn "Failed to download install script, creating default..."
create_default_install_script
fi
log_info "Binary downloads completed"
}
# Create default service file
create_default_service_file() {
cat > bzzz.service << 'EOF'
[Unit]
Description=BZZZ P2P Task Coordination System
Documentation=https://chorus.services/docs/bzzz
After=network.target
Wants=network.target
[Service]
Type=simple
User=PLACEHOLDER_USER
Group=PLACEHOLDER_USER
WorkingDirectory=PLACEHOLDER_BZZZ_DIR
ExecStart=PLACEHOLDER_BZZZ_DIR/bzzz --config PLACEHOLDER_BZZZ_DIR/config/bzzz.yaml
Restart=always
RestartSec=10
KillMode=mixed
KillSignal=SIGTERM
TimeoutStopSec=30
# Environment variables
Environment=HOME=PLACEHOLDER_HOME
Environment=USER=PLACEHOLDER_USER
# Logging
StandardOutput=journal
StandardError=journal
SyslogIdentifier=bzzz
# Security settings
NoNewPrivileges=true
PrivateTmp=true
ProtectSystem=strict
ProtectHome=false
ReadWritePaths=PLACEHOLDER_BZZZ_DIR
# Resource limits
LimitNOFILE=65536
LimitNPROC=4096
[Install]
WantedBy=multi-user.target
EOF
# Replace placeholders
sed -i "s|PLACEHOLDER_USER|$USER|g" bzzz.service
sed -i "s|PLACEHOLDER_HOME|$HOME|g" bzzz.service
sed -i "s|PLACEHOLDER_BZZZ_DIR|$BZZZ_DIR|g" bzzz.service
log_info "Default service file created"
}
# Create default install script
create_default_install_script() {
cat > install-service.sh << 'EOF'
#!/bin/bash
# BZZZ Service Installation Script
# Installs BZZZ as a systemd service
set -e
echo "🐝 Installing BZZZ P2P Task Coordination Service..."
# Check if running as root or with sudo
if [ "$EUID" -ne 0 ]; then
echo "❌ This script must be run as root or with sudo"
exit 1
fi
# Define paths
BZZZ_DIR="$(pwd)"
SERVICE_FILE="$BZZZ_DIR/bzzz.service"
SYSTEMD_DIR="/etc/systemd/system"
# Check if BZZZ binary exists
if [ ! -f "$BZZZ_DIR/bzzz" ]; then
echo "❌ BZZZ binary not found at $BZZZ_DIR/bzzz"
exit 1
fi
# Make binary executable
chmod +x "$BZZZ_DIR/bzzz"
echo "✅ Made BZZZ binary executable"
# Copy service file to systemd directory
cp "$SERVICE_FILE" "$SYSTEMD_DIR/bzzz.service"
echo "✅ Copied service file to $SYSTEMD_DIR/bzzz.service"
# Set proper permissions
chmod 644 "$SYSTEMD_DIR/bzzz.service"
echo "✅ Set service file permissions"
# Reload systemd daemon
systemctl daemon-reload
echo "✅ Reloaded systemd daemon"
# Enable service to start on boot
systemctl enable bzzz.service
echo "✅ Enabled BZZZ service for auto-start"
# Start the service
systemctl start bzzz.service
echo "✅ Started BZZZ service"
echo ""
echo "🎉 BZZZ P2P Task Coordination Service installed successfully!"
EOF
chmod +x install-service.sh
log_info "Default install script created"
}
# Configure BZZZ with repository integration
configure_bzzz() {
log_step "Configuring BZZZ with repository integration..."
# Interactive configuration
echo ""
echo -e "${CYAN}BZZZ Node Configuration${NC}"
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━"
read -p "Node hostname [$(hostname)]: " node_hostname
node_hostname=${node_hostname:-$(hostname)}
read -p "Node role [worker]: " node_role
node_role=${node_role:-worker}
if [[ "$IS_COORDINATOR" == "true" ]]; then
node_role="coordinator"
echo "Setting role to coordinator (--coordinator flag provided)"
fi
read -p "API port [8080]: " api_port
api_port=${api_port:-8080}
read -p "Health port [8081]: " health_port
health_port=${health_port:-8081}
read -p "P2P port [4001]: " p2p_port
p2p_port=${p2p_port:-4001}
# Generate YAML configuration with repository integration
cat > "$BZZZ_DIR/config/bzzz.yaml" << EOF
# BZZZ Configuration - Auto-generated by CHORUS installer
node:
id: "$node_hostname"
role: "$node_role"
# API Configuration
api:
host: "0.0.0.0"
port: $api_port
# Health Monitoring
health:
port: $health_port
enabled: true
# P2P Networking
p2p:
port: $p2p_port
discovery:
enabled: true
bootstrap_nodes: []
service_tag: "bzzz-peer-discovery"
topics:
bzzz: "bzzz/coordination/v1"
hmmm: "hmmm/meta-discussion/v1"
# Agent Configuration
agent:
id: "$node_hostname-agent"
capabilities: ["general", "reasoning", "task-coordination"]
poll_interval: "30s"
max_tasks: 3
specialization: "general_developer"
role: "Full Stack Engineer"
expertise: ["golang", "typescript", "docker", "kubernetes"]
# Repository Configuration
repository:
provider: "$REPO_PROVIDER"
config:
base_url: "$REPO_BASE_URL"
owner: "$REPO_OWNER"
repository: "$REPO_NAME"
task_label: "bzzz-task"
in_progress_label: "bzzz-working"
completed_label: "bzzz-completed"
priority_label: "bzzz-priority"
assignee: "$USER"
base_branch: "main"
branch_prefix: "bzzz/task-"
EOF
# Add token file path if it exists
if [[ -f "$REPO_TOKEN_FILE" ]]; then
cat >> "$BZZZ_DIR/config/bzzz.yaml" << EOF
token_file: "$REPO_TOKEN_FILE"
EOF
fi
# Continue with rest of configuration
cat >> "$BZZZ_DIR/config/bzzz.yaml" << EOF
# GitHub/GITEA Integration (Legacy support)
github:
token_file: "$REPO_TOKEN_FILE"
user_agent: "BZZZ-P2P-Agent/2.0"
timeout: "30s"
rate_limit: true
assignee: "$USER"
# Logging Configuration
logging:
level: "info"
format: "text"
output: "stdout"
structured: false
file: "$HOME/.chorus/logs/bzzz.log"
# Storage Configuration
storage:
path: "$HOME/.chorus/data"
type: "filesystem"
# Coordinator Settings
coordinator: $([ "$IS_COORDINATOR" == "true" ] && echo "true" || echo "false")
# SLURP Configuration (AI Intelligence System)
slurp:
enabled: true
base_url: "http://localhost:8082"
intelligence:
enabled: true
context_window: 4096
reasoning_depth: 3
storage:
type: "filesystem"
directory: "$HOME/.chorus/slurp-storage"
# Security Configuration
security:
admin_key_shares:
threshold: 3
total_shares: 5
election_config:
heartbeat_timeout: "5s"
discovery_timeout: "30s"
election_timeout: "15s"
minimum_quorum: 3
key_rotation_days: 90
audit_logging: true
audit_path: "$HOME/.chorus/security-audit.log"
# UCXL Protocol (Unified Content Exchange Layer)
ucxl:
enabled: false
server:
port: 8081
base_path: "/bzzz"
enabled: true
# V2 Protocol Features
v2:
enabled: false
protocol_version: "2.0.0"
dht:
enabled: false
mode: "auto"
protocol_prefix: "/bzzz"
auto_bootstrap: false
EOF
log_info "BZZZ configured with repository integration"
# Display configuration summary
echo ""
echo -e "${WHITE}Configuration Summary:${NC}"
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━"
echo " Node: $node_hostname ($node_role)"
echo " API: http://localhost:$api_port"
echo " Health: http://localhost:$health_port/health"
echo " Repository: $REPO_PROVIDER - $REPO_OWNER/$REPO_NAME"
echo " Config: $BZZZ_DIR/config/bzzz.yaml"
echo ""
}
# Install BZZZ service
install_bzzz_service() {
log_step "Installing BZZZ as systemd service..."
cd "$BZZZ_DIR"
# Check if BZZZ binary exists
if [[ ! -f "bzzz" ]]; then
log_error "BZZZ binary not found - cannot install service"
return 1
fi
# Check if install script exists
if [[ ! -f "install-service.sh" ]]; then
log_error "install-service.sh not found - cannot install service"
return 1
fi
# Make sure install script is executable
chmod +x install-service.sh
# Install the service
if sudo ./install-service.sh; then
log_info "BZZZ service installed and started"
return 0
else
log_error "Failed to install BZZZ service"
return 1
fi
}
# Install AI models
install_models() {
if [[ -z "$INSTALL_MODELS" ]]; then
return
fi
log_step "Installing AI models..."
IFS=',' read -ra MODELS <<< "$INSTALL_MODELS"
for model in "${MODELS[@]}"; do
model=$(echo "$model" | xargs) # trim whitespace
log_step "Pulling model: $model"
ollama pull "$model"
log_info "Model $model installed"
done
}
# Setup coordinator-specific components
setup_coordinator() {
if [[ "$IS_COORDINATOR" != "true" ]]; then
return
fi
log_step "Setting up coordinator components..."
# Install Docker for WHOOSH
if ! command -v docker >/dev/null 2>&1; then
curl -fsSL https://get.docker.com | sh
sudo usermod -aG docker "$USER"
log_info "Docker installed"
fi
# Generate Age encryption keys
if ! command -v age >/dev/null 2>&1; then
# Install age
wget -O /tmp/age.tar.gz https://github.com/FiloSottile/age/releases/download/v1.1.1/age-v1.1.1-linux-amd64.tar.gz
tar -xzf /tmp/age.tar.gz -C /tmp
sudo cp /tmp/age/age* /usr/local/bin/
sudo chmod +x /usr/local/bin/age*
rm -rf /tmp/age*
fi
# Generate keys
mkdir -p "$CHORUS_HOME/business/secrets"
age-keygen -o "$CHORUS_HOME/business/secrets/age-key.txt"
log_info "Coordinator setup completed"
}
# Verify installation
verify_installation() {
log_step "Verifying installation..."
local issues=()
# Check BZZZ service
if ! systemctl is-active bzzz >/dev/null 2>&1; then
issues+=("BZZZ service not running")
fi
# Check configuration file
if [[ ! -f "$BZZZ_DIR/config/bzzz.yaml" ]]; then
issues+=("BZZZ configuration missing")
fi
# Check repository access
if [[ -f "$REPO_TOKEN_FILE" ]] && ! test_repository_access; then
issues+=("Repository access verification failed")
fi
# Check Ollama
if ! systemctl is-active ollama >/dev/null 2>&1; then
issues+=("Ollama service not running")
fi
if [[ ${#issues[@]} -eq 0 ]]; then
log_info "Installation verification passed"
return 0
else
log_warn "Installation issues detected:"
for issue in "${issues[@]}"; do
echo "$issue"
done
return 1
fi
}
# Show completion message
show_completion() {
echo ""
echo -e "${GREEN}🎉 CHORUS Installation Complete!${NC}"
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
echo ""
echo -e "${WHITE}Services Status:${NC}"
local bzzz_status=$(systemctl is-active bzzz 2>/dev/null || echo 'inactive')
echo " • BZZZ Agent: $bzzz_status"
echo " • Ollama: $(systemctl is-active ollama 2>/dev/null || echo 'inactive')"
echo " • Repository: $REPO_PROVIDER ($REPO_OWNER/$REPO_NAME)"
if [[ "$bzzz_status" == "active" ]]; then
echo ""
echo -e "${WHITE}API Endpoints:${NC}"
echo " • Health: http://localhost:8081/health"
echo " • API: http://localhost:8080"
echo " • Metrics: http://localhost:8081/metrics"
else
echo ""
echo -e "${YELLOW}⚠ BZZZ Service Issues:${NC}"
echo " The BZZZ service may not be running."
echo " This could be due to configuration or binary compatibility issues."
echo ""
echo -e "${WHITE}Troubleshooting:${NC}"
echo " 1. Check logs: sudo journalctl -u bzzz -f"
echo " 2. Test binary: $BZZZ_DIR/bzzz --version"
echo " 3. Restart service: sudo systemctl restart bzzz"
echo " 4. Check config: $BZZZ_DIR/config/bzzz.yaml"
fi
echo ""
echo -e "${WHITE}Useful Commands:${NC}"
echo " sudo systemctl status bzzz - Check BZZZ status"
echo " sudo journalctl -u bzzz -f - Follow BZZZ logs"
echo " ollama list - List installed models"
echo " curl http://localhost:8081/health - Test BZZZ health"
echo ""
if [[ "$IS_COORDINATOR" == "true" ]]; then
echo -e "${WHITE}Coordinator Setup:${NC}"
echo " • Age encryption keys: $CHORUS_HOME/business/secrets/age-key.txt"
echo " • Repository integration: $REPO_PROVIDER"
echo ""
fi
echo -e "${WHITE}Repository Integration:${NC}"
echo " • Provider: $REPO_PROVIDER"
echo " • Repository: $REPO_OWNER/$REPO_NAME"
echo " • Token file: $REPO_TOKEN_FILE"
echo " • Task label: bzzz-task"
echo ""
echo -e "${WHITE}Documentation:${NC}"
echo " • CHORUS Docs: $CHORUS_HOME/docs/"
echo " • BZZZ Config: $BZZZ_DIR/config/bzzz.yaml"
echo ""
echo -e "${CYAN}Next Steps:${NC}"
echo " 1. Create an issue in $REPO_OWNER/$REPO_NAME with label 'bzzz-task'"
echo " 2. BZZZ will automatically detect and claim the task"
echo " 3. Monitor progress: sudo journalctl -u bzzz -f"
if [[ "$IS_COORDINATOR" == "true" ]]; then
echo " 4. Add worker nodes by running this script on other machines"
echo " 5. Monitor cluster: curl http://localhost:8081/health"
fi
echo ""
}
# Error handling
cleanup_on_error() {
log_error "Installation failed. Cleaning up..."
# Cleanup logic here
exit 1
}
# Main installation flow
main() {
print_banner
echo -e "${WHITE}Starting CHORUS installation with repository integration...${NC}"
echo ""
detect_system
check_prerequisites
if [[ "$REPO_PROVIDER" == "gitea" ]]; then
detect_gitea
fi
setup_chorus_structure
setup_repo_credentials
configure_repositories
install_ollama
download_binaries
configure_bzzz
install_bzzz_service
install_models
setup_coordinator
verify_installation
show_completion
}
# Run main installation
main "$@"