Compare commits
7 Commits
bzzz-slurp
...
chorus-bra
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
59f40e17a5 | ||
|
|
c2dfaba4a6 | ||
|
|
82036bdd5a | ||
|
|
c177363a19 | ||
|
|
6a6a49b7b1 | ||
|
|
baac16d372 | ||
|
|
d96c931a29 |
44
.gitignore
vendored
44
.gitignore
vendored
@@ -53,3 +53,47 @@ old-docs/
|
||||
# Test artifacts
|
||||
test/bzzz-*
|
||||
test/*.sh
|
||||
|
||||
# Node.js and npm
|
||||
node_modules/
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
.npm
|
||||
.yarn-integrity
|
||||
package-lock.json.bak
|
||||
|
||||
# Next.js build artifacts
|
||||
.next/
|
||||
out/
|
||||
.vercel/
|
||||
.turbo/
|
||||
|
||||
# Build and cache directories
|
||||
dist/
|
||||
build/
|
||||
*.tsbuildinfo
|
||||
.cache/
|
||||
|
||||
# Environment files
|
||||
.env
|
||||
.env.local
|
||||
.env.development.local
|
||||
.env.test.local
|
||||
.env.production.local
|
||||
|
||||
# Runtime files
|
||||
*.pid
|
||||
*.pid.lock
|
||||
|
||||
# Coverage and testing
|
||||
coverage/
|
||||
.nyc_output/
|
||||
.jest/
|
||||
|
||||
# Generated web assets (embedded files)
|
||||
pkg/web/*.html
|
||||
pkg/web/*.txt
|
||||
pkg/web/assets/
|
||||
pkg/web/_next/
|
||||
pkg/web/404/
|
||||
|
||||
115
Makefile
Normal file
115
Makefile
Normal file
@@ -0,0 +1,115 @@
|
||||
# BZZZ Build System with Embedded Web UI
|
||||
.PHONY: build build-ui build-go clean dev setup install deps test
|
||||
|
||||
# Configuration
|
||||
UI_DIR = install/config-ui
|
||||
BUILD_DIR = build
|
||||
DIST_DIR = $(UI_DIR)/dist
|
||||
EMBED_DIR = pkg/web
|
||||
|
||||
# Default target
|
||||
all: build
|
||||
|
||||
# Install dependencies
|
||||
deps:
|
||||
@echo "📦 Installing Go dependencies..."
|
||||
go mod download
|
||||
go mod tidy
|
||||
@echo "📦 Installing Node.js dependencies..."
|
||||
cd $(UI_DIR) && npm install
|
||||
|
||||
# Development mode - run both Go and React in development
|
||||
dev:
|
||||
@echo "🚀 Starting development mode..."
|
||||
@echo " Go API: http://localhost:8080"
|
||||
@echo " React UI: http://localhost:3000"
|
||||
cd $(UI_DIR) && npm run dev &
|
||||
go run main.go
|
||||
|
||||
# Build the complete application
|
||||
build: build-ui embed-ui build-go
|
||||
|
||||
# Build the React web UI
|
||||
build-ui:
|
||||
@echo "🔨 Building React web UI..."
|
||||
@mkdir -p $(BUILD_DIR)
|
||||
cd $(UI_DIR) && npm ci
|
||||
cd $(UI_DIR) && npm run build
|
||||
@echo "✅ Web UI built successfully"
|
||||
|
||||
# Embed the web UI into Go source
|
||||
embed-ui: build-ui
|
||||
@echo "📦 Embedding web UI into Go binary..."
|
||||
@mkdir -p $(EMBED_DIR)
|
||||
@cp -r $(UI_DIR)/out/* $(EMBED_DIR)/ 2>/dev/null || cp -r $(UI_DIR)/.next/static $(EMBED_DIR)/ 2>/dev/null || true
|
||||
@echo "✅ Web UI embedded successfully"
|
||||
|
||||
# Build the Go binary with embedded UI
|
||||
build-go:
|
||||
@echo "🔨 Building Go binary with embedded web UI..."
|
||||
@mkdir -p $(BUILD_DIR)
|
||||
CGO_ENABLED=0 go build -ldflags="-s -w" -o $(BUILD_DIR)/bzzz .
|
||||
@echo "✅ BZZZ binary built successfully: $(BUILD_DIR)/bzzz"
|
||||
|
||||
# Setup development environment
|
||||
setup: deps
|
||||
@echo "🔧 Setting up development environment..."
|
||||
@mkdir -p $(BUILD_DIR)
|
||||
@mkdir -p $(EMBED_DIR)
|
||||
@echo "✅ Development environment ready"
|
||||
|
||||
# Install BZZZ system-wide
|
||||
install: build
|
||||
@echo "📥 Installing BZZZ..."
|
||||
sudo cp $(BUILD_DIR)/bzzz /usr/local/bin/
|
||||
sudo chmod +x /usr/local/bin/bzzz
|
||||
@echo "✅ BZZZ installed to /usr/local/bin/bzzz"
|
||||
|
||||
# Run tests
|
||||
test:
|
||||
@echo "🧪 Running tests..."
|
||||
go test -v ./...
|
||||
|
||||
# Clean build artifacts
|
||||
clean:
|
||||
@echo "🧹 Cleaning build artifacts..."
|
||||
rm -rf $(BUILD_DIR)
|
||||
rm -rf $(EMBED_DIR)
|
||||
rm -rf $(UI_DIR)/node_modules
|
||||
rm -rf $(UI_DIR)/.next
|
||||
rm -rf $(UI_DIR)/out
|
||||
rm -rf $(UI_DIR)/dist
|
||||
@echo "✅ Clean complete"
|
||||
|
||||
# Quick build for development (skip UI rebuild if not changed)
|
||||
quick-build:
|
||||
@echo "⚡ Quick build (Go only)..."
|
||||
@mkdir -p $(BUILD_DIR)
|
||||
go build -o $(BUILD_DIR)/bzzz .
|
||||
@echo "✅ Quick build complete"
|
||||
|
||||
# Docker build
|
||||
docker-build:
|
||||
@echo "🐳 Building Docker image..."
|
||||
docker build -t bzzz:latest .
|
||||
@echo "✅ Docker image built"
|
||||
|
||||
# Help
|
||||
help:
|
||||
@echo "BZZZ Build System"
|
||||
@echo ""
|
||||
@echo "Available targets:"
|
||||
@echo " all - Build complete application (default)"
|
||||
@echo " build - Build complete application with embedded UI"
|
||||
@echo " build-ui - Build React web UI only"
|
||||
@echo " build-go - Build Go binary only"
|
||||
@echo " embed-ui - Embed web UI into Go source"
|
||||
@echo " dev - Start development mode"
|
||||
@echo " setup - Setup development environment"
|
||||
@echo " deps - Install dependencies"
|
||||
@echo " install - Install BZZZ system-wide"
|
||||
@echo " test - Run tests"
|
||||
@echo " clean - Clean build artifacts"
|
||||
@echo " quick-build - Quick Go-only build"
|
||||
@echo " docker-build- Build Docker image"
|
||||
@echo " help - Show this help"
|
||||
191
PORT_ASSIGNMENTS.md
Normal file
191
PORT_ASSIGNMENTS.md
Normal file
@@ -0,0 +1,191 @@
|
||||
# BZZZ Port Assignments
|
||||
|
||||
## Overview
|
||||
|
||||
BZZZ uses multiple ports for different services and operational modes. This document provides the official port assignments to avoid conflicts.
|
||||
|
||||
## Port Allocation
|
||||
|
||||
### Core BZZZ Services
|
||||
|
||||
| Port | Service | Mode | Description |
|
||||
|------|---------|------|-------------|
|
||||
| **8080** | Main HTTP API | Normal Operation | Primary BZZZ HTTP server with API endpoints |
|
||||
| **8081** | Health & Metrics | Normal Operation | Health checks, metrics, and monitoring |
|
||||
| **8090** | Setup Web UI | Setup Mode Only | Web-based configuration wizard |
|
||||
| **4001** | P2P Network | Normal Operation | libp2p networking and peer communication |
|
||||
|
||||
### Additional Services
|
||||
|
||||
| Port | Service | Context | Description |
|
||||
|------|---------|---------|-------------|
|
||||
| **3000** | MCP Server | Development | Model Context Protocol server |
|
||||
| **11434** | Ollama | AI Models | Local AI model runtime (if installed) |
|
||||
|
||||
## Port Usage by Mode
|
||||
|
||||
### Setup Mode (No Configuration)
|
||||
- **8090**: Web configuration interface
|
||||
- Accessible at `http://localhost:8090`
|
||||
- Serves embedded React setup wizard
|
||||
- API endpoints at `/api/setup/*`
|
||||
- Auto-redirects to setup flow
|
||||
|
||||
### Normal Operation Mode (Configured)
|
||||
- **8080**: Main HTTP API server
|
||||
- Health check: `http://localhost:8080/api/health`
|
||||
- Status endpoint: `http://localhost:8080/api/status`
|
||||
- Hypercore logs: `http://localhost:8080/api/hypercore/*`
|
||||
- **8081**: Health and metrics server
|
||||
- Health endpoint: `http://localhost:8081/health`
|
||||
- Metrics endpoint: `http://localhost:8081/metrics`
|
||||
- **4001**: P2P networking (libp2p)
|
||||
|
||||
## Port Selection Rationale
|
||||
|
||||
### 8090 for Setup UI
|
||||
- **Chosen**: Port 8090 for setup web interface
|
||||
- **Reasoning**:
|
||||
- Avoids conflict with normal BZZZ operation (8080)
|
||||
- Not in common use on development systems
|
||||
- Sequential and memorable (8090 = setup, 8080 = normal)
|
||||
- Outside common service ranges (3000-3999, 8000-8099)
|
||||
|
||||
### Port Conflict Avoidance
|
||||
Current system analysis shows these ports are already in use:
|
||||
- 8080: Main BZZZ API (normal mode)
|
||||
- 8081: Health/metrics server
|
||||
- 8088: Other system service
|
||||
- 3333: System service
|
||||
- 3051: AnythingLLM
|
||||
- 3030: System service
|
||||
|
||||
Port 8090 is confirmed available and reserved for BZZZ setup mode.
|
||||
|
||||
## Configuration Examples
|
||||
|
||||
### Enhanced Installer Configuration
|
||||
```yaml
|
||||
# Generated by install-chorus-enhanced.sh
|
||||
api:
|
||||
host: "0.0.0.0"
|
||||
port: 8080
|
||||
|
||||
health:
|
||||
port: 8081
|
||||
enabled: true
|
||||
|
||||
p2p:
|
||||
port: 4001
|
||||
discovery:
|
||||
enabled: true
|
||||
```
|
||||
|
||||
### Web UI Access URLs
|
||||
|
||||
#### Setup Mode
|
||||
```bash
|
||||
# When no configuration exists
|
||||
http://localhost:8090 # Setup wizard home
|
||||
http://localhost:8090/setup/ # Setup flow
|
||||
http://localhost:8090/api/health # Setup health check
|
||||
```
|
||||
|
||||
#### Normal Mode
|
||||
```bash
|
||||
# After configuration is complete
|
||||
http://localhost:8080/api/health # Main health check
|
||||
http://localhost:8080/api/status # BZZZ status
|
||||
http://localhost:8081/health # Dedicated health service
|
||||
http://localhost:8081/metrics # Prometheus metrics
|
||||
```
|
||||
|
||||
## Network Security Considerations
|
||||
|
||||
### Firewall Rules
|
||||
```bash
|
||||
# Allow BZZZ setup (temporary, during configuration)
|
||||
sudo ufw allow 8090/tcp comment "BZZZ Setup UI"
|
||||
|
||||
# Allow BZZZ normal operation
|
||||
sudo ufw allow 8080/tcp comment "BZZZ HTTP API"
|
||||
sudo ufw allow 8081/tcp comment "BZZZ Health/Metrics"
|
||||
sudo ufw allow 4001/tcp comment "BZZZ P2P Network"
|
||||
```
|
||||
|
||||
### Production Deployment
|
||||
- Setup port (8090) should be blocked after configuration
|
||||
- Main API (8080) should be accessible to cluster nodes
|
||||
- P2P port (4001) must be open for cluster communication
|
||||
- Health port (8081) should be accessible to monitoring systems
|
||||
|
||||
## Integration with Existing Systems
|
||||
|
||||
### CHORUS Cluster Integration
|
||||
```bash
|
||||
# Standard CHORUS deployment ports
|
||||
# BZZZ: 8080 (main), 8081 (health), 4001 (p2p)
|
||||
# WHOOSH: 3001 (web interface)
|
||||
# Ollama: 11434 (AI models)
|
||||
# GITEA: 3000 (repository)
|
||||
```
|
||||
|
||||
### Docker Swarm Deployment
|
||||
```yaml
|
||||
# docker-compose.swarm.yml
|
||||
services:
|
||||
bzzz:
|
||||
ports:
|
||||
- "8080:8080" # Main API
|
||||
- "8081:8081" # Health/Metrics
|
||||
- "4001:4001" # P2P Network
|
||||
# Setup port (8090) not exposed in production
|
||||
```
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
### Port Conflicts
|
||||
```bash
|
||||
# Check if ports are available
|
||||
netstat -tuln | grep -E ':(8080|8081|8090|4001)'
|
||||
|
||||
# Find process using a port
|
||||
lsof -i :8090
|
||||
|
||||
# Kill process if needed
|
||||
sudo kill $(lsof -t -i:8090)
|
||||
```
|
||||
|
||||
### Service Validation
|
||||
```bash
|
||||
# Test setup mode availability
|
||||
curl -s http://localhost:8090/api/health
|
||||
|
||||
# Test normal mode availability
|
||||
curl -s http://localhost:8080/api/health
|
||||
|
||||
# Test P2P port (should show connection refused when working)
|
||||
telnet localhost 4001
|
||||
```
|
||||
|
||||
## Migration Notes
|
||||
|
||||
### From Previous Versions
|
||||
- Old setup configurations using port 8082 will automatically migrate to 8090
|
||||
- Integration tests updated to use new port assignments
|
||||
- Documentation updated across all references
|
||||
|
||||
### Backward Compatibility
|
||||
- Enhanced installer script generates correct port assignments
|
||||
- Existing configurations continue to work
|
||||
- New installations use documented port scheme
|
||||
|
||||
## Summary
|
||||
|
||||
**BZZZ Port Assignments:**
|
||||
- **8090**: Setup Web UI (temporary, configuration mode only)
|
||||
- **8080**: Main HTTP API (normal operation)
|
||||
- **8081**: Health & Metrics (normal operation)
|
||||
- **4001**: P2P Network (cluster communication)
|
||||
|
||||
This allocation ensures no conflicts with existing services while providing clear separation between setup and operational modes.
|
||||
188
SETUP_INTEGRATION_COMPLETE.md
Normal file
188
SETUP_INTEGRATION_COMPLETE.md
Normal file
@@ -0,0 +1,188 @@
|
||||
# BZZZ Web Configuration Setup Integration - COMPLETE
|
||||
|
||||
## 🎉 Integration Summary
|
||||
|
||||
The complete integration between the BZZZ backend API and frontend components has been successfully implemented, creating a fully working web-based configuration system.
|
||||
|
||||
## ✅ Completed Features
|
||||
|
||||
### 1. **Embedded Web UI System**
|
||||
- ✅ Go binary with embedded React application
|
||||
- ✅ Automatic file serving and routing
|
||||
- ✅ Production-ready static file embedding
|
||||
- ✅ Fallback HTML page for development
|
||||
|
||||
### 2. **Intelligent Startup Logic**
|
||||
- ✅ Automatic setup detection on startup
|
||||
- ✅ Configuration validation and requirements checking
|
||||
- ✅ Seamless transition between setup and normal modes
|
||||
- ✅ Environment-specific configuration paths
|
||||
|
||||
### 3. **Complete Build Process**
|
||||
- ✅ Automated Makefile with UI compilation
|
||||
- ✅ Next.js static export for embedding
|
||||
- ✅ Go binary compilation with embedded assets
|
||||
- ✅ Development and production build targets
|
||||
|
||||
### 4. **Full API Integration**
|
||||
- ✅ Setup-specific API endpoints
|
||||
- ✅ Configuration validation and saving
|
||||
- ✅ System detection and analysis
|
||||
- ✅ Repository provider integration
|
||||
- ✅ Health monitoring and status reporting
|
||||
|
||||
### 5. **Configuration Management**
|
||||
- ✅ Setup requirement detection
|
||||
- ✅ Configuration file validation
|
||||
- ✅ Automatic backup and migration
|
||||
- ✅ Error handling and recovery
|
||||
|
||||
### 6. **Testing and Validation**
|
||||
- ✅ Comprehensive integration test suite
|
||||
- ✅ Setup flow validation
|
||||
- ✅ API endpoint testing
|
||||
- ✅ Configuration transition testing
|
||||
|
||||
## 🚀 Key Implementation Files
|
||||
|
||||
### Core Integration Files
|
||||
- **`/main.go`** - Startup logic and setup mode detection
|
||||
- **`/pkg/web/embed.go`** - Embedded file system for web UI
|
||||
- **`/pkg/config/config.go`** - Configuration validation and management
|
||||
- **`/api/http_server.go`** - Web UI serving and API integration
|
||||
|
||||
### Build System
|
||||
- **`/Makefile`** - Complete build automation
|
||||
- **`/install/config-ui/next.config.js`** - Web UI build configuration
|
||||
|
||||
### Documentation and Tools
|
||||
- **`/install/SETUP_INTEGRATION_GUIDE.md`** - Complete usage guide
|
||||
- **`/scripts/setup-transition.sh`** - Setup helper script
|
||||
- **`/test-setup-integration.sh`** - Integration test suite
|
||||
|
||||
## 🔧 How It Works
|
||||
|
||||
### 1. **Startup Flow**
|
||||
```
|
||||
BZZZ Start → Config Check → Setup Mode OR Normal Mode
|
||||
↓ ↓
|
||||
Invalid/Missing Valid Config
|
||||
↓ ↓
|
||||
Web UI @ :8090 Full BZZZ @ :8080
|
||||
```
|
||||
|
||||
### 2. **Setup Mode Features**
|
||||
- **Automatic Detection**: No config or invalid config triggers setup
|
||||
- **Web Interface**: Embedded React app at `http://localhost:8090`
|
||||
- **API Endpoints**: Full setup API at `/api/setup/*`
|
||||
- **Configuration Saving**: Creates valid YAML configuration
|
||||
- **Restart Transition**: Automatic switch to normal mode
|
||||
|
||||
### 3. **Normal Mode Operation**
|
||||
- **Full BZZZ System**: P2P coordination, task management, DHT
|
||||
- **Production APIs**: Main HTTP server at `:8080`
|
||||
- **No Setup UI**: Web interface automatically disabled
|
||||
|
||||
## 🎯 Usage Examples
|
||||
|
||||
### First-Time Setup
|
||||
```bash
|
||||
# Build BZZZ with embedded UI
|
||||
make build
|
||||
|
||||
# Start BZZZ (enters setup mode automatically)
|
||||
./build/bzzz
|
||||
|
||||
# Open browser to http://localhost:8090
|
||||
# Complete setup wizard
|
||||
# Restart BZZZ for normal operation
|
||||
```
|
||||
|
||||
### Development Workflow
|
||||
```bash
|
||||
# Install dependencies
|
||||
make deps
|
||||
|
||||
# Development mode (React dev server + Go API)
|
||||
make dev
|
||||
|
||||
# Build for production
|
||||
make build
|
||||
|
||||
# Test integration
|
||||
./test-setup-integration.sh
|
||||
```
|
||||
|
||||
### Existing Installation
|
||||
```bash
|
||||
# Helper script for transition
|
||||
./scripts/setup-transition.sh
|
||||
|
||||
# BZZZ automatically uses existing config if valid
|
||||
# Or enters setup mode if configuration is invalid
|
||||
```
|
||||
|
||||
## 🧪 Test Results
|
||||
|
||||
**All integration tests PASSED ✅**
|
||||
|
||||
1. ✅ **No Configuration** → Setup Mode Activation
|
||||
2. ✅ **Invalid Configuration** → Setup Mode Activation
|
||||
3. ✅ **Valid Configuration** → Normal Mode Startup
|
||||
4. ✅ **Configuration Validation** → API Working
|
||||
5. ✅ **Web UI Accessibility** → Interface Available
|
||||
|
||||
## 🌟 Key Benefits
|
||||
|
||||
### **For Users**
|
||||
- **Zero Configuration**: Automatic setup detection
|
||||
- **Guided Setup**: Step-by-step configuration wizard
|
||||
- **No Dependencies**: Everything embedded in single binary
|
||||
- **Intuitive Interface**: Modern React-based UI
|
||||
|
||||
### **For Developers**
|
||||
- **Integrated Build**: Single command builds everything
|
||||
- **Hot Reload**: Development mode with live updates
|
||||
- **Comprehensive Testing**: Automated integration tests
|
||||
- **Easy Deployment**: Single binary contains everything
|
||||
|
||||
### **For Operations**
|
||||
- **Self-Contained**: No external web server needed
|
||||
- **Automatic Backup**: Configuration backup on changes
|
||||
- **Health Monitoring**: Built-in status endpoints
|
||||
- **Graceful Transitions**: Seamless mode switching
|
||||
|
||||
## 🔮 Next Steps
|
||||
|
||||
The web configuration system is now **fully functional** and ready for production use. Recommended next steps:
|
||||
|
||||
1. **Deploy to Cluster**: Use the setup system across BZZZ cluster nodes
|
||||
2. **Monitor Usage**: Track setup completion and configuration changes
|
||||
3. **Enhance UI**: Add advanced configuration options as needed
|
||||
4. **Scale Testing**: Test with multiple concurrent setup sessions
|
||||
|
||||
## 📁 File Locations
|
||||
|
||||
All integration files are located in `/home/tony/chorus/project-queues/active/BZZZ/`:
|
||||
|
||||
- **Main Binary**: `build/bzzz`
|
||||
- **Web UI Source**: `install/config-ui/`
|
||||
- **Embedded Files**: `pkg/web/`
|
||||
- **Configuration**: `pkg/config/`
|
||||
- **API Integration**: `api/`
|
||||
- **Documentation**: `install/SETUP_INTEGRATION_GUIDE.md`
|
||||
- **Test Suite**: `test-setup-integration.sh`
|
||||
|
||||
## 🎊 Success Confirmation
|
||||
|
||||
**✅ BZZZ Web Configuration Setup Integration is COMPLETE and FUNCTIONAL!**
|
||||
|
||||
The system now provides:
|
||||
- **Automatic setup detection and web UI activation**
|
||||
- **Complete embedded React configuration wizard**
|
||||
- **Seamless API integration between frontend and backend**
|
||||
- **Production-ready build process and deployment**
|
||||
- **Comprehensive testing and validation**
|
||||
- **Full end-to-end configuration flow**
|
||||
|
||||
**Result**: BZZZ now has a fully working web-based configuration system that automatically activates when needed and provides a complete setup experience for new installations.
|
||||
@@ -7,8 +7,8 @@ import (
|
||||
"strconv"
|
||||
"time"
|
||||
|
||||
"github.com/anthonyrawlins/bzzz/logging"
|
||||
"github.com/anthonyrawlins/bzzz/pubsub"
|
||||
"chorus.services/bzzz/logging"
|
||||
"chorus.services/bzzz/pubsub"
|
||||
"github.com/gorilla/mux"
|
||||
)
|
||||
|
||||
|
||||
1398
api/setup_manager.go
Normal file
1398
api/setup_manager.go
Normal file
File diff suppressed because it is too large
Load Diff
136
api_summary.md
Normal file
136
api_summary.md
Normal file
@@ -0,0 +1,136 @@
|
||||
# BZZZ Setup API Implementation Summary
|
||||
|
||||
## Overview
|
||||
I have successfully implemented the backend API components for BZZZ's built-in web configuration system by extending the existing HTTP server with setup endpoints that activate when no configuration exists.
|
||||
|
||||
## Implementation Details
|
||||
|
||||
### 1. SetupManager (`/home/tony/chorus/project-queues/active/BZZZ/api/setup_manager.go`)
|
||||
- **Purpose**: Central manager for setup operations with integration points to existing systems
|
||||
- **Key Features**:
|
||||
- Configuration requirement detection via `IsSetupRequired()`
|
||||
- Comprehensive system detection including hardware, GPU, network, storage, and Docker
|
||||
- Repository configuration validation using existing repository factory
|
||||
- Configuration validation and saving functionality
|
||||
|
||||
#### System Detection Capabilities:
|
||||
- **Hardware**: OS, architecture, CPU cores, memory detection
|
||||
- **GPU Detection**: NVIDIA (nvidia-smi), AMD (rocm-smi), Intel integrated graphics
|
||||
- **Network**: Hostname, interfaces, private IPs, Docker bridge detection
|
||||
- **Storage**: Disk space analysis for current working directory
|
||||
- **Docker**: Version detection, Compose availability, Swarm mode status
|
||||
|
||||
#### Repository Integration:
|
||||
- Uses existing `repository.DefaultProviderFactory` for provider creation
|
||||
- Supports GitHub and Gitea providers with credential validation
|
||||
- Tests actual repository connectivity during validation
|
||||
|
||||
### 2. Extended HTTP Server (`/home/tony/chorus/project-queues/active/BZZZ/api/http_server.go`)
|
||||
- **Enhanced Constructor**: Now accepts `configPath` parameter for setup integration
|
||||
- **Conditional Setup Routes**: Setup endpoints only available when `IsSetupRequired()` returns true
|
||||
- **New Setup API Endpoints**:
|
||||
|
||||
#### Setup API Endpoints:
|
||||
- `GET /api/setup/required` - Check if setup is required
|
||||
- `GET /api/setup/system` - Perform system detection and return hardware info
|
||||
- `GET /api/setup/repository/providers` - List supported repository providers
|
||||
- `POST /api/setup/repository/validate` - Validate repository configuration
|
||||
- `POST /api/setup/validate` - Validate complete setup configuration
|
||||
- `POST /api/setup/save` - Save setup configuration to file
|
||||
|
||||
#### Enhanced Status Endpoint:
|
||||
- `GET /api/status` - Now includes `setup_required` flag
|
||||
|
||||
### 3. Integration with Existing Systems
|
||||
- **Config System**: Uses existing `config.LoadConfig()` and `config.SaveConfig()`
|
||||
- **Repository Factory**: Leverages existing `repository.ProviderFactory` interface
|
||||
- **HTTP Server**: Extends existing server without breaking changes
|
||||
- **Main Application**: Updated to pass `configPath` to HTTP server constructor
|
||||
|
||||
### 4. Configuration Flow
|
||||
1. **Detection**: `IsSetupRequired()` checks for existing valid configuration
|
||||
2. **System Analysis**: Hardware detection provides environment-specific recommendations
|
||||
3. **Repository Setup**: Validates credentials and connectivity to GitHub/Gitea
|
||||
4. **Configuration Generation**: Creates complete BZZZ configuration with validated settings
|
||||
5. **Persistence**: Saves configuration using existing YAML format
|
||||
|
||||
## API Usage Examples
|
||||
|
||||
### Check Setup Requirement
|
||||
```bash
|
||||
curl http://localhost:8080/api/setup/required
|
||||
# Returns: {"setup_required": true, "timestamp": 1692382800}
|
||||
```
|
||||
|
||||
### System Detection
|
||||
```bash
|
||||
curl http://localhost:8080/api/setup/system
|
||||
# Returns comprehensive system information including GPUs, network, storage
|
||||
```
|
||||
|
||||
### Repository Validation
|
||||
```bash
|
||||
curl -X POST http://localhost:8080/api/setup/repository/validate \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{
|
||||
"provider": "github",
|
||||
"access_token": "ghp_...",
|
||||
"owner": "myorg",
|
||||
"repository": "myrepo"
|
||||
}'
|
||||
```
|
||||
|
||||
### Save Configuration
|
||||
```bash
|
||||
curl -X POST http://localhost:8080/api/setup/save \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{
|
||||
"agent_id": "my-agent-001",
|
||||
"capabilities": ["general", "reasoning"],
|
||||
"models": ["phi3", "llama3.1"],
|
||||
"repository": {
|
||||
"provider": "github",
|
||||
"access_token": "ghp_...",
|
||||
"owner": "myorg",
|
||||
"repository": "myrepo"
|
||||
}
|
||||
}'
|
||||
```
|
||||
|
||||
## Key Integration Points
|
||||
|
||||
### With Existing Config System:
|
||||
- Respects existing configuration format and validation
|
||||
- Uses existing default values and environment variable overrides
|
||||
- Maintains backward compatibility with current config loading
|
||||
|
||||
### With Repository System:
|
||||
- Uses existing `repository.ProviderFactory` for GitHub/Gitea support
|
||||
- Validates actual repository connectivity using existing client implementations
|
||||
- Maintains existing task provider interface compatibility
|
||||
|
||||
### With HTTP Server:
|
||||
- Extends existing API server without breaking changes
|
||||
- Maintains existing CORS configuration and middleware
|
||||
- Preserves existing logging and hypercore endpoints
|
||||
|
||||
## Security Considerations
|
||||
- Setup endpoints only available when no valid configuration exists
|
||||
- Repository credentials validated before storage
|
||||
- Configuration validation prevents invalid states
|
||||
- Graceful handling of system detection failures
|
||||
|
||||
## Testing and Validation
|
||||
- Build verification completed successfully
|
||||
- API endpoint structure validated
|
||||
- Integration with existing systems verified
|
||||
- No breaking changes to existing functionality
|
||||
|
||||
## Next Steps for Frontend Integration
|
||||
The API provides comprehensive endpoints for a web-based setup wizard:
|
||||
1. System detection provides hardware-specific recommendations
|
||||
2. Repository validation enables real-time credential verification
|
||||
3. Configuration validation provides immediate feedback
|
||||
4. Save endpoint completes setup with restart indication
|
||||
|
||||
This backend implementation provides a solid foundation for the web configuration UI, integrating seamlessly with existing BZZZ systems while providing the comprehensive setup capabilities needed for initial system configuration.
|
||||
@@ -1,6 +1,6 @@
|
||||
[Unit]
|
||||
Description=Bzzz P2P Task Coordination System
|
||||
Documentation=https://github.com/anthonyrawlins/bzzz
|
||||
Description=BZZZ P2P Task Coordination System
|
||||
Documentation=https://chorus.services/docs/bzzz
|
||||
After=network.target
|
||||
Wants=network.target
|
||||
|
||||
@@ -19,8 +19,6 @@ TimeoutStopSec=30
|
||||
# Environment variables
|
||||
Environment=HOME=/home/tony
|
||||
Environment=USER=tony
|
||||
Environment=BZZZ_WHOOSH_API_URL=https://whoosh.home.deepblack.cloud
|
||||
Environment=BZZZ_GITHUB_TOKEN_FILE=/home/tony/chorus/business/secrets/gh-token
|
||||
|
||||
# Logging
|
||||
StandardOutput=journal
|
||||
@@ -39,4 +37,4 @@ LimitNOFILE=65536
|
||||
LimitNPROC=4096
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
WantedBy=multi-user.target
|
||||
|
||||
423
cmd/chat-api/main.go
Normal file
423
cmd/chat-api/main.go
Normal file
@@ -0,0 +1,423 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"context"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"log"
|
||||
"net/http"
|
||||
"os"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"chorus.services/bzzz/executor"
|
||||
"chorus.services/bzzz/logging"
|
||||
"chorus.services/bzzz/pkg/types"
|
||||
"chorus.services/bzzz/sandbox"
|
||||
"github.com/gorilla/mux"
|
||||
)
|
||||
|
||||
// ChatTaskRequest represents a task request from the chat interface
|
||||
type ChatTaskRequest struct {
|
||||
Method string `json:"method"`
|
||||
Task *types.EnhancedTask `json:"task"`
|
||||
ExecutionOptions *ExecutionOptions `json:"execution_options"`
|
||||
Callback *CallbackConfig `json:"callback"`
|
||||
}
|
||||
|
||||
// ExecutionOptions defines how the task should be executed
|
||||
type ExecutionOptions struct {
|
||||
SandboxImage string `json:"sandbox_image"`
|
||||
Timeout string `json:"timeout"`
|
||||
MaxIterations int `json:"max_iterations"`
|
||||
ReturnFullLog bool `json:"return_full_log"`
|
||||
CleanupOnComplete bool `json:"cleanup_on_complete"`
|
||||
}
|
||||
|
||||
// CallbackConfig defines where to send results
|
||||
type CallbackConfig struct {
|
||||
WebhookURL string `json:"webhook_url"`
|
||||
IncludeArtifacts bool `json:"include_artifacts"`
|
||||
}
|
||||
|
||||
// ChatTaskResponse represents the response from task execution
|
||||
type ChatTaskResponse struct {
|
||||
TaskID int `json:"task_id"`
|
||||
Status string `json:"status"`
|
||||
ExecutionTime string `json:"execution_time"`
|
||||
Artifacts *ExecutionArtifacts `json:"artifacts,omitempty"`
|
||||
ExecutionLog []ExecutionLogEntry `json:"execution_log,omitempty"`
|
||||
Errors []ExecutionError `json:"errors,omitempty"`
|
||||
GitBranch string `json:"git_branch,omitempty"`
|
||||
PullRequestURL string `json:"pr_url,omitempty"`
|
||||
OriginalRequest *ChatTaskRequest `json:"original_request,omitempty"`
|
||||
}
|
||||
|
||||
// ExecutionArtifacts contains the outputs of task execution
|
||||
type ExecutionArtifacts struct {
|
||||
FilesCreated []FileArtifact `json:"files_created,omitempty"`
|
||||
CodeGenerated string `json:"code_generated,omitempty"`
|
||||
Language string `json:"language,omitempty"`
|
||||
TestsCreated []FileArtifact `json:"tests_created,omitempty"`
|
||||
Documentation string `json:"documentation,omitempty"`
|
||||
}
|
||||
|
||||
// FileArtifact represents a file created during execution
|
||||
type FileArtifact struct {
|
||||
Name string `json:"name"`
|
||||
Path string `json:"path"`
|
||||
Size int64 `json:"size"`
|
||||
Content string `json:"content,omitempty"`
|
||||
Language string `json:"language,omitempty"`
|
||||
}
|
||||
|
||||
// ExecutionLogEntry represents a single step in the execution process
|
||||
type ExecutionLogEntry struct {
|
||||
Step int `json:"step"`
|
||||
Action string `json:"action"`
|
||||
Command string `json:"command,omitempty"`
|
||||
Result string `json:"result"`
|
||||
Success bool `json:"success"`
|
||||
Timestamp time.Time `json:"timestamp"`
|
||||
Duration string `json:"duration,omitempty"`
|
||||
}
|
||||
|
||||
// ExecutionError represents an error that occurred during execution
|
||||
type ExecutionError struct {
|
||||
Step int `json:"step,omitempty"`
|
||||
Type string `json:"type"`
|
||||
Message string `json:"message"`
|
||||
Command string `json:"command,omitempty"`
|
||||
}
|
||||
|
||||
// ChatAPIHandler handles chat integration requests
|
||||
type ChatAPIHandler struct {
|
||||
logger *logging.HypercoreLog
|
||||
}
|
||||
|
||||
// NewChatAPIHandler creates a new chat API handler
|
||||
func NewChatAPIHandler() *ChatAPIHandler {
|
||||
// Note: HypercoreLog expects a peer.ID, but for testing we use nil
|
||||
// In production, this should be integrated with the actual P2P peer ID
|
||||
|
||||
return &ChatAPIHandler{
|
||||
logger: nil, // Will be set up when P2P integration is available
|
||||
}
|
||||
}
|
||||
|
||||
// ExecuteTaskHandler handles task execution requests from N8N chat workflow
|
||||
func (h *ChatAPIHandler) ExecuteTaskHandler(w http.ResponseWriter, r *http.Request) {
|
||||
ctx := r.Context()
|
||||
|
||||
// Parse request
|
||||
var req ChatTaskRequest
|
||||
if err := json.NewDecoder(r.Body).Decode(&req); err != nil {
|
||||
h.sendError(w, http.StatusBadRequest, "Invalid request format", err)
|
||||
return
|
||||
}
|
||||
|
||||
// Log the incoming request
|
||||
if h.logger != nil {
|
||||
h.logger.Append(logging.TaskProgress, map[string]interface{}{
|
||||
"task_id": req.Task.Number,
|
||||
"method": req.Method,
|
||||
"source": "chat_api",
|
||||
"status": "received",
|
||||
})
|
||||
}
|
||||
|
||||
// Validate request
|
||||
if req.Task == nil {
|
||||
h.sendError(w, http.StatusBadRequest, "Task is required", nil)
|
||||
return
|
||||
}
|
||||
|
||||
// Send immediate response to N8N
|
||||
response := map[string]interface{}{
|
||||
"task_id": req.Task.Number,
|
||||
"status": "accepted",
|
||||
"message": "Task accepted for execution",
|
||||
}
|
||||
|
||||
w.Header().Set("Content-Type", "application/json")
|
||||
json.NewEncoder(w).Encode(response)
|
||||
|
||||
// Execute task asynchronously
|
||||
go h.executeTaskAsync(ctx, &req)
|
||||
}
|
||||
|
||||
// executeTaskAsync executes the task in a separate goroutine
|
||||
func (h *ChatAPIHandler) executeTaskAsync(ctx context.Context, req *ChatTaskRequest) {
|
||||
startTime := time.Now()
|
||||
var response ChatTaskResponse
|
||||
|
||||
response.TaskID = req.Task.Number
|
||||
response.OriginalRequest = req
|
||||
|
||||
// Create execution log
|
||||
var executionLog []ExecutionLogEntry
|
||||
var artifacts ExecutionArtifacts
|
||||
var errors []ExecutionError
|
||||
|
||||
defer func() {
|
||||
response.ExecutionTime = time.Since(startTime).String()
|
||||
response.ExecutionLog = executionLog
|
||||
response.Artifacts = &artifacts
|
||||
response.Errors = errors
|
||||
|
||||
// Send callback to N8N
|
||||
if req.Callback != nil && req.Callback.WebhookURL != "" {
|
||||
h.sendCallback(req.Callback.WebhookURL, &response)
|
||||
}
|
||||
}()
|
||||
|
||||
// Log start of execution
|
||||
executionLog = append(executionLog, ExecutionLogEntry{
|
||||
Step: 1,
|
||||
Action: "Starting task execution",
|
||||
Result: fmt.Sprintf("Task: %s", req.Task.Title),
|
||||
Success: true,
|
||||
Timestamp: time.Now(),
|
||||
})
|
||||
|
||||
// Create sandbox
|
||||
sb, err := sandbox.CreateSandbox(ctx, req.ExecutionOptions.SandboxImage)
|
||||
if err != nil {
|
||||
response.Status = "failed"
|
||||
errors = append(errors, ExecutionError{
|
||||
Step: 2,
|
||||
Type: "sandbox_creation_failed",
|
||||
Message: err.Error(),
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
// Ensure cleanup
|
||||
defer func() {
|
||||
if req.ExecutionOptions.CleanupOnComplete {
|
||||
sb.DestroySandbox()
|
||||
}
|
||||
}()
|
||||
|
||||
executionLog = append(executionLog, ExecutionLogEntry{
|
||||
Step: 2,
|
||||
Action: "Created sandbox",
|
||||
Result: fmt.Sprintf("Sandbox ID: %s", sb.ID[:12]),
|
||||
Success: true,
|
||||
Timestamp: time.Now(),
|
||||
})
|
||||
|
||||
// Clone repository if specified
|
||||
if req.Task.GitURL != "" {
|
||||
cloneCmd := fmt.Sprintf("git clone %s .", req.Task.GitURL)
|
||||
result, err := sb.RunCommand(cloneCmd)
|
||||
|
||||
success := err == nil
|
||||
executionLog = append(executionLog, ExecutionLogEntry{
|
||||
Step: 3,
|
||||
Action: "Clone repository",
|
||||
Command: cloneCmd,
|
||||
Result: fmt.Sprintf("Exit: %d, Output: %s", result.ExitCode, result.StdOut),
|
||||
Success: success,
|
||||
Timestamp: time.Now(),
|
||||
})
|
||||
|
||||
if err != nil {
|
||||
errors = append(errors, ExecutionError{
|
||||
Step: 3,
|
||||
Type: "git_clone_failed",
|
||||
Message: err.Error(),
|
||||
Command: cloneCmd,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// Execute the task using the existing executor
|
||||
result, err := executor.ExecuteTask(ctx, req.Task, h.logger)
|
||||
if err != nil {
|
||||
response.Status = "failed"
|
||||
errors = append(errors, ExecutionError{
|
||||
Type: "execution_failed",
|
||||
Message: err.Error(),
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
// Collect artifacts from sandbox
|
||||
h.collectArtifacts(sb, &artifacts)
|
||||
|
||||
// Set success status
|
||||
response.Status = "success"
|
||||
if result.BranchName != "" {
|
||||
response.GitBranch = result.BranchName
|
||||
}
|
||||
|
||||
executionLog = append(executionLog, ExecutionLogEntry{
|
||||
Step: len(executionLog) + 1,
|
||||
Action: "Task completed successfully",
|
||||
Result: fmt.Sprintf("Files created: %d", len(artifacts.FilesCreated)),
|
||||
Success: true,
|
||||
Timestamp: time.Now(),
|
||||
})
|
||||
}
|
||||
|
||||
// collectArtifacts gathers files and outputs from the sandbox
|
||||
func (h *ChatAPIHandler) collectArtifacts(sb *sandbox.Sandbox, artifacts *ExecutionArtifacts) {
|
||||
// List files created in workspace
|
||||
result, err := sb.RunCommand("find . -type f -name '*.py' -o -name '*.js' -o -name '*.go' -o -name '*.java' -o -name '*.cpp' -o -name '*.rs' | head -20")
|
||||
if err == nil && result.StdOut != "" {
|
||||
files := strings.Split(strings.TrimSpace(result.StdOut), "\n")
|
||||
var validFiles []string
|
||||
for _, line := range files {
|
||||
if strings.TrimSpace(line) != "" {
|
||||
validFiles = append(validFiles, strings.TrimSpace(line))
|
||||
}
|
||||
}
|
||||
files = validFiles
|
||||
|
||||
for _, file := range files {
|
||||
// Get file content
|
||||
content, err := sb.ReadFile(file)
|
||||
if err == nil && len(content) < 10000 { // Limit content size
|
||||
stat, _ := sb.RunCommand(fmt.Sprintf("stat -c '%%s' %s", file))
|
||||
size := int64(0)
|
||||
if stat.ExitCode == 0 {
|
||||
fmt.Sscanf(stat.StdOut, "%d", &size)
|
||||
}
|
||||
|
||||
artifact := FileArtifact{
|
||||
Name: file,
|
||||
Path: file,
|
||||
Size: size,
|
||||
Content: string(content),
|
||||
Language: h.detectLanguage(file),
|
||||
}
|
||||
artifacts.FilesCreated = append(artifacts.FilesCreated, artifact)
|
||||
|
||||
// If this looks like the main generated code, set it
|
||||
if artifacts.CodeGenerated == "" && size > 0 {
|
||||
artifacts.CodeGenerated = string(content)
|
||||
artifacts.Language = artifact.Language
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// detectLanguage detects programming language from file extension
|
||||
func (h *ChatAPIHandler) detectLanguage(filename string) string {
|
||||
extensions := map[string]string{
|
||||
".py": "python",
|
||||
".js": "javascript",
|
||||
".ts": "typescript",
|
||||
".go": "go",
|
||||
".java": "java",
|
||||
".cpp": "cpp",
|
||||
".c": "c",
|
||||
".rs": "rust",
|
||||
".rb": "ruby",
|
||||
".php": "php",
|
||||
}
|
||||
|
||||
for ext, lang := range extensions {
|
||||
if len(filename) > len(ext) && filename[len(filename)-len(ext):] == ext {
|
||||
return lang
|
||||
}
|
||||
}
|
||||
return "text"
|
||||
}
|
||||
|
||||
// sendCallback sends the execution results back to N8N webhook
|
||||
func (h *ChatAPIHandler) sendCallback(webhookURL string, response *ChatTaskResponse) {
|
||||
jsonData, err := json.Marshal(response)
|
||||
if err != nil {
|
||||
log.Printf("Failed to marshal callback response: %v", err)
|
||||
return
|
||||
}
|
||||
|
||||
client := &http.Client{Timeout: 30 * time.Second}
|
||||
resp, err := client.Post(webhookURL, "application/json", bytes.NewBuffer(jsonData))
|
||||
if err != nil {
|
||||
log.Printf("Failed to send callback to %s: %v", webhookURL, err)
|
||||
return
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
|
||||
if resp.StatusCode != http.StatusOK {
|
||||
log.Printf("Callback webhook returned status %d", resp.StatusCode)
|
||||
}
|
||||
}
|
||||
|
||||
// sendError sends an error response
|
||||
func (h *ChatAPIHandler) sendError(w http.ResponseWriter, statusCode int, message string, err error) {
|
||||
w.Header().Set("Content-Type", "application/json")
|
||||
w.WriteHeader(statusCode)
|
||||
|
||||
errorResponse := map[string]interface{}{
|
||||
"error": message,
|
||||
"status": statusCode,
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
errorResponse["details"] = err.Error()
|
||||
}
|
||||
|
||||
json.NewEncoder(w).Encode(errorResponse)
|
||||
}
|
||||
|
||||
// HealthHandler provides a health check endpoint
|
||||
func (h *ChatAPIHandler) HealthHandler(w http.ResponseWriter, r *http.Request) {
|
||||
w.Header().Set("Content-Type", "application/json")
|
||||
json.NewEncoder(w).Encode(map[string]interface{}{
|
||||
"status": "healthy",
|
||||
"service": "bzzz-chat-api",
|
||||
"timestamp": time.Now().Format(time.RFC3339),
|
||||
})
|
||||
}
|
||||
|
||||
// StartChatAPIServer starts the HTTP server for chat integration
|
||||
func StartChatAPIServer(port string) {
|
||||
handler := NewChatAPIHandler()
|
||||
|
||||
r := mux.NewRouter()
|
||||
|
||||
// API routes
|
||||
api := r.PathPrefix("/bzzz/api").Subrouter()
|
||||
api.HandleFunc("/execute-task", handler.ExecuteTaskHandler).Methods("POST")
|
||||
api.HandleFunc("/health", handler.HealthHandler).Methods("GET")
|
||||
|
||||
// Add CORS middleware
|
||||
r.Use(func(next http.Handler) http.Handler {
|
||||
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
w.Header().Set("Access-Control-Allow-Origin", "*")
|
||||
w.Header().Set("Access-Control-Allow-Methods", "GET, POST, OPTIONS")
|
||||
w.Header().Set("Access-Control-Allow-Headers", "Content-Type, Authorization")
|
||||
|
||||
if r.Method == "OPTIONS" {
|
||||
w.WriteHeader(http.StatusOK)
|
||||
return
|
||||
}
|
||||
|
||||
next.ServeHTTP(w, r)
|
||||
})
|
||||
})
|
||||
|
||||
log.Printf("🚀 Starting Bzzz Chat API server on port %s", port)
|
||||
log.Printf("📡 Endpoints:")
|
||||
log.Printf(" POST /bzzz/api/execute-task - Execute task in sandbox")
|
||||
log.Printf(" GET /bzzz/api/health - Health check")
|
||||
|
||||
if err := http.ListenAndServe(":"+port, r); err != nil {
|
||||
log.Fatalf("Failed to start server: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
func main() {
|
||||
port := "8080"
|
||||
if len(os.Args) > 1 {
|
||||
port = os.Args[1]
|
||||
}
|
||||
|
||||
StartChatAPIServer(port)
|
||||
}
|
||||
@@ -9,11 +9,11 @@ import (
|
||||
"syscall"
|
||||
"time"
|
||||
|
||||
"github.com/anthonyrawlins/bzzz/discovery"
|
||||
"github.com/anthonyrawlins/bzzz/monitoring"
|
||||
"github.com/anthonyrawlins/bzzz/p2p"
|
||||
"github.com/anthonyrawlins/bzzz/pubsub"
|
||||
"github.com/anthonyrawlins/bzzz/test"
|
||||
"chorus.services/bzzz/discovery"
|
||||
"chorus.services/bzzz/monitoring"
|
||||
"chorus.services/bzzz/p2p"
|
||||
"chorus.services/bzzz/pubsub"
|
||||
"chorus.services/bzzz/test"
|
||||
)
|
||||
|
||||
func main() {
|
||||
|
||||
@@ -7,17 +7,15 @@ import (
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/anthonyrawlins/bzzz/logging"
|
||||
"github.com/anthonyrawlins/bzzz/pkg/config"
|
||||
"github.com/anthonyrawlins/bzzz/pkg/hive"
|
||||
"github.com/anthonyrawlins/bzzz/pubsub"
|
||||
"github.com/anthonyrawlins/bzzz/repository"
|
||||
"chorus.services/bzzz/logging"
|
||||
"chorus.services/bzzz/pkg/config"
|
||||
"chorus.services/bzzz/pubsub"
|
||||
"chorus.services/bzzz/repository"
|
||||
"github.com/libp2p/go-libp2p/core/peer"
|
||||
)
|
||||
|
||||
// TaskCoordinator manages task discovery, assignment, and execution across multiple repositories
|
||||
type TaskCoordinator struct {
|
||||
hiveClient *hive.HiveClient
|
||||
pubsub *pubsub.PubSub
|
||||
hlog *logging.HypercoreLog
|
||||
ctx context.Context
|
||||
@@ -57,14 +55,12 @@ type ActiveTask struct {
|
||||
// NewTaskCoordinator creates a new task coordinator
|
||||
func NewTaskCoordinator(
|
||||
ctx context.Context,
|
||||
hiveClient *hive.HiveClient,
|
||||
ps *pubsub.PubSub,
|
||||
hlog *logging.HypercoreLog,
|
||||
cfg *config.Config,
|
||||
nodeID string,
|
||||
) *TaskCoordinator {
|
||||
coordinator := &TaskCoordinator{
|
||||
hiveClient: hiveClient,
|
||||
pubsub: ps,
|
||||
hlog: hlog,
|
||||
ctx: ctx,
|
||||
@@ -120,71 +116,11 @@ func (tc *TaskCoordinator) taskDiscoveryLoop() {
|
||||
case <-tc.ctx.Done():
|
||||
return
|
||||
case <-ticker.C:
|
||||
tc.discoverAndProcessTasks()
|
||||
// Task discovery is now handled by WHOOSH
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// discoverAndProcessTasks discovers tasks from all repositories and processes them
|
||||
func (tc *TaskCoordinator) discoverAndProcessTasks() {
|
||||
// Get monitored repositories from Hive
|
||||
repositories, err := tc.hiveClient.GetMonitoredRepositories(tc.ctx)
|
||||
if err != nil {
|
||||
fmt.Printf("⚠️ Failed to get monitored repositories: %v\n", err)
|
||||
return
|
||||
}
|
||||
|
||||
var totalTasks, processedTasks int
|
||||
|
||||
for _, repo := range repositories {
|
||||
// Skip if repository is not enabled for bzzz
|
||||
if !repo.BzzzEnabled {
|
||||
continue
|
||||
}
|
||||
|
||||
// Create or get repository provider
|
||||
provider, err := tc.getOrCreateProvider(repo)
|
||||
if err != nil {
|
||||
fmt.Printf("⚠️ Failed to create provider for %s: %v\n", repo.Name, err)
|
||||
continue
|
||||
}
|
||||
|
||||
// Get available tasks
|
||||
tasks, err := provider.ListAvailableTasks()
|
||||
if err != nil {
|
||||
fmt.Printf("⚠️ Failed to list tasks for %s: %v\n", repo.Name, err)
|
||||
continue
|
||||
}
|
||||
|
||||
totalTasks += len(tasks)
|
||||
|
||||
// Filter tasks suitable for this agent
|
||||
suitableTasks, err := tc.taskMatcher.MatchTasksToRole(tasks, tc.agentInfo.Role, tc.agentInfo.Expertise)
|
||||
if err != nil {
|
||||
fmt.Printf("⚠️ Failed to match tasks for role %s: %v\n", tc.agentInfo.Role, err)
|
||||
continue
|
||||
}
|
||||
|
||||
// Process suitable tasks
|
||||
for _, task := range suitableTasks {
|
||||
if tc.shouldProcessTask(task) {
|
||||
if tc.processTask(task, provider, repo.ID) {
|
||||
processedTasks++
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Update last sync time
|
||||
tc.syncLock.Lock()
|
||||
tc.lastSync[repo.ID] = time.Now()
|
||||
tc.syncLock.Unlock()
|
||||
}
|
||||
|
||||
if totalTasks > 0 {
|
||||
fmt.Printf("🔍 Discovered %d tasks, processed %d suitable tasks\n", totalTasks, processedTasks)
|
||||
}
|
||||
}
|
||||
|
||||
// shouldProcessTask determines if we should process a task
|
||||
func (tc *TaskCoordinator) shouldProcessTask(task *repository.Task) bool {
|
||||
// Check if we're already at capacity
|
||||
@@ -376,41 +312,6 @@ func (tc *TaskCoordinator) executeTask(activeTask *ActiveTask) {
|
||||
fmt.Printf("✅ Completed task %s #%d\n", activeTask.Task.Repository, activeTask.Task.Number)
|
||||
}
|
||||
|
||||
// getOrCreateProvider gets or creates a repository provider
|
||||
func (tc *TaskCoordinator) getOrCreateProvider(repo *hive.MonitoredRepository) (repository.TaskProvider, error) {
|
||||
tc.providerLock.RLock()
|
||||
if provider, exists := tc.providers[repo.ID]; exists {
|
||||
tc.providerLock.RUnlock()
|
||||
return provider, nil
|
||||
}
|
||||
tc.providerLock.RUnlock()
|
||||
|
||||
// Create new provider
|
||||
config := &repository.Config{
|
||||
Provider: repo.Provider,
|
||||
BaseURL: repo.ProviderBaseURL,
|
||||
AccessToken: repo.AccessToken,
|
||||
Owner: repo.GitOwner,
|
||||
Repository: repo.GitRepository,
|
||||
TaskLabel: "bzzz-task",
|
||||
InProgressLabel: "in-progress",
|
||||
CompletedLabel: "completed",
|
||||
BaseBranch: repo.GitBranch,
|
||||
BranchPrefix: "bzzz/task-",
|
||||
}
|
||||
|
||||
provider, err := tc.factory.CreateProvider(tc.ctx, config)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to create provider: %w", err)
|
||||
}
|
||||
|
||||
tc.providerLock.Lock()
|
||||
tc.providers[repo.ID] = provider
|
||||
tc.providerLock.Unlock()
|
||||
|
||||
return provider, nil
|
||||
}
|
||||
|
||||
// announceAgentRole announces this agent's role and capabilities
|
||||
func (tc *TaskCoordinator) announceAgentRole() {
|
||||
data := map[string]interface{}{
|
||||
@@ -600,4 +501,4 @@ func (tc *TaskCoordinator) GetStatus() map[string]interface{} {
|
||||
"status": tc.agentInfo.Status,
|
||||
"active_tasks": taskList,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,10 +6,10 @@ import (
|
||||
"log"
|
||||
"time"
|
||||
|
||||
"github.com/anthonyrawlins/bzzz/pkg/config"
|
||||
"github.com/anthonyrawlins/bzzz/pkg/coordination"
|
||||
"github.com/anthonyrawlins/bzzz/pkg/integration"
|
||||
"github.com/anthonyrawlins/bzzz/pubsub"
|
||||
"chorus.services/bzzz/pkg/config"
|
||||
"chorus.services/bzzz/pkg/coordination"
|
||||
"chorus.services/bzzz/pkg/integration"
|
||||
"chorus.services/bzzz/pubsub"
|
||||
"github.com/libp2p/go-libp2p"
|
||||
"github.com/libp2p/go-libp2p/core/host"
|
||||
)
|
||||
|
||||
@@ -5,11 +5,11 @@ import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
"github.com/anthonyrawlins/bzzz/logging"
|
||||
"github.com/anthonyrawlins/bzzz/pkg/config"
|
||||
"github.com/anthonyrawlins/bzzz/pkg/types"
|
||||
"github.com/anthonyrawlins/bzzz/reasoning"
|
||||
"github.com/anthonyrawlins/bzzz/sandbox"
|
||||
"chorus.services/bzzz/logging"
|
||||
"chorus.services/bzzz/pkg/config"
|
||||
"chorus.services/bzzz/pkg/types"
|
||||
"chorus.services/bzzz/reasoning"
|
||||
"chorus.services/bzzz/sandbox"
|
||||
)
|
||||
|
||||
const maxIterations = 10 // Prevents infinite loops
|
||||
|
||||
@@ -162,8 +162,9 @@ func (c *Client) verifyAccess() error {
|
||||
defer resp.Body.Close()
|
||||
|
||||
if resp.StatusCode != http.StatusOK {
|
||||
return fmt.Errorf("cannot access repository %s/%s: HTTP %d",
|
||||
c.config.Owner, c.config.Repository, resp.StatusCode)
|
||||
body, _ := io.ReadAll(resp.Body)
|
||||
return fmt.Errorf("cannot access repository %s/%s: HTTP %d - %s (URL: %s)",
|
||||
c.config.Owner, c.config.Repository, resp.StatusCode, string(body), url)
|
||||
}
|
||||
|
||||
return nil
|
||||
|
||||
@@ -7,11 +7,11 @@ import (
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/anthonyrawlins/bzzz/executor"
|
||||
"github.com/anthonyrawlins/bzzz/logging"
|
||||
"github.com/anthonyrawlins/bzzz/pkg/config"
|
||||
"github.com/anthonyrawlins/bzzz/pkg/types"
|
||||
"github.com/anthonyrawlins/bzzz/pubsub"
|
||||
"chorus.services/bzzz/executor"
|
||||
"chorus.services/bzzz/logging"
|
||||
"chorus.services/bzzz/pkg/config"
|
||||
"chorus.services/bzzz/pkg/types"
|
||||
"chorus.services/bzzz/pubsub"
|
||||
"github.com/libp2p/go-libp2p/core/peer"
|
||||
)
|
||||
|
||||
|
||||
80
go.mod
80
go.mod
@@ -1,11 +1,11 @@
|
||||
module github.com/anthonyrawlins/bzzz
|
||||
module chorus.services/bzzz
|
||||
|
||||
go 1.23.0
|
||||
|
||||
toolchain go1.24.5
|
||||
|
||||
require (
|
||||
filippo.io/age v1.1.1
|
||||
filippo.io/age v1.2.1
|
||||
github.com/google/go-github/v57 v57.0.0
|
||||
github.com/libp2p/go-libp2p v0.32.0
|
||||
github.com/libp2p/go-libp2p-kad-dht v0.25.2
|
||||
@@ -16,9 +16,30 @@ require (
|
||||
)
|
||||
|
||||
require (
|
||||
filippo.io/edwards25519 v1.1.0 // indirect
|
||||
github.com/Microsoft/go-winio v0.4.14 // indirect
|
||||
github.com/RoaringBitmap/roaring/v2 v2.4.5 // indirect
|
||||
github.com/benbjohnson/clock v1.3.5 // indirect
|
||||
github.com/beorn7/perks v1.0.1 // indirect
|
||||
github.com/bits-and-blooms/bitset v1.22.0 // indirect
|
||||
github.com/blevesearch/bleve/v2 v2.5.3 // indirect
|
||||
github.com/blevesearch/bleve_index_api v1.2.8 // indirect
|
||||
github.com/blevesearch/geo v0.2.4 // indirect
|
||||
github.com/blevesearch/go-faiss v1.0.25 // indirect
|
||||
github.com/blevesearch/go-porterstemmer v1.0.3 // indirect
|
||||
github.com/blevesearch/gtreap v0.1.1 // indirect
|
||||
github.com/blevesearch/mmap-go v1.0.4 // indirect
|
||||
github.com/blevesearch/scorch_segment_api/v2 v2.3.10 // indirect
|
||||
github.com/blevesearch/segment v0.9.1 // indirect
|
||||
github.com/blevesearch/snowballstem v0.9.0 // indirect
|
||||
github.com/blevesearch/upsidedown_store_api v1.0.2 // indirect
|
||||
github.com/blevesearch/vellum v1.1.0 // indirect
|
||||
github.com/blevesearch/zapx/v11 v11.4.2 // indirect
|
||||
github.com/blevesearch/zapx/v12 v12.4.2 // indirect
|
||||
github.com/blevesearch/zapx/v13 v13.4.2 // indirect
|
||||
github.com/blevesearch/zapx/v14 v14.4.2 // indirect
|
||||
github.com/blevesearch/zapx/v15 v15.4.2 // indirect
|
||||
github.com/blevesearch/zapx/v16 v16.2.4 // indirect
|
||||
github.com/cespare/xxhash/v2 v2.2.0 // indirect
|
||||
github.com/containerd/cgroups v1.1.0 // indirect
|
||||
github.com/containerd/errdefs v1.0.0 // indirect
|
||||
@@ -26,6 +47,7 @@ require (
|
||||
github.com/coreos/go-systemd/v22 v22.5.0 // indirect
|
||||
github.com/davidlazar/go-crypto v0.0.0-20200604182044-b73af7476f6c // indirect
|
||||
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0 // indirect
|
||||
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect
|
||||
github.com/distribution/reference v0.6.0 // indirect
|
||||
github.com/docker/docker v28.3.2+incompatible // indirect
|
||||
github.com/docker/go-connections v0.5.0 // indirect
|
||||
@@ -36,21 +58,33 @@ require (
|
||||
github.com/francoispqt/gojay v1.2.13 // indirect
|
||||
github.com/go-logr/logr v1.4.3 // indirect
|
||||
github.com/go-logr/stdr v1.2.2 // indirect
|
||||
github.com/go-redis/redis/v8 v8.11.5 // indirect
|
||||
github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 // indirect
|
||||
github.com/godbus/dbus/v5 v5.1.0 // indirect
|
||||
github.com/gogo/protobuf v1.3.2 // indirect
|
||||
github.com/golang/protobuf v1.5.3 // indirect
|
||||
github.com/golang/snappy v0.0.4 // indirect
|
||||
github.com/google/go-querystring v1.1.0 // indirect
|
||||
github.com/google/gopacket v1.1.19 // indirect
|
||||
github.com/google/pprof v0.0.0-20231023181126-ff6d637d2a7b // indirect
|
||||
github.com/google/uuid v1.6.0 // indirect
|
||||
github.com/gorilla/mux v1.8.1 // indirect
|
||||
github.com/gorilla/websocket v1.5.0 // indirect
|
||||
github.com/hashicorp/errwrap v1.1.0 // indirect
|
||||
github.com/hashicorp/go-multierror v1.1.1 // indirect
|
||||
github.com/hashicorp/golang-lru v0.5.4 // indirect
|
||||
github.com/hashicorp/golang-lru/v2 v2.0.5 // indirect
|
||||
github.com/huin/goupnp v1.3.0 // indirect
|
||||
github.com/ipfs/go-cid v0.4.1 // indirect
|
||||
github.com/ipfs/boxo v0.10.0 // indirect
|
||||
github.com/ipfs/go-cid v0.5.0 // indirect
|
||||
github.com/ipfs/go-datastore v0.6.0 // indirect
|
||||
github.com/ipfs/go-log v1.0.5 // indirect
|
||||
github.com/ipfs/go-log/v2 v2.5.1 // indirect
|
||||
github.com/ipld/go-ipld-prime v0.20.0 // indirect
|
||||
github.com/jackpal/go-nat-pmp v1.0.2 // indirect
|
||||
github.com/jbenet/go-temp-err-catcher v0.1.0 // indirect
|
||||
github.com/jbenet/goprocess v0.1.4 // indirect
|
||||
github.com/json-iterator/go v1.1.12 // indirect
|
||||
github.com/klauspost/compress v1.17.2 // indirect
|
||||
github.com/klauspost/cpuid/v2 v2.2.5 // indirect
|
||||
github.com/koron/go-ssdp v0.0.4 // indirect
|
||||
@@ -58,6 +92,9 @@ require (
|
||||
github.com/libp2p/go-cidranger v1.1.0 // indirect
|
||||
github.com/libp2p/go-flow-metrics v0.1.0 // indirect
|
||||
github.com/libp2p/go-libp2p-asn-util v0.3.0 // indirect
|
||||
github.com/libp2p/go-libp2p-kbucket v0.6.3 // indirect
|
||||
github.com/libp2p/go-libp2p-record v0.2.0 // indirect
|
||||
github.com/libp2p/go-libp2p-routing-helpers v0.7.2 // indirect
|
||||
github.com/libp2p/go-msgio v0.3.0 // indirect
|
||||
github.com/libp2p/go-nat v0.2.0 // indirect
|
||||
github.com/libp2p/go-netroute v0.2.1 // indirect
|
||||
@@ -72,7 +109,10 @@ require (
|
||||
github.com/mikioh/tcpopt v0.0.0-20190314235656-172688c1accc // indirect
|
||||
github.com/minio/sha256-simd v1.0.1 // indirect
|
||||
github.com/moby/docker-image-spec v1.3.1 // indirect
|
||||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
|
||||
github.com/modern-go/reflect2 v1.0.2 // indirect
|
||||
github.com/mr-tron/base58 v1.2.0 // indirect
|
||||
github.com/mschoch/smat v0.2.0 // indirect
|
||||
github.com/multiformats/go-base32 v0.1.0 // indirect
|
||||
github.com/multiformats/go-base36 v0.2.0 // indirect
|
||||
github.com/multiformats/go-multiaddr-dns v0.3.1 // indirect
|
||||
@@ -86,37 +126,49 @@ require (
|
||||
github.com/opencontainers/go-digest v1.0.0 // indirect
|
||||
github.com/opencontainers/image-spec v1.1.1 // indirect
|
||||
github.com/opencontainers/runtime-spec v1.1.0 // indirect
|
||||
github.com/opentracing/opentracing-go v1.2.0 // indirect
|
||||
github.com/pbnjay/memory v0.0.0-20210728143218-7b4eea64cf58 // indirect
|
||||
github.com/pkg/errors v0.9.1 // indirect
|
||||
github.com/prometheus/client_golang v1.14.0 // indirect
|
||||
github.com/polydawn/refmt v0.89.0 // indirect
|
||||
github.com/prometheus/client_golang v1.16.0 // indirect
|
||||
github.com/prometheus/client_model v0.4.0 // indirect
|
||||
github.com/prometheus/common v0.37.0 // indirect
|
||||
github.com/prometheus/procfs v0.8.0 // indirect
|
||||
github.com/prometheus/common v0.44.0 // indirect
|
||||
github.com/prometheus/procfs v0.11.1 // indirect
|
||||
github.com/quic-go/qpack v0.4.0 // indirect
|
||||
github.com/quic-go/qtls-go1-20 v0.3.4 // indirect
|
||||
github.com/quic-go/quic-go v0.39.3 // indirect
|
||||
github.com/quic-go/webtransport-go v0.6.0 // indirect
|
||||
github.com/raulk/go-watchdog v1.3.0 // indirect
|
||||
github.com/robfig/cron/v3 v3.0.1 // indirect
|
||||
github.com/sashabaranov/go-openai v1.41.1 // indirect
|
||||
github.com/spaolacci/murmur3 v1.1.0 // indirect
|
||||
github.com/whyrusleeping/go-keyspace v0.0.0-20160322163242-5b898ac5add1 // indirect
|
||||
go.etcd.io/bbolt v1.4.0 // indirect
|
||||
go.opencensus.io v0.24.0 // indirect
|
||||
go.opentelemetry.io/auto/sdk v1.1.0 // indirect
|
||||
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.62.0 // indirect
|
||||
go.opentelemetry.io/otel v1.37.0 // indirect
|
||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.37.0 // indirect
|
||||
go.opentelemetry.io/otel/metric v1.37.0 // indirect
|
||||
go.opentelemetry.io/otel/sdk v1.37.0 // indirect
|
||||
go.opentelemetry.io/otel/trace v1.37.0 // indirect
|
||||
go.opentelemetry.io/proto/otlp v1.7.0 // indirect
|
||||
go.uber.org/dig v1.17.1 // indirect
|
||||
go.uber.org/fx v1.20.1 // indirect
|
||||
go.uber.org/mock v0.3.0 // indirect
|
||||
go.uber.org/multierr v1.11.0 // indirect
|
||||
go.uber.org/zap v1.26.0 // indirect
|
||||
golang.org/x/crypto v0.16.0 // indirect
|
||||
golang.org/x/crypto v0.41.0 // indirect
|
||||
golang.org/x/exp v0.0.0-20231006140011-7918f672742d // indirect
|
||||
golang.org/x/mod v0.13.0 // indirect
|
||||
golang.org/x/net v0.19.0 // indirect
|
||||
golang.org/x/sync v0.4.0 // indirect
|
||||
golang.org/x/sys v0.33.0 // indirect
|
||||
golang.org/x/text v0.14.0 // indirect
|
||||
golang.org/x/tools v0.14.0 // indirect
|
||||
golang.org/x/mod v0.26.0 // indirect
|
||||
golang.org/x/net v0.43.0 // indirect
|
||||
golang.org/x/sync v0.16.0 // indirect
|
||||
golang.org/x/sys v0.35.0 // indirect
|
||||
golang.org/x/text v0.28.0 // indirect
|
||||
golang.org/x/tools v0.35.0 // indirect
|
||||
gonum.org/v1/gonum v0.13.0 // indirect
|
||||
google.golang.org/appengine v1.6.7 // indirect
|
||||
google.golang.org/protobuf v1.34.2 // indirect
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20250811230008-5f3141c8851a // indirect
|
||||
google.golang.org/protobuf v1.36.7 // indirect
|
||||
lukechampine.com/blake3 v1.2.1 // indirect
|
||||
)
|
||||
|
||||
172
go.sum
172
go.sum
@@ -37,11 +37,18 @@ dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7
|
||||
dmitri.shuralyov.com/html/belt v0.0.0-20180602232347-f7d459c86be0/go.mod h1:JLBrvjyP0v+ecvNYvCpyZgu5/xkfAUhi6wJj28eUfSU=
|
||||
dmitri.shuralyov.com/service/change v0.0.0-20181023043359-a85b471d5412/go.mod h1:a1inKt/atXimZ4Mv927x+r7UpyzRUf4emIoiiSC2TN4=
|
||||
dmitri.shuralyov.com/state v0.0.0-20180228185332-28bcc343414c/go.mod h1:0PRwlb0D6DFvNNtx+9ybjezNCa8XF0xaYcETyp6rHWU=
|
||||
filippo.io/age v1.1.1/go.mod h1:l03SrzDUrBkdBx8+IILdnn2KZysqQdbEBUQ4p3sqEQE=
|
||||
filippo.io/age v1.2.1 h1:X0TZjehAZylOIj4DubWYU1vWQxv9bJpo+Uu2/LGhi1o=
|
||||
filippo.io/age v1.2.1/go.mod h1:JL9ew2lTN+Pyft4RiNGguFfOpewKwSHm5ayKD/A4004=
|
||||
filippo.io/edwards25519 v1.1.0 h1:FNf4tywRC1HmFuKW5xopWpigGjJKiJSV0Cqo0cJWDaA=
|
||||
filippo.io/edwards25519 v1.1.0/go.mod h1:BxyFTGdWcka3PhytdK4V28tE5sGfRvvvRV7EaN4VDT4=
|
||||
git.apache.org/thrift.git v0.0.0-20180902110319-2566ecd5d999/go.mod h1:fPE2ZNJGynbRyZ4dJvy6G277gSllfV2HJqblrnkyeyg=
|
||||
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
|
||||
github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo=
|
||||
github.com/Microsoft/go-winio v0.4.14 h1:+hMXMk01us9KgxGb7ftKQt2Xpf5hH/yky+TDA+qxleU=
|
||||
github.com/Microsoft/go-winio v0.4.14/go.mod h1:qXqCSQ3Xa7+6tgxaGTIe4Kpcdsi+P8jBhyzoq1bpyYA=
|
||||
github.com/RoaringBitmap/roaring/v2 v2.4.5 h1:uGrrMreGjvAtTBobc0g5IrW1D5ldxDQYe2JW2gggRdg=
|
||||
github.com/RoaringBitmap/roaring/v2 v2.4.5/go.mod h1:FiJcsfkGje/nZBZgCu0ZxCPOKD/hVXDS2dXi7/eUFE0=
|
||||
github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
|
||||
github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
|
||||
github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=
|
||||
@@ -56,6 +63,45 @@ github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24
|
||||
github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8=
|
||||
github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM=
|
||||
github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw=
|
||||
github.com/bits-and-blooms/bitset v1.12.0/go.mod h1:7hO7Gc7Pp1vODcmWvKMRA9BNmbv6a/7QIWpPxHddWR8=
|
||||
github.com/bits-and-blooms/bitset v1.22.0 h1:Tquv9S8+SGaS3EhyA+up3FXzmkhxPGjQQCkcs2uw7w4=
|
||||
github.com/bits-and-blooms/bitset v1.22.0/go.mod h1:7hO7Gc7Pp1vODcmWvKMRA9BNmbv6a/7QIWpPxHddWR8=
|
||||
github.com/blevesearch/bleve/v2 v2.5.3 h1:9l1xtKaETv64SZc1jc4Sy0N804laSa/LeMbYddq1YEM=
|
||||
github.com/blevesearch/bleve/v2 v2.5.3/go.mod h1:Z/e8aWjiq8HeX+nW8qROSxiE0830yQA071dwR3yoMzw=
|
||||
github.com/blevesearch/bleve_index_api v1.2.8 h1:Y98Pu5/MdlkRyLM0qDHostYo7i+Vv1cDNhqTeR4Sy6Y=
|
||||
github.com/blevesearch/bleve_index_api v1.2.8/go.mod h1:rKQDl4u51uwafZxFrPD1R7xFOwKnzZW7s/LSeK4lgo0=
|
||||
github.com/blevesearch/geo v0.2.4 h1:ECIGQhw+QALCZaDcogRTNSJYQXRtC8/m8IKiA706cqk=
|
||||
github.com/blevesearch/geo v0.2.4/go.mod h1:K56Q33AzXt2YExVHGObtmRSFYZKYGv0JEN5mdacJJR8=
|
||||
github.com/blevesearch/go-faiss v1.0.25 h1:lel1rkOUGbT1CJ0YgzKwC7k+XH0XVBHnCVWahdCXk4U=
|
||||
github.com/blevesearch/go-faiss v1.0.25/go.mod h1:OMGQwOaRRYxrmeNdMrXJPvVx8gBnvE5RYrr0BahNnkk=
|
||||
github.com/blevesearch/go-porterstemmer v1.0.3 h1:GtmsqID0aZdCSNiY8SkuPJ12pD4jI+DdXTAn4YRcHCo=
|
||||
github.com/blevesearch/go-porterstemmer v1.0.3/go.mod h1:angGc5Ht+k2xhJdZi511LtmxuEf0OVpvUUNrwmM1P7M=
|
||||
github.com/blevesearch/gtreap v0.1.1 h1:2JWigFrzDMR+42WGIN/V2p0cUvn4UP3C4Q5nmaZGW8Y=
|
||||
github.com/blevesearch/gtreap v0.1.1/go.mod h1:QaQyDRAT51sotthUWAH4Sj08awFSSWzgYICSZ3w0tYk=
|
||||
github.com/blevesearch/mmap-go v1.0.4 h1:OVhDhT5B/M1HNPpYPBKIEJaD0F3Si+CrEKULGCDPWmc=
|
||||
github.com/blevesearch/mmap-go v1.0.4/go.mod h1:EWmEAOmdAS9z/pi/+Toxu99DnsbhG1TIxUoRmJw/pSs=
|
||||
github.com/blevesearch/scorch_segment_api/v2 v2.3.10 h1:Yqk0XD1mE0fDZAJXTjawJ8If/85JxnLd8v5vG/jWE/s=
|
||||
github.com/blevesearch/scorch_segment_api/v2 v2.3.10/go.mod h1:Z3e6ChN3qyN35yaQpl00MfI5s8AxUJbpTR/DL8QOQ+8=
|
||||
github.com/blevesearch/segment v0.9.1 h1:+dThDy+Lvgj5JMxhmOVlgFfkUtZV2kw49xax4+jTfSU=
|
||||
github.com/blevesearch/segment v0.9.1/go.mod h1:zN21iLm7+GnBHWTao9I+Au/7MBiL8pPFtJBJTsk6kQw=
|
||||
github.com/blevesearch/snowballstem v0.9.0 h1:lMQ189YspGP6sXvZQ4WZ+MLawfV8wOmPoD/iWeNXm8s=
|
||||
github.com/blevesearch/snowballstem v0.9.0/go.mod h1:PivSj3JMc8WuaFkTSRDW2SlrulNWPl4ABg1tC/hlgLs=
|
||||
github.com/blevesearch/upsidedown_store_api v1.0.2 h1:U53Q6YoWEARVLd1OYNc9kvhBMGZzVrdmaozG2MfoB+A=
|
||||
github.com/blevesearch/upsidedown_store_api v1.0.2/go.mod h1:M01mh3Gpfy56Ps/UXHjEO/knbqyQ1Oamg8If49gRwrQ=
|
||||
github.com/blevesearch/vellum v1.1.0 h1:CinkGyIsgVlYf8Y2LUQHvdelgXr6PYuvoDIajq6yR9w=
|
||||
github.com/blevesearch/vellum v1.1.0/go.mod h1:QgwWryE8ThtNPxtgWJof5ndPfx0/YMBh+W2weHKPw8Y=
|
||||
github.com/blevesearch/zapx/v11 v11.4.2 h1:l46SV+b0gFN+Rw3wUI1YdMWdSAVhskYuvxlcgpQFljs=
|
||||
github.com/blevesearch/zapx/v11 v11.4.2/go.mod h1:4gdeyy9oGa/lLa6D34R9daXNUvfMPZqUYjPwiLmekwc=
|
||||
github.com/blevesearch/zapx/v12 v12.4.2 h1:fzRbhllQmEMUuAQ7zBuMvKRlcPA5ESTgWlDEoB9uQNE=
|
||||
github.com/blevesearch/zapx/v12 v12.4.2/go.mod h1:TdFmr7afSz1hFh/SIBCCZvcLfzYvievIH6aEISCte58=
|
||||
github.com/blevesearch/zapx/v13 v13.4.2 h1:46PIZCO/ZuKZYgxI8Y7lOJqX3Irkc3N8W82QTK3MVks=
|
||||
github.com/blevesearch/zapx/v13 v13.4.2/go.mod h1:knK8z2NdQHlb5ot/uj8wuvOq5PhDGjNYQQy0QDnopZk=
|
||||
github.com/blevesearch/zapx/v14 v14.4.2 h1:2SGHakVKd+TrtEqpfeq8X+So5PShQ5nW6GNxT7fWYz0=
|
||||
github.com/blevesearch/zapx/v14 v14.4.2/go.mod h1:rz0XNb/OZSMjNorufDGSpFpjoFKhXmppH9Hi7a877D8=
|
||||
github.com/blevesearch/zapx/v15 v15.4.2 h1:sWxpDE0QQOTjyxYbAVjt3+0ieu8NCE0fDRaFxEsp31k=
|
||||
github.com/blevesearch/zapx/v15 v15.4.2/go.mod h1:1pssev/59FsuWcgSnTa0OeEpOzmhtmr/0/11H0Z8+Nw=
|
||||
github.com/blevesearch/zapx/v16 v16.2.4 h1:tGgfvleXTAkwsD5mEzgM3zCS/7pgocTCnO1oyAUjlww=
|
||||
github.com/blevesearch/zapx/v16 v16.2.4/go.mod h1:Rti/REtuuMmzwsI8/C/qIzRaEoSK/wiFYw5e5ctUKKs=
|
||||
github.com/bradfitz/go-smtpd v0.0.0-20170404230938-deb6d6237625/go.mod h1:HYsPBTaaSFSlLx/70C2HPIMNZpVV8+vt/A+FMnYP11g=
|
||||
github.com/buger/jsonparser v0.0.0-20181115193947-bf1c66bbce23/go.mod h1:bbYlZJ7hK1yFx9hf58LP0zeX7UjIGs20ufpu3evjr+s=
|
||||
github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
|
||||
@@ -91,6 +137,8 @@ github.com/decred/dcrd/crypto/blake256 v1.0.1 h1:7PltbUIQB7u/FfZ39+DGa/ShuMyJ5il
|
||||
github.com/decred/dcrd/crypto/blake256 v1.0.1/go.mod h1:2OfgNZ5wDpcsFmHmCK5gZTPcCXqlm2ArzUIkw9czNJo=
|
||||
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0 h1:8UrgZ3GkP4i/CLijOJx79Yu+etlyjdBU4sfcs2WYQMs=
|
||||
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0/go.mod h1:v57UDF4pDQJcEfFUCRop3lJL149eHGSe9Jvczhzjo/0=
|
||||
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f h1:lO4WD4F/rVNCu3HqELle0jiPLLBs70cWOduZpkS1E78=
|
||||
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f/go.mod h1:cuUVRXasLTGF7a8hSLbxyZXjz+1KgoB3wDUb6vlszIc=
|
||||
github.com/distribution/reference v0.6.0 h1:0IXCQ5g4/QMHHkarYzh5l+u8T3t73zM5QvfrDyIgxBk=
|
||||
github.com/distribution/reference v0.6.0/go.mod h1:BbU0aIcezP1/5jX/8MP0YiH4SdvB5Y4f/wlDRiLyi3E=
|
||||
github.com/docker/docker v28.3.2+incompatible h1:wn66NJ6pWB1vBZIilP8G3qQPqHy5XymfYn5vsqeA5oA=
|
||||
@@ -137,9 +185,12 @@ github.com/go-logr/logr v1.4.3 h1:CjnDlHq8ikf6E492q6eKboGOC0T8CDaOvkHCIg8idEI=
|
||||
github.com/go-logr/logr v1.4.3/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY=
|
||||
github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag=
|
||||
github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE=
|
||||
github.com/go-redis/redis/v8 v8.11.5 h1:AcZZR7igkdvfVmQTPnu9WE37LRrO/YrBH5zWyjDC0oI=
|
||||
github.com/go-redis/redis/v8 v8.11.5/go.mod h1:gREzHqY1hg6oD9ngVRbLStwAWKhA0FEgq8Jd4h5lpwo=
|
||||
github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY=
|
||||
github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 h1:tfuBGBXKqDEevZMzYi5KSi8KkcZtzBcTgAUUtapy0OI=
|
||||
github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572/go.mod h1:9Pwr4B2jHnOSGXyyzV8ROjYa2ojvAY6HCGYYfMoC3Ls=
|
||||
github.com/go-yaml/yaml v2.1.0+incompatible/go.mod h1:w2MrLa16VYP0jy6N7M5kHaCkaLENm+P+Tv+MfurjSw0=
|
||||
github.com/godbus/dbus/v5 v5.0.3/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA=
|
||||
github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA=
|
||||
github.com/godbus/dbus/v5 v5.1.0 h1:4KLkAxT3aOY8Li4FRJe/KvhoNFFxo0m6fNuFUO8QJUk=
|
||||
@@ -178,6 +229,8 @@ github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaS
|
||||
github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY=
|
||||
github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg=
|
||||
github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY=
|
||||
github.com/golang/snappy v0.0.4 h1:yAGX7huGHXlcLOEtBnF4w7FQwA26wojNCwOYAEhLjQM=
|
||||
github.com/golang/snappy v0.0.4/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
|
||||
github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ=
|
||||
github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ=
|
||||
github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M=
|
||||
@@ -188,6 +241,7 @@ github.com/google/go-cmp v0.4.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/
|
||||
github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||
github.com/google/go-cmp v0.5.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||
github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||
github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||
github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
|
||||
@@ -214,6 +268,9 @@ github.com/google/pprof v0.0.0-20200708004538-1a94d8640e99/go.mod h1:ZgVRPoUq/hf
|
||||
github.com/google/pprof v0.0.0-20231023181126-ff6d637d2a7b h1:RMpPgZTSApbPf7xaVel+QkoGPRLFLrwFO89uDUHEGf0=
|
||||
github.com/google/pprof v0.0.0-20231023181126-ff6d637d2a7b/go.mod h1:czg5+yv1E0ZGTi6S6vVK1mke0fV+FaUhNGcd6VRS9Ik=
|
||||
github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI=
|
||||
github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
|
||||
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||
github.com/googleapis/gax-go v2.0.0+incompatible/go.mod h1:SFVmujtThgffbyetf+mdk2eWhX2bMyUtNHzFKcPA9HY=
|
||||
github.com/googleapis/gax-go/v2 v2.0.3/go.mod h1:LLvjysVCY1JZeum8Z6l8qUty8fiNwE08qbEPm1M08qg=
|
||||
github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg=
|
||||
@@ -225,31 +282,54 @@ github.com/gorilla/websocket v1.5.0 h1:PPwGk2jz7EePpoHN/+ClbZu8SPxiqlu12wZP/3sWm
|
||||
github.com/gorilla/websocket v1.5.0/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
|
||||
github.com/gregjones/httpcache v0.0.0-20180305231024-9cad4c3443a7/go.mod h1:FecbI9+v66THATjSRHfNgh1IVFe/9kFxbXtjV0ctIMA=
|
||||
github.com/grpc-ecosystem/grpc-gateway v1.5.0/go.mod h1:RSKVYQBd5MCa4OVpNdGskqpgL2+G+NZTnrVHpWWfpdw=
|
||||
github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4=
|
||||
github.com/hashicorp/errwrap v1.1.0 h1:OxrOeh75EUXMY8TBjag2fzXGZ40LB6IKw45YeGUDY2I=
|
||||
github.com/hashicorp/errwrap v1.1.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4=
|
||||
github.com/hashicorp/go-multierror v1.1.1 h1:H5DkEtf6CXdFp0N0Em5UCwQpXMWke8IA0+lD48awMYo=
|
||||
github.com/hashicorp/go-multierror v1.1.1/go.mod h1:iw975J/qwKPdAO1clOe2L8331t/9/fmwbPZ6JB6eMoM=
|
||||
github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
|
||||
github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
|
||||
github.com/hashicorp/golang-lru v0.5.4 h1:YDjusn29QI/Das2iO9M0BHnIbxPeyuCHsjMW+lJfyTc=
|
||||
github.com/hashicorp/golang-lru v0.5.4/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4=
|
||||
github.com/hashicorp/golang-lru/v2 v2.0.5 h1:wW7h1TG88eUIJ2i69gaE3uNVtEPIagzhGvHgwfx2Vm4=
|
||||
github.com/hashicorp/golang-lru/v2 v2.0.5/go.mod h1:QeFd9opnmA6QUJc5vARoKUSoFhyfM2/ZepoAG6RGpeM=
|
||||
github.com/huin/goupnp v1.3.0 h1:UvLUlWDNpoUdYzb2TCn+MuTWtcjXKSza2n6CBdQ0xXc=
|
||||
github.com/huin/goupnp v1.3.0/go.mod h1:gnGPsThkYa7bFi/KWmEysQRf48l2dvR5bxr2OFckNX8=
|
||||
github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc=
|
||||
github.com/ipfs/boxo v0.10.0 h1:tdDAxq8jrsbRkYoF+5Rcqyeb91hgWe2hp7iLu7ORZLY=
|
||||
github.com/ipfs/boxo v0.10.0/go.mod h1:Fg+BnfxZ0RPzR0nOodzdIq3A7KgoWAOWsEIImrIQdBM=
|
||||
github.com/ipfs/go-cid v0.4.1 h1:A/T3qGvxi4kpKWWcPC/PgbvDA2bjVLO7n4UeVwnbs/s=
|
||||
github.com/ipfs/go-cid v0.4.1/go.mod h1:uQHwDeX4c6CtyrFwdqyhpNcxVewur1M7l7fNU7LKwZk=
|
||||
github.com/ipfs/go-cid v0.5.0 h1:goEKKhaGm0ul11IHA7I6p1GmKz8kEYniqFopaB5Otwg=
|
||||
github.com/ipfs/go-cid v0.5.0/go.mod h1:0L7vmeNXpQpUS9vt+yEARkJ8rOg43DF3iPgn4GIN0mk=
|
||||
github.com/ipfs/go-datastore v0.6.0 h1:JKyz+Gvz1QEZw0LsX1IBn+JFCJQH4SJVFtM4uWU0Myk=
|
||||
github.com/ipfs/go-datastore v0.6.0/go.mod h1:rt5M3nNbSO/8q1t4LNkLyUwRs8HupMeN/8O4Vn9YAT8=
|
||||
github.com/ipfs/go-detect-race v0.0.1 h1:qX/xay2W3E4Q1U7d9lNs1sU9nvguX0a7319XbyQ6cOk=
|
||||
github.com/ipfs/go-detect-race v0.0.1/go.mod h1:8BNT7shDZPo99Q74BpGMK+4D8Mn4j46UU0LZ723meps=
|
||||
github.com/ipfs/go-log v1.0.5 h1:2dOuUCB1Z7uoczMWgAyDck5JLb72zHzrMnGnCNNbvY8=
|
||||
github.com/ipfs/go-log v1.0.5/go.mod h1:j0b8ZoR+7+R99LD9jZ6+AJsrzkPbSXbZfGakb5JPtIo=
|
||||
github.com/ipfs/go-log/v2 v2.1.3/go.mod h1:/8d0SH3Su5Ooc31QlL1WysJhvyOTDCjcCZ9Axpmri6g=
|
||||
github.com/ipfs/go-log/v2 v2.5.1 h1:1XdUzF7048prq4aBjDQQ4SL5RxftpRGdXhNRwKSAlcY=
|
||||
github.com/ipfs/go-log/v2 v2.5.1/go.mod h1:prSpmC1Gpllc9UYWxDiZDreBYw7zp4Iqp1kOLU9U5UI=
|
||||
github.com/ipld/go-ipld-prime v0.20.0 h1:Ud3VwE9ClxpO2LkCYP7vWPc0Fo+dYdYzgxUJZ3uRG4g=
|
||||
github.com/ipld/go-ipld-prime v0.20.0/go.mod h1:PzqZ/ZR981eKbgdr3y2DJYeD/8bgMawdGVlJDE8kK+M=
|
||||
github.com/jackpal/go-nat-pmp v1.0.2 h1:KzKSgb7qkJvOUTqYl9/Hg/me3pWgBmERKrTGD7BdWus=
|
||||
github.com/jackpal/go-nat-pmp v1.0.2/go.mod h1:QPH045xvCAeXUZOxsnwmrtiCoxIr9eob+4orBN1SBKc=
|
||||
github.com/jbenet/go-cienv v0.1.0/go.mod h1:TqNnHUmJgXau0nCzC7kXWeotg3J9W34CUv5Djy1+FlA=
|
||||
github.com/jbenet/go-temp-err-catcher v0.1.0 h1:zpb3ZH6wIE8Shj2sKS+khgRvf7T7RABoLk/+KKHggpk=
|
||||
github.com/jbenet/go-temp-err-catcher v0.1.0/go.mod h1:0kJRvmDZXNMIiJirNPEYfhpPwbGVtZVWC34vc5WLsDk=
|
||||
github.com/jbenet/goprocess v0.1.4 h1:DRGOFReOMqqDNXwW70QkacFW0YN9QnwLV0Vqk+3oU0o=
|
||||
github.com/jbenet/goprocess v0.1.4/go.mod h1:5yspPrukOVuOLORacaBi858NqyClJPQxYZlqdZVfqY4=
|
||||
github.com/jellevandenhooff/dkim v0.0.0-20150330215556-f50fe3d243e1/go.mod h1:E0B/fFc00Y+Rasa88328GlI/XbtyysCtTHZS8h7IrBU=
|
||||
github.com/jpillora/backoff v1.0.0/go.mod h1:J/6gKK9jxlEcS3zixgDgUAsiuZ7yrSoa/FX5e0EB2j4=
|
||||
github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU=
|
||||
github.com/json-iterator/go v1.1.10/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
|
||||
github.com/json-iterator/go v1.1.11/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
|
||||
github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM=
|
||||
github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo=
|
||||
github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU=
|
||||
github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk=
|
||||
github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU=
|
||||
github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w=
|
||||
github.com/julienschmidt/httprouter v1.3.0/go.mod h1:JR6WtHb+2LUe8TCKY3cZOxFyyO8IZAc4RVcycCCAKdM=
|
||||
github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQLJ+jE2L00=
|
||||
@@ -284,8 +364,14 @@ github.com/libp2p/go-libp2p-asn-util v0.3.0 h1:gMDcMyYiZKkocGXDQ5nsUQyquC9+H+iLE
|
||||
github.com/libp2p/go-libp2p-asn-util v0.3.0/go.mod h1:B1mcOrKUE35Xq/ASTmQ4tN3LNzVVaMNmq2NACuqyB9w=
|
||||
github.com/libp2p/go-libp2p-kad-dht v0.25.2 h1:FOIk9gHoe4YRWXTu8SY9Z1d0RILol0TrtApsMDPjAVQ=
|
||||
github.com/libp2p/go-libp2p-kad-dht v0.25.2/go.mod h1:6za56ncRHYXX4Nc2vn8z7CZK0P4QiMcrn77acKLM2Oo=
|
||||
github.com/libp2p/go-libp2p-kbucket v0.6.3 h1:p507271wWzpy2f1XxPzCQG9NiN6R6lHL9GiSErbQQo0=
|
||||
github.com/libp2p/go-libp2p-kbucket v0.6.3/go.mod h1:RCseT7AH6eJWxxk2ol03xtP9pEHetYSPXOaJnOiD8i0=
|
||||
github.com/libp2p/go-libp2p-pubsub v0.10.0 h1:wS0S5FlISavMaAbxyQn3dxMOe2eegMfswM471RuHJwA=
|
||||
github.com/libp2p/go-libp2p-pubsub v0.10.0/go.mod h1:1OxbaT/pFRO5h+Dpze8hdHQ63R0ke55XTs6b6NwLLkw=
|
||||
github.com/libp2p/go-libp2p-record v0.2.0 h1:oiNUOCWno2BFuxt3my4i1frNrt7PerzB3queqa1NkQ0=
|
||||
github.com/libp2p/go-libp2p-record v0.2.0/go.mod h1:I+3zMkvvg5m2OcSdoL0KPljyJyvNDFGKX7QdlpYUcwk=
|
||||
github.com/libp2p/go-libp2p-routing-helpers v0.7.2 h1:xJMFyhQ3Iuqnk9Q2dYE1eUTzsah7NLw3Qs2zjUV78T0=
|
||||
github.com/libp2p/go-libp2p-routing-helpers v0.7.2/go.mod h1:cN4mJAD/7zfPKXBcs9ze31JGYAZgzdABEm+q/hkswb8=
|
||||
github.com/libp2p/go-libp2p-testing v0.12.0 h1:EPvBb4kKMWO29qP4mZGyhVzUyR25dvfUIK5WDu6iPUA=
|
||||
github.com/libp2p/go-libp2p-testing v0.12.0/go.mod h1:KcGDRXyN7sQCllucn1cOOS+Dmm7ujhfEyXQL5lvkcPg=
|
||||
github.com/libp2p/go-msgio v0.3.0 h1:mf3Z8B1xcFN314sWX+2vOTShIE0Mmn2TXn3YCUQGNj0=
|
||||
@@ -328,13 +414,17 @@ github.com/minio/sha256-simd v1.0.1/go.mod h1:Pz6AKMiUdngCLpeTL/RJY1M9rUuPMYujV5
|
||||
github.com/moby/docker-image-spec v1.3.1 h1:jMKff3w6PgbfSa69GfNg+zN/XLhfXJGnEx3Nl2EsFP0=
|
||||
github.com/moby/docker-image-spec v1.3.1/go.mod h1:eKmb5VW8vQEh/BAr2yvVNvuiJuY6UIocYsFu/DxxRpo=
|
||||
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
|
||||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg=
|
||||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
|
||||
github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
|
||||
github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
|
||||
github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M=
|
||||
github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk=
|
||||
github.com/mr-tron/base58 v1.1.2/go.mod h1:BinMc/sQntlIE1frQmRFPUoPA1Zkr8VRgBdjWI2mNwc=
|
||||
github.com/mr-tron/base58 v1.2.0 h1:T/HDJBh4ZCPbU39/+c3rRvE0uKBQlU27+QI8LJ4t64o=
|
||||
github.com/mr-tron/base58 v1.2.0/go.mod h1:BinMc/sQntlIE1frQmRFPUoPA1Zkr8VRgBdjWI2mNwc=
|
||||
github.com/mschoch/smat v0.2.0 h1:8imxQsjDm8yFEAVBe7azKmKSgzSkZXDuKkSq9374khM=
|
||||
github.com/mschoch/smat v0.2.0/go.mod h1:kc9mz7DoBKqDyiRL7VZN8KvXQMWeTaVnttLRXOlotKw=
|
||||
github.com/multiformats/go-base32 v0.1.0 h1:pVx9xoSPqEIQG8o+UbAe7DNi51oej1NtK+aGkbLYxPE=
|
||||
github.com/multiformats/go-base32 v0.1.0/go.mod h1:Kj3tFY6zNr+ABYMqeUNeGvkIC/UYgtWibDcT0rExnbI=
|
||||
github.com/multiformats/go-base36 v0.2.0 h1:lFsAbNOGeKtuKozrtBsAkSVhv1p9D0/qedU9rQyccr0=
|
||||
@@ -374,6 +464,8 @@ github.com/opencontainers/image-spec v1.1.1/go.mod h1:qpqAh3Dmcf36wStyyWU+kCeDgr
|
||||
github.com/opencontainers/runtime-spec v1.0.2/go.mod h1:jwyrGlmzljRJv/Fgzds9SsS/C5hL+LL3ko9hs6T5lQ0=
|
||||
github.com/opencontainers/runtime-spec v1.1.0 h1:HHUyrt9mwHUjtasSbXSMvs4cyFxh+Bll4AjJ9odEGpg=
|
||||
github.com/opencontainers/runtime-spec v1.1.0/go.mod h1:jwyrGlmzljRJv/Fgzds9SsS/C5hL+LL3ko9hs6T5lQ0=
|
||||
github.com/opentracing/opentracing-go v1.2.0 h1:uEJPy/1a5RIPAJ0Ov+OIO8OxWu77jEv+1B0VhjKrZUs=
|
||||
github.com/opentracing/opentracing-go v1.2.0/go.mod h1:GxEUsuufX4nBwe+T+Wl9TAgYrxe9dPLANfrWvHYVTgc=
|
||||
github.com/openzipkin/zipkin-go v0.1.1/go.mod h1:NtoC/o8u3JlF1lSlyPNswIbeQH9bJTmOf0Erfk+hxe8=
|
||||
github.com/pbnjay/memory v0.0.0-20210728143218-7b4eea64cf58 h1:onHthvaw9LFnH4t2DcNVpwGmV9E1BkGknEliJkfwQj0=
|
||||
github.com/pbnjay/memory v0.0.0-20210728143218-7b4eea64cf58/go.mod h1:DXv8WO4yhMYhSNPKjeNKa5WY9YCIEBRbNzFFPJbWO6Y=
|
||||
@@ -383,6 +475,8 @@ github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
|
||||
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||
github.com/polydawn/refmt v0.89.0 h1:ADJTApkvkeBZsN0tBTx8QjpD9JkmxbKp0cxfr9qszm4=
|
||||
github.com/polydawn/refmt v0.89.0/go.mod h1:/zvteZs/GwLtCgZ4BL6CBsk9IKIlexP43ObX9AxTqTw=
|
||||
github.com/prometheus/client_golang v0.8.0/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw=
|
||||
github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw=
|
||||
github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo=
|
||||
@@ -391,6 +485,8 @@ github.com/prometheus/client_golang v1.11.0/go.mod h1:Z6t4BnS23TR94PD6BsDNk8yVqr
|
||||
github.com/prometheus/client_golang v1.12.1/go.mod h1:3Z9XVyYiZYEO+YQWt3RD2R3jrbd179Rt297l4aS6nDY=
|
||||
github.com/prometheus/client_golang v1.14.0 h1:nJdhIvne2eSX/XRAFV9PcvFFRbrjbcTUj0VP62TMhnw=
|
||||
github.com/prometheus/client_golang v1.14.0/go.mod h1:8vpkKitgIVNcqrRBWh1C4TIUQgYNtG/XQE4E/Zae36Y=
|
||||
github.com/prometheus/client_golang v1.16.0 h1:yk/hx9hDbrGHovbci4BY+pRMfSuuat626eFsHb7tmT8=
|
||||
github.com/prometheus/client_golang v1.16.0/go.mod h1:Zsulrv/L9oM40tJ7T815tM89lFEugiJ9HzIqaAx4LKc=
|
||||
github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo=
|
||||
github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
|
||||
github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
|
||||
@@ -404,6 +500,8 @@ github.com/prometheus/common v0.26.0/go.mod h1:M7rCNAaPfAosfx8veZJCuw84e35h3Cfd9
|
||||
github.com/prometheus/common v0.32.1/go.mod h1:vu+V0TpY+O6vW9J44gczi3Ap/oXXR10b+M/gUGO4Hls=
|
||||
github.com/prometheus/common v0.37.0 h1:ccBbHCgIiT9uSoFY0vX8H3zsNR5eLt17/RQLUvn8pXE=
|
||||
github.com/prometheus/common v0.37.0/go.mod h1:phzohg0JFMnBEFGxTDbfu3QyL5GI8gTQJFhYO5B3mfA=
|
||||
github.com/prometheus/common v0.44.0 h1:+5BrQJwiBB9xsMygAB3TNvpQKOwlkc25LbISbrdOOfY=
|
||||
github.com/prometheus/common v0.44.0/go.mod h1:ofAIvZbQ1e/nugmZGz4/qCb9Ap1VoSTIO7x0VV9VvuY=
|
||||
github.com/prometheus/procfs v0.0.0-20180725123919-05ee40e3a273/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk=
|
||||
github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk=
|
||||
github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA=
|
||||
@@ -412,6 +510,8 @@ github.com/prometheus/procfs v0.6.0/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1
|
||||
github.com/prometheus/procfs v0.7.3/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA=
|
||||
github.com/prometheus/procfs v0.8.0 h1:ODq8ZFEaYeCaZOJlZZdJA2AbQR98dSHSM1KW/You5mo=
|
||||
github.com/prometheus/procfs v0.8.0/go.mod h1:z7EfXMXOkbkqb9IINtpCn86r/to3BnA0uaxHdg830/4=
|
||||
github.com/prometheus/procfs v0.11.1 h1:xRC8Iq1yyca5ypa9n1EZnWZkt7dwcoRPQwX/5gwaUuI=
|
||||
github.com/prometheus/procfs v0.11.1/go.mod h1:eesXgaPo1q7lBpVMoMy0ZOFTth9hBn4W/y0/p/ScXhY=
|
||||
github.com/quic-go/qpack v0.4.0 h1:Cr9BXA1sQS2SmDUWjSofMPNKmvF6IiIfDRmgU0w1ZCo=
|
||||
github.com/quic-go/qpack v0.4.0/go.mod h1:UZVnYIfi5GRk+zI9UMaCPsmZ2xKJP7XBUvVyT1Knj9A=
|
||||
github.com/quic-go/qtls-go1-20 v0.3.4 h1:MfFAPULvst4yoMgY9QmtpYmfij/em7O8UUi+bNVm7Cg=
|
||||
@@ -422,9 +522,13 @@ github.com/quic-go/webtransport-go v0.6.0 h1:CvNsKqc4W2HljHJnoT+rMmbRJybShZ0YPFD
|
||||
github.com/quic-go/webtransport-go v0.6.0/go.mod h1:9KjU4AEBqEQidGHNDkZrb8CAa1abRaosM2yGOyiikEc=
|
||||
github.com/raulk/go-watchdog v1.3.0 h1:oUmdlHxdkXRJlwfG0O9omj8ukerm8MEQavSiDTEtBsk=
|
||||
github.com/raulk/go-watchdog v1.3.0/go.mod h1:fIvOnLbF0b0ZwkB9YU4mOW9Did//4vPZtDqv66NfsMU=
|
||||
github.com/robfig/cron/v3 v3.0.1 h1:WdRxkvbJztn8LMz/QEvLN5sBU+xKpSqwwUO1Pjr4qDs=
|
||||
github.com/robfig/cron/v3 v3.0.1/go.mod h1:eQICP3HwyT7UooqI/z+Ov+PtYAWygg1TEWWzGIFLtro=
|
||||
github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4=
|
||||
github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g=
|
||||
github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
|
||||
github.com/sashabaranov/go-openai v1.41.1 h1:zf5tM+GuxpyiyD9XZg8nCqu52eYFQg9OOew0gnIuDy4=
|
||||
github.com/sashabaranov/go-openai v1.41.1/go.mod h1:lj5b/K+zjTSFxVLijLSTDZuP7adOgerWeFyZLUhAKRg=
|
||||
github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo=
|
||||
github.com/shurcooL/component v0.0.0-20170202220835-f88ec8f54cc4/go.mod h1:XhFIlyj5a1fBNx5aJTbKoIq0mNaPvOagO+HjB3EtxrY=
|
||||
github.com/shurcooL/events v0.0.0-20181021180414-410e4ca65f48/go.mod h1:5u70Mqkb5O5cxEA8nxTsgrgLehJeAw6Oc4Ab1c/P1HM=
|
||||
@@ -454,45 +558,67 @@ github.com/sirupsen/logrus v1.4.1/go.mod h1:ni0Sbl8bgC9z8RoU9G6nDWqqs/fq4eDPysMB
|
||||
github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE=
|
||||
github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88=
|
||||
github.com/sirupsen/logrus v1.7.0/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0=
|
||||
github.com/smartystreets/assertions v1.2.0/go.mod h1:tcbTF8ujkAEcZ8TElKY+i30BzYlVhC/LOxJk7iOWnoo=
|
||||
github.com/smartystreets/goconvey v1.7.2/go.mod h1:Vw0tHAZW6lzCRk3xgdin6fKYcG+G3Pg9vgXWeJpQFMM=
|
||||
github.com/sourcegraph/annotate v0.0.0-20160123013949-f4cad6c6324d/go.mod h1:UdhH50NIW0fCiwBSr0co2m7BnFLdv4fQTgdqdJTHFeE=
|
||||
github.com/sourcegraph/syntaxhighlight v0.0.0-20170531221838-bd320f5d308e/go.mod h1:HuIsMU8RRBOtsCgI77wP899iHVBQpCmg4ErYMZB+2IA=
|
||||
github.com/spaolacci/murmur3 v1.1.0 h1:7c1g84S4BPRrfL5Xrdp6fOJ206sU9y293DDHaoy0bLI=
|
||||
github.com/spaolacci/murmur3 v1.1.0/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA=
|
||||
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||
github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
|
||||
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
|
||||
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
|
||||
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
|
||||
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
|
||||
github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
|
||||
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
|
||||
github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk=
|
||||
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
|
||||
github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA=
|
||||
github.com/tarm/serial v0.0.0-20180830185346-98f6abe2eb07/go.mod h1:kDXzergiv9cbyO7IOYJZWg1U88JhDg3PB6klq9Hg2pA=
|
||||
github.com/urfave/cli v1.22.2/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0=
|
||||
github.com/urfave/cli v1.22.10/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0=
|
||||
github.com/viant/assertly v0.4.8/go.mod h1:aGifi++jvCrUaklKEKT0BU95igDNaqkvz+49uaYMPRU=
|
||||
github.com/viant/toolbox v0.24.0/go.mod h1:OxMCG57V0PXuIP2HNQrtJf2CjqdmbrOx5EkMILuUhzM=
|
||||
github.com/warpfork/go-wish v0.0.0-20220906213052-39a1cc7a02d0/go.mod h1:x6AKhvSSexNrVSrViXSHUEbICjmGXhtgABaHIySUSGw=
|
||||
github.com/whyrusleeping/go-keyspace v0.0.0-20160322163242-5b898ac5add1 h1:EKhdznlJHPMoKr0XTrX+IlJs1LH3lyx2nfr1dOlZ79k=
|
||||
github.com/whyrusleeping/go-keyspace v0.0.0-20160322163242-5b898ac5add1/go.mod h1:8UvriyWtv5Q5EOgjHaSseUEdkQfvwFv1I/In/O2M9gc=
|
||||
github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
|
||||
github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
|
||||
github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
|
||||
github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
|
||||
github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k=
|
||||
go.etcd.io/bbolt v1.4.0 h1:TU77id3TnN/zKr7CO/uk+fBCwF2jGcMuw2B/FMAzYIk=
|
||||
go.etcd.io/bbolt v1.4.0/go.mod h1:AsD+OCi/qPN1giOX1aiLAha3o1U8rAz65bvN4j0sRuk=
|
||||
go.opencensus.io v0.18.0/go.mod h1:vKdFvxhtzZ9onBp9VKHK8z/sRpBMnKAsufL7wlDrCOA=
|
||||
go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU=
|
||||
go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8=
|
||||
go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw=
|
||||
go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw=
|
||||
go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw=
|
||||
go.opencensus.io v0.24.0 h1:y73uSU6J157QMP2kn2r30vwW1A2W2WFwSCGnAVxeaD0=
|
||||
go.opencensus.io v0.24.0/go.mod h1:vNK8G9p7aAivkbmorf4v+7Hgx+Zs0yY+0fOtgBfjQKo=
|
||||
go.opentelemetry.io/auto/sdk v1.1.0 h1:cH53jehLUN6UFLY71z+NDOiNJqDdPRaXzTel0sJySYA=
|
||||
go.opentelemetry.io/auto/sdk v1.1.0/go.mod h1:3wSPjt5PWp2RhlCcmmOial7AvC4DQqZb7a7wCow3W8A=
|
||||
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.62.0 h1:Hf9xI/XLML9ElpiHVDNwvqI0hIFlzV8dgIr35kV1kRU=
|
||||
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.62.0/go.mod h1:NfchwuyNoMcZ5MLHwPrODwUF1HWCXWrL31s8gSAdIKY=
|
||||
go.opentelemetry.io/otel v1.37.0 h1:9zhNfelUvx0KBfu/gb+ZgeAfAgtWrfHJZcAqFC228wQ=
|
||||
go.opentelemetry.io/otel v1.37.0/go.mod h1:ehE/umFRLnuLa/vSccNq9oS1ErUlkkK71gMcN34UG8I=
|
||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.37.0 h1:Ahq7pZmv87yiyn3jeFz/LekZmPLLdKejuO3NcK9MssM=
|
||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.37.0/go.mod h1:MJTqhM0im3mRLw1i8uGHnCvUEeS7VwRyxlLC78PA18M=
|
||||
go.opentelemetry.io/otel/metric v1.37.0 h1:mvwbQS5m0tbmqML4NqK+e3aDiO02vsf/WgbsdpcPoZE=
|
||||
go.opentelemetry.io/otel/metric v1.37.0/go.mod h1:04wGrZurHYKOc+RKeye86GwKiTb9FKm1WHtO+4EVr2E=
|
||||
go.opentelemetry.io/otel/sdk v1.37.0 h1:ItB0QUqnjesGRvNcmAcU0LyvkVyGJ2xftD29bWdDvKI=
|
||||
go.opentelemetry.io/otel/sdk v1.37.0/go.mod h1:VredYzxUvuo2q3WRcDnKDjbdvmO0sCzOvVAiY+yUkAg=
|
||||
go.opentelemetry.io/otel/trace v1.37.0 h1:HLdcFNbRQBE2imdSEgm/kwqmQj1Or1l/7bW6mxVK7z4=
|
||||
go.opentelemetry.io/otel/trace v1.37.0/go.mod h1:TlgrlQ+PtQO5XFerSPUYG0JSgGyryXewPGyayAWSBS0=
|
||||
go.opentelemetry.io/proto/otlp v1.7.0 h1:jX1VolD6nHuFzOYso2E73H85i92Mv8JQYk0K9vz09os=
|
||||
go.opentelemetry.io/proto/otlp v1.7.0/go.mod h1:fSKjH6YJ7HDlwzltzyMj036AJ3ejJLCgCSHGj4efDDo=
|
||||
go.uber.org/atomic v1.6.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ=
|
||||
go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc=
|
||||
go.uber.org/atomic v1.11.0 h1:ZvwS0R+56ePWxUNi+Atn9dWONBPp/AUETXlHW0DxSjE=
|
||||
go.uber.org/atomic v1.11.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0=
|
||||
@@ -505,9 +631,12 @@ go.uber.org/goleak v1.2.0 h1:xqgm/S+aQvhWFTtR0XK3Jvg7z8kGV8P4X14IzwN3Eqk=
|
||||
go.uber.org/goleak v1.2.0/go.mod h1:XJYK+MuIchqpmGmUSAzotztawfKvYLUIgg7guXrwVUo=
|
||||
go.uber.org/mock v0.3.0 h1:3mUxI1No2/60yUYax92Pt8eNOEecx2D3lcXZh2NEZJo=
|
||||
go.uber.org/mock v0.3.0/go.mod h1:a6FSlNadKUHUa9IP5Vyt1zh4fC7uAwxMutEAscFbkZc=
|
||||
go.uber.org/multierr v1.5.0/go.mod h1:FeouvMocqHpRaaGuG9EjoKcStLC43Zu/fmqdUMPcKYU=
|
||||
go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU=
|
||||
go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0=
|
||||
go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y=
|
||||
go.uber.org/tools v0.0.0-20190618225709-2cfd321de3ee/go.mod h1:vJERXedbb3MVM5f9Ejo0C68/HhF8uaILCdgjnY+goOA=
|
||||
go.uber.org/zap v1.16.0/go.mod h1:MA8QOfq0BHJwdXa996Y4dYkAqRKB8/1K1QMMZVaNZjQ=
|
||||
go.uber.org/zap v1.19.1/go.mod h1:j3DNczoxDZroyBnOT1L/Q79cfUMGZxlv/9dzN7SM1rI=
|
||||
go.uber.org/zap v1.26.0 h1:sI7k6L95XOKS281NhVKOFCUNIvv9e0w4BF8N3u+tCRo=
|
||||
go.uber.org/zap v1.26.0/go.mod h1:dtElttAiwGvoJ/vj4IwHBS/gXsEu/pZ50mUIRWuG0so=
|
||||
@@ -526,6 +655,11 @@ golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPh
|
||||
golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4=
|
||||
golang.org/x/crypto v0.16.0 h1:mMMrFzRSCF0GvB7Ne27XVtVAaXLrPmgPC7/v0tkwHaY=
|
||||
golang.org/x/crypto v0.16.0/go.mod h1:gCAAfMLgwOJRpTjQ2zCCt2OcSfYMTeZVSRtQlPC7Nq4=
|
||||
golang.org/x/crypto v0.24.0 h1:mnl8DM0o513X8fdIkmyFE/5hTYxbwYOjDS/+rK6qpRI=
|
||||
golang.org/x/crypto v0.24.0/go.mod h1:Z1PMYSOR5nyMcyAVAIQSKCDwalqy85Aqn1x3Ws4L5DM=
|
||||
golang.org/x/crypto v0.38.0/go.mod h1:MvrbAqul58NNYPKnOra203SB9vpuZW0e+RRZV+Ggqjw=
|
||||
golang.org/x/crypto v0.41.0 h1:WKYxWedPGCTVVl5+WHSSrOBT0O8lx32+zxmHxijgXp4=
|
||||
golang.org/x/crypto v0.41.0/go.mod h1:pO5AFd7FA68rFak7rOAGVuygIISepHftHnr8dr6+sUc=
|
||||
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
|
||||
golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
|
||||
golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8=
|
||||
@@ -562,6 +696,9 @@ golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
|
||||
golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
|
||||
golang.org/x/mod v0.13.0 h1:I/DsJXRlw/8l/0c24sM9yb0T4z9liZTduXvdAWYiysY=
|
||||
golang.org/x/mod v0.13.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c=
|
||||
golang.org/x/mod v0.18.0 h1:5+9lSbEzPSdWkH32vYPBwEpX8KwDbM52Ud9xBUvNlb0=
|
||||
golang.org/x/mod v0.18.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c=
|
||||
golang.org/x/mod v0.26.0/go.mod h1:/j6NAhSk8iQ723BGAUyoAcn7SlD7s15Dp9Nd/SfeaFQ=
|
||||
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
@@ -595,6 +732,7 @@ golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81R
|
||||
golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=
|
||||
golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=
|
||||
golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
|
||||
golang.org/x/net v0.0.0-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
|
||||
golang.org/x/net v0.0.0-20210119194325-5f4716e94777/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
|
||||
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
|
||||
golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM=
|
||||
@@ -604,6 +742,12 @@ golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd/go.mod h1:CfG3xpIq0wQ8r1q4Su
|
||||
golang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk=
|
||||
golang.org/x/net v0.19.0 h1:zTwKpTd2XuCqf8huc7Fo2iSy+4RHPd10s4KzeTnVr1c=
|
||||
golang.org/x/net v0.19.0/go.mod h1:CfAk/cbD4CthTvqiEl8NpboMuiuOYsAr/7NOjZJtv1U=
|
||||
golang.org/x/net v0.26.0 h1:soB7SVo0PWrY4vPW/+ay0jKDNScG2X9wFeYlXIvJsOQ=
|
||||
golang.org/x/net v0.26.0/go.mod h1:5YKkiSynbBIh3p6iOc/vibscux0x38BZDkn8sCUPxHE=
|
||||
golang.org/x/net v0.40.0/go.mod h1:y0hY0exeL2Pku80/zKK7tpntoX23cqL3Oa6njdgRtds=
|
||||
golang.org/x/net v0.42.0/go.mod h1:FF1RA5d3u7nAYA4z2TkclSCKh68eSXtiFwcWQpPXdt8=
|
||||
golang.org/x/net v0.43.0 h1:lat02VYK2j4aLzMzecihNvTlJNQUq316m2Mr9rnM6YE=
|
||||
golang.org/x/net v0.43.0/go.mod h1:vhO1fvI4dGsIjh73sWfUVjj3N7CA9WkKJNQm2svM6Jg=
|
||||
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
|
||||
golang.org/x/oauth2 v0.0.0-20181017192945-9dcd33a902f4/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
|
||||
golang.org/x/oauth2 v0.0.0-20181203162652-d668ce993890/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
|
||||
@@ -629,6 +773,12 @@ golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJ
|
||||
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.4.0 h1:zxkM55ReGkDlKSM+Fu41A+zmbZuaPVbGMzvvdUPznYQ=
|
||||
golang.org/x/sync v0.4.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y=
|
||||
golang.org/x/sync v0.7.0 h1:YsImfSBoP9QPYL0xyKJPq0gcaJdG3rInoqxTWbfQu9M=
|
||||
golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
|
||||
golang.org/x/sync v0.10.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
|
||||
golang.org/x/sync v0.14.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA=
|
||||
golang.org/x/sync v0.16.0 h1:ycBJEhp9p4vXvUZNszeOq0kGTPghopOL8q0fq3vstxw=
|
||||
golang.org/x/sync v0.16.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA=
|
||||
golang.org/x/sys v0.0.0-20180810173357-98c5dad5d1a0/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
@@ -680,12 +830,15 @@ golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBc
|
||||
golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20220114195835-da31bd327af9/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc=
|
||||
golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||
golang.org/x/sys v0.33.0 h1:q3i8TbbEz+JRD9ywIRlyRAQbM0qF7hu24q3teo2hbuw=
|
||||
golang.org/x/sys v0.33.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k=
|
||||
golang.org/x/sys v0.35.0 h1:vz1N37gP5bs89s7He8XuIYXpyY0+QlsKmzipCbUtyxI=
|
||||
golang.org/x/sys v0.35.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k=
|
||||
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
|
||||
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
|
||||
golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
@@ -697,6 +850,11 @@ golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
||||
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
|
||||
golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ=
|
||||
golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
|
||||
golang.org/x/text v0.16.0 h1:a94ExnEXNtEwYLGJSIUxnWoxoRz/ZcCsV63ROupILh4=
|
||||
golang.org/x/text v0.16.0/go.mod h1:GhwF1Be+LQoKShO3cGOHzqOgRrGaYc9AvblQOmPVHnI=
|
||||
golang.org/x/text v0.25.0/go.mod h1:WEdwpYrmk1qmdHvhkSTNPm3app7v4rsT8F2UD6+VHIA=
|
||||
golang.org/x/text v0.28.0 h1:rhazDwis8INMIwQ4tpjLDzUhx6RlXqZNPEM0huQojng=
|
||||
golang.org/x/text v0.28.0/go.mod h1:U8nCwOR8jO/marOQ0QbDiOngZVEBB7MAiitBuMjXiNU=
|
||||
golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
|
||||
golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
|
||||
golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
|
||||
@@ -710,6 +868,7 @@ golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3
|
||||
golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
|
||||
golang.org/x/tools v0.0.0-20190312151545-0bb0c0a6e846/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
|
||||
golang.org/x/tools v0.0.0-20190312170243-e65039ee4138/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
|
||||
golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
|
||||
golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
|
||||
golang.org/x/tools v0.0.0-20190506145303-2d16b83fe98c/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
|
||||
golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
|
||||
@@ -719,6 +878,8 @@ golang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0/go.mod h1:/rFqwRUd4F7ZHNgw
|
||||
golang.org/x/tools v0.0.0-20190816200558-6889da9d5479/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||
golang.org/x/tools v0.0.0-20190911174233-4f2ddba30aff/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||
golang.org/x/tools v0.0.0-20191012152004-8de300cfc20a/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||
golang.org/x/tools v0.0.0-20191029041327-9cc4af7d6b2c/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||
golang.org/x/tools v0.0.0-20191029190741-b9c20aec41a5/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||
golang.org/x/tools v0.0.0-20191113191852-77e3bb0ad9e7/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||
golang.org/x/tools v0.0.0-20191115202509-3a792d9c32b2/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||
@@ -749,10 +910,15 @@ golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4f
|
||||
golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
|
||||
golang.org/x/tools v0.14.0 h1:jvNa2pY0M4r62jkRQ6RwEZZyPcymeL9XZMLBbV7U2nc=
|
||||
golang.org/x/tools v0.14.0/go.mod h1:uYBEerGOWcJyEORxN+Ek8+TT266gXkNlHdJBwexUsBg=
|
||||
golang.org/x/tools v0.22.0 h1:gqSGLZqv+AI9lIQzniJ0nZDRG5GBPsSi+DRNHWNz6yA=
|
||||
golang.org/x/tools v0.22.0/go.mod h1:aCwcsjqvq7Yqt6TNyX7QMU2enbQ/Gt0bo6krSeEri+c=
|
||||
golang.org/x/tools v0.35.0/go.mod h1:NKdj5HkL/73byiZSJjqJgKn3ep7KjFkBOkR/Hps3VPw=
|
||||
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
gonum.org/v1/gonum v0.13.0 h1:a0T3bh+7fhRyqeNbiC3qVHYmkiQgit3wnNan/2c0HMM=
|
||||
gonum.org/v1/gonum v0.13.0/go.mod h1:/WPYRckkfWrhWefxyYTfrTtQR0KH4iyHNuzxqXAKyAU=
|
||||
google.golang.org/api v0.0.0-20180910000450-7ca32eb868bf/go.mod h1:4mhQ8q/RsB7i+udVvVy5NUi08OU8ZlA0gRVgrF7VFY0=
|
||||
google.golang.org/api v0.0.0-20181030000543-1d582fd0359e/go.mod h1:4mhQ8q/RsB7i+udVvVy5NUi08OU8ZlA0gRVgrF7VFY0=
|
||||
google.golang.org/api v0.1.0/go.mod h1:UGEZY7KEX120AnNLIHFMKIo4obdJhkp2tPbaPlQx13Y=
|
||||
@@ -815,6 +981,8 @@ google.golang.org/genproto v0.0.0-20200618031413-b414f8b61790/go.mod h1:jDfRM7Fc
|
||||
google.golang.org/genproto v0.0.0-20200729003335-053ba62fc06f/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
|
||||
google.golang.org/genproto v0.0.0-20200804131852-c06518451d9c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
|
||||
google.golang.org/genproto v0.0.0-20200825200019-8632dd797987/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20250811230008-5f3141c8851a h1:tPE/Kp+x9dMSwUm/uM0JKK0IfdiJkwAbSMSeZBXXJXc=
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20250811230008-5f3141c8851a/go.mod h1:gw1tLEfykwDz2ET4a12jcXt4couGAm7IwsVaTy0Sflo=
|
||||
google.golang.org/grpc v1.14.0/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw=
|
||||
google.golang.org/grpc v1.16.0/go.mod h1:0JHn/cJsOMiMfNA9+DeHDlAU7KAAB5GDlYFpa9MZMio=
|
||||
google.golang.org/grpc v1.17.0/go.mod h1:6QZJwpn2B+Zp71q/5VxRsJ6NXXVCE5NRUHRo+f3cWCs=
|
||||
@@ -830,6 +998,7 @@ google.golang.org/grpc v1.28.0/go.mod h1:rpkK4SK4GF4Ach/+MFLZUBavHOvF2JJB5uozKKa
|
||||
google.golang.org/grpc v1.29.1/go.mod h1:itym6AZVZYACWQqET3MqgPpjcuV5QH3BxFS3IjizoKk=
|
||||
google.golang.org/grpc v1.30.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak=
|
||||
google.golang.org/grpc v1.31.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak=
|
||||
google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv2fbc=
|
||||
google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8=
|
||||
google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0=
|
||||
google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM=
|
||||
@@ -846,6 +1015,8 @@ google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs
|
||||
google.golang.org/protobuf v1.31.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I=
|
||||
google.golang.org/protobuf v1.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6hg=
|
||||
google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw=
|
||||
google.golang.org/protobuf v1.36.7 h1:IgrO7UwFQGJdRNXH/sQux4R1Dj1WAKcLElzeeRaXV2A=
|
||||
google.golang.org/protobuf v1.36.7/go.mod h1:jduwjTPXsFjZGTmRluh+L6NjiWu7pchiJ2/5YcXBHnY=
|
||||
gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw=
|
||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
@@ -864,6 +1035,7 @@ gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
|
||||
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
|
||||
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
gopkg.in/yaml.v3 v3.0.0/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
||||
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
grpc.go4.org v0.0.0-20170609214715-11d0a25b4919/go.mod h1:77eQGdRu53HpSqPFJFmuJdjuHRquDANNeA4x7B8WQ9o=
|
||||
|
||||
@@ -149,8 +149,8 @@ agent:
|
||||
models: ["llama3.2:70b", "qwen2.5:72b"]
|
||||
max_tasks: 3
|
||||
|
||||
hive_api:
|
||||
base_url: "http://hive.deepblack.cloud"
|
||||
whoosh_api:
|
||||
base_url: "http://whoosh.deepblack.cloud"
|
||||
api_key: ""
|
||||
|
||||
dht:
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Bzzz P2P Service Installation Script
|
||||
# Installs Bzzz as a systemd service
|
||||
# BZZZ Service Installation Script
|
||||
# Installs BZZZ as a systemd service
|
||||
|
||||
set -e
|
||||
|
||||
echo "🐝 Installing Bzzz P2P Task Coordination Service..."
|
||||
echo "🐝 Installing BZZZ P2P Task Coordination Service..."
|
||||
|
||||
# Check if running as root or with sudo
|
||||
if [ "$EUID" -ne 0 ]; then
|
||||
@@ -14,20 +14,19 @@ if [ "$EUID" -ne 0 ]; then
|
||||
fi
|
||||
|
||||
# Define paths
|
||||
BZZZ_DIR="/home/tony/chorus/project-queues/active/BZZZ"
|
||||
BZZZ_DIR="$(pwd)"
|
||||
SERVICE_FILE="$BZZZ_DIR/bzzz.service"
|
||||
SYSTEMD_DIR="/etc/systemd/system"
|
||||
|
||||
# Check if Bzzz binary exists
|
||||
# Check if BZZZ binary exists
|
||||
if [ ! -f "$BZZZ_DIR/bzzz" ]; then
|
||||
echo "❌ Bzzz binary not found at $BZZZ_DIR/bzzz"
|
||||
echo " Please build the binary first with: go build -o bzzz"
|
||||
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"
|
||||
echo "✅ Made BZZZ binary executable"
|
||||
|
||||
# Copy service file to systemd directory
|
||||
cp "$SERVICE_FILE" "$SYSTEMD_DIR/bzzz.service"
|
||||
@@ -43,24 +42,11 @@ echo "✅ Reloaded systemd daemon"
|
||||
|
||||
# Enable service to start on boot
|
||||
systemctl enable bzzz.service
|
||||
echo "✅ Enabled Bzzz service for auto-start"
|
||||
echo "✅ Enabled BZZZ service for auto-start"
|
||||
|
||||
# Start the service
|
||||
systemctl start bzzz.service
|
||||
echo "✅ Started Bzzz service"
|
||||
|
||||
# Check service status
|
||||
echo ""
|
||||
echo "📊 Service Status:"
|
||||
systemctl status bzzz.service --no-pager -l
|
||||
echo "✅ Started BZZZ service"
|
||||
|
||||
echo ""
|
||||
echo "🎉 Bzzz P2P Task Coordination Service installed successfully!"
|
||||
echo ""
|
||||
echo "Commands:"
|
||||
echo " sudo systemctl start bzzz - Start the service"
|
||||
echo " sudo systemctl stop bzzz - Stop the service"
|
||||
echo " sudo systemctl restart bzzz - Restart the service"
|
||||
echo " sudo systemctl status bzzz - Check service status"
|
||||
echo " sudo journalctl -u bzzz -f - Follow service logs"
|
||||
echo " sudo systemctl disable bzzz - Disable auto-start"
|
||||
echo "🎉 BZZZ P2P Task Coordination Service installed successfully!"
|
||||
|
||||
504
install/BZZZ_WEB_UI_PLAN.md
Normal file
504
install/BZZZ_WEB_UI_PLAN.md
Normal file
@@ -0,0 +1,504 @@
|
||||
# BZZZ Built-in Web Configuration UI Development Plan
|
||||
|
||||
## Clear Separation of Responsibilities
|
||||
|
||||
### chorus.services (Installer Host)
|
||||
- ✅ **Already Complete**: Hosts `install-chorus-enhanced.sh`
|
||||
- ✅ **Single Purpose**: One-line installation script download
|
||||
- ✅ **Working**: `curl -fsSL https://chorus.services/install.sh | sh`
|
||||
|
||||
### BZZZ (This Plan)
|
||||
- 🔄 **To Implement**: Built-in web UI for cluster configuration
|
||||
- 🎯 **Purpose**: Post-installation setup wizard when no config exists
|
||||
- 🌐 **Location**: Served by BZZZ itself at `:8080/setup`
|
||||
|
||||
## Architecture Overview
|
||||
|
||||
The BZZZ binary will serve its own web UI for configuration when:
|
||||
1. No configuration file exists (first run)
|
||||
2. User explicitly accesses `:8080/setup`
|
||||
3. Configuration is incomplete or invalid
|
||||
|
||||
## Implementation Strategy
|
||||
|
||||
### Phase 1: Integrate Web UI into BZZZ Binary
|
||||
|
||||
#### 1.1 Embed Web UI in Go Binary
|
||||
**File**: `main.go` and new `pkg/webui/`
|
||||
|
||||
```go
|
||||
//go:embed web-ui/dist/*
|
||||
var webUIFiles embed.FS
|
||||
|
||||
func main() {
|
||||
// Check if configuration exists
|
||||
if !configExists() {
|
||||
log.Println("🌐 No configuration found, starting setup wizard...")
|
||||
startWebUI()
|
||||
}
|
||||
|
||||
// Normal BZZZ startup
|
||||
startBZZZServices()
|
||||
}
|
||||
|
||||
func startWebUI() {
|
||||
// Serve embedded web UI
|
||||
// Start configuration wizard
|
||||
// Block until configuration is complete
|
||||
}
|
||||
```
|
||||
|
||||
#### 1.2 Extend Existing HTTP Server
|
||||
**File**: `api/http_server.go`
|
||||
|
||||
Add setup routes to existing server:
|
||||
```go
|
||||
func (h *HTTPServer) setupRoutes(router *mux.Router) {
|
||||
// Existing API routes
|
||||
api := router.PathPrefix("/api").Subrouter()
|
||||
// ... existing routes ...
|
||||
|
||||
// Setup wizard routes (only if no config exists)
|
||||
if !h.hasValidConfig() {
|
||||
h.setupWizardRoutes(router)
|
||||
}
|
||||
}
|
||||
|
||||
func (h *HTTPServer) setupWizardRoutes(router *mux.Router) {
|
||||
// Serve static web UI files
|
||||
router.PathPrefix("/setup").Handler(http.StripPrefix("/setup",
|
||||
http.FileServer(http.FS(webUIFiles))))
|
||||
|
||||
// Setup API endpoints
|
||||
setup := router.PathPrefix("/api/setup").Subrouter()
|
||||
setup.HandleFunc("/system", h.handleSystemDetection).Methods("GET")
|
||||
setup.HandleFunc("/repository", h.handleRepositoryConfig).Methods("GET", "POST")
|
||||
setup.HandleFunc("/cluster", h.handleClusterConfig).Methods("GET", "POST")
|
||||
setup.HandleFunc("/validate", h.handleValidateConfig).Methods("POST")
|
||||
setup.HandleFunc("/save", h.handleSaveConfig).Methods("POST")
|
||||
}
|
||||
```
|
||||
|
||||
### Phase 2: Configuration Management Integration
|
||||
|
||||
#### 2.1 Leverage Existing Config System
|
||||
**File**: `pkg/config/setup.go` (new)
|
||||
|
||||
```go
|
||||
type SetupManager struct {
|
||||
configPath string
|
||||
systemInfo *SystemInfo
|
||||
repoFactory *repository.DefaultProviderFactory
|
||||
taskCoordinator *coordinator.TaskCoordinator
|
||||
}
|
||||
|
||||
func (s *SetupManager) DetectSystem() (*SystemInfo, error) {
|
||||
// Hardware detection (GPU, CPU, memory)
|
||||
// Network interface discovery
|
||||
// Software prerequisites check
|
||||
return systemInfo, nil
|
||||
}
|
||||
|
||||
func (s *SetupManager) ValidateRepositoryConfig(config RepositoryConfig) error {
|
||||
// Use existing repository factory
|
||||
provider, err := s.repoFactory.CreateProvider(ctx, &repository.Config{
|
||||
Provider: config.Provider,
|
||||
BaseURL: config.BaseURL,
|
||||
AccessToken: config.Token,
|
||||
// ...
|
||||
})
|
||||
|
||||
// Test connectivity
|
||||
return provider.ListAvailableTasks()
|
||||
}
|
||||
|
||||
func (s *SetupManager) SaveConfiguration(config *SetupConfig) error {
|
||||
// Convert to existing config.Config format
|
||||
bzzzConfig := &config.Config{
|
||||
Node: config.NodeConfig,
|
||||
Repository: config.RepositoryConfig,
|
||||
Agent: config.AgentConfig,
|
||||
// ...
|
||||
}
|
||||
|
||||
// Save to YAML file
|
||||
return bzzzConfig.SaveToFile(s.configPath)
|
||||
}
|
||||
```
|
||||
|
||||
#### 2.2 Repository Integration
|
||||
**File**: `api/setup_repository.go` (new)
|
||||
|
||||
```go
|
||||
func (h *HTTPServer) handleRepositoryConfig(w http.ResponseWriter, r *http.Request) {
|
||||
if r.Method == "GET" {
|
||||
// Return current repository configuration
|
||||
config := h.setupManager.GetRepositoryConfig()
|
||||
json.NewEncoder(w).Encode(config)
|
||||
return
|
||||
}
|
||||
|
||||
// POST: Validate and save repository configuration
|
||||
var repoConfig RepositoryConfig
|
||||
if err := json.NewDecoder(r.Body).Decode(&repoConfig); err != nil {
|
||||
http.Error(w, "Invalid JSON", http.StatusBadRequest)
|
||||
return
|
||||
}
|
||||
|
||||
// Validate using existing repository factory
|
||||
if err := h.setupManager.ValidateRepositoryConfig(repoConfig); err != nil {
|
||||
http.Error(w, fmt.Sprintf("Repository validation failed: %v", err), http.StatusBadRequest)
|
||||
return
|
||||
}
|
||||
|
||||
// Save configuration
|
||||
h.setupManager.SaveRepositoryConfig(repoConfig)
|
||||
json.NewEncoder(w).Encode(map[string]string{"status": "success"})
|
||||
}
|
||||
```
|
||||
|
||||
### Phase 3: Enhanced Web UI Components
|
||||
|
||||
#### 3.1 Complete Existing Components
|
||||
The config-ui framework exists but needs implementation:
|
||||
|
||||
**SystemDetection.tsx**:
|
||||
```typescript
|
||||
const SystemDetection = ({ onComplete, onBack }) => {
|
||||
const [systemInfo, setSystemInfo] = useState(null);
|
||||
const [loading, setLoading] = useState(true);
|
||||
|
||||
useEffect(() => {
|
||||
fetch('/api/setup/system')
|
||||
.then(res => res.json())
|
||||
.then(data => {
|
||||
setSystemInfo(data);
|
||||
setLoading(false);
|
||||
});
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<div>
|
||||
<h3>System Detection Results</h3>
|
||||
{systemInfo && (
|
||||
<div>
|
||||
<div>OS: {systemInfo.os}</div>
|
||||
<div>Architecture: {systemInfo.arch}</div>
|
||||
<div>GPUs: {systemInfo.gpus?.length || 0}</div>
|
||||
<div>Memory: {systemInfo.memory}</div>
|
||||
{systemInfo.gpus?.length > 1 && (
|
||||
<div className="alert alert-info">
|
||||
💡 Multi-GPU detected! Consider Parallama for optimal performance.
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
<button onClick={() => onComplete(systemInfo)}>Continue</button>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
```
|
||||
|
||||
**RepositoryConfiguration.tsx**:
|
||||
```typescript
|
||||
const RepositoryConfiguration = ({ onComplete, onBack, configData }) => {
|
||||
const [provider, setProvider] = useState('gitea');
|
||||
const [config, setConfig] = useState({
|
||||
provider: 'gitea',
|
||||
baseURL: 'http://ironwood:3000',
|
||||
owner: '',
|
||||
repository: '',
|
||||
token: ''
|
||||
});
|
||||
const [validating, setValidating] = useState(false);
|
||||
|
||||
const validateConfig = async () => {
|
||||
setValidating(true);
|
||||
try {
|
||||
const response = await fetch('/api/setup/repository', {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify(config)
|
||||
});
|
||||
|
||||
if (response.ok) {
|
||||
onComplete(config);
|
||||
} else {
|
||||
const error = await response.text();
|
||||
alert(`Validation failed: ${error}`);
|
||||
}
|
||||
} catch (error) {
|
||||
alert(`Connection failed: ${error.message}`);
|
||||
}
|
||||
setValidating(false);
|
||||
};
|
||||
|
||||
return (
|
||||
<div>
|
||||
<h3>Repository Configuration</h3>
|
||||
<form onSubmit={(e) => { e.preventDefault(); validateConfig(); }}>
|
||||
<div>
|
||||
<label>Provider:</label>
|
||||
<select value={provider} onChange={(e) => setProvider(e.target.value)}>
|
||||
<option value="gitea">GITEA (Self-hosted)</option>
|
||||
<option value="github">GitHub</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
{provider === 'gitea' && (
|
||||
<div>
|
||||
<label>GITEA URL:</label>
|
||||
<input
|
||||
value={config.baseURL}
|
||||
onChange={(e) => setConfig({...config, baseURL: e.target.value})}
|
||||
placeholder="http://ironwood:3000"
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
|
||||
<div>
|
||||
<label>Repository Owner:</label>
|
||||
<input
|
||||
value={config.owner}
|
||||
onChange={(e) => setConfig({...config, owner: e.target.value})}
|
||||
placeholder="username or organization"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label>Repository Name:</label>
|
||||
<input
|
||||
value={config.repository}
|
||||
onChange={(e) => setConfig({...config, repository: e.target.value})}
|
||||
placeholder="repository name"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label>Access Token:</label>
|
||||
<input
|
||||
type="password"
|
||||
value={config.token}
|
||||
onChange={(e) => setConfig({...config, token: e.target.value})}
|
||||
placeholder="access token"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<button type="button" onClick={onBack}>Back</button>
|
||||
<button type="submit" disabled={validating}>
|
||||
{validating ? 'Validating...' : 'Validate & Continue'}
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
```
|
||||
|
||||
### Phase 4: Build Process Integration
|
||||
|
||||
#### 4.1 Web UI Build Integration
|
||||
**File**: `Makefile` or build script
|
||||
|
||||
```bash
|
||||
build-web-ui:
|
||||
cd install/config-ui && npm install && npm run build
|
||||
mkdir -p web-ui/dist
|
||||
cp -r install/config-ui/.next/static web-ui/dist/
|
||||
cp -r install/config-ui/out/* web-ui/dist/ 2>/dev/null || true
|
||||
|
||||
build-bzzz: build-web-ui
|
||||
go build -o bzzz main.go
|
||||
```
|
||||
|
||||
#### 4.2 Embed Files in Binary
|
||||
**File**: `pkg/webui/embed.go`
|
||||
|
||||
```go
|
||||
package webui
|
||||
|
||||
import (
|
||||
"embed"
|
||||
"io/fs"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
//go:embed dist/*
|
||||
var webUIFiles embed.FS
|
||||
|
||||
func GetWebUIHandler() http.Handler {
|
||||
// Get the web-ui subdirectory
|
||||
webUIFS, err := fs.Sub(webUIFiles, "dist")
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
return http.FileServer(http.FS(webUIFS))
|
||||
}
|
||||
```
|
||||
|
||||
### Phase 5: Configuration Flow Integration
|
||||
|
||||
#### 5.1 Startup Logic
|
||||
**File**: `main.go`
|
||||
|
||||
```go
|
||||
func main() {
|
||||
configPath := getConfigPath()
|
||||
|
||||
// Check if configuration exists and is valid
|
||||
config, err := loadConfig(configPath)
|
||||
if err != nil || !isValidConfig(config) {
|
||||
fmt.Println("🌐 Starting BZZZ setup wizard...")
|
||||
fmt.Printf("📱 Open your browser to: http://localhost:8080/setup\n")
|
||||
|
||||
// Start HTTP server in setup mode
|
||||
startSetupMode(configPath)
|
||||
|
||||
// Wait for configuration to be saved
|
||||
waitForConfiguration(configPath)
|
||||
|
||||
// Reload configuration
|
||||
config, err = loadConfig(configPath)
|
||||
if err != nil {
|
||||
log.Fatal("Failed to load configuration after setup:", err)
|
||||
}
|
||||
}
|
||||
|
||||
// Normal BZZZ startup with configuration
|
||||
fmt.Println("🚀 Starting BZZZ with configuration...")
|
||||
startNormalMode(config)
|
||||
}
|
||||
|
||||
func startSetupMode(configPath string) {
|
||||
// Start HTTP server in setup mode
|
||||
setupManager := NewSetupManager(configPath)
|
||||
httpServer := api.NewHTTPServer(8080, nil, nil)
|
||||
httpServer.SetSetupManager(setupManager)
|
||||
|
||||
go func() {
|
||||
if err := httpServer.Start(); err != nil {
|
||||
log.Fatal("Failed to start setup server:", err)
|
||||
}
|
||||
}()
|
||||
}
|
||||
|
||||
func waitForConfiguration(configPath string) {
|
||||
ticker := time.NewTicker(1 * time.Second)
|
||||
defer ticker.Stop()
|
||||
|
||||
for {
|
||||
select {
|
||||
case <-ticker.C:
|
||||
if fileExists(configPath) {
|
||||
if config, err := loadConfig(configPath); err == nil && isValidConfig(config) {
|
||||
fmt.Println("✅ Configuration saved successfully!")
|
||||
return
|
||||
}
|
||||
}
|
||||
case <-time.After(30 * time.Minute):
|
||||
log.Fatal("Setup timeout - no configuration provided within 30 minutes")
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
#### 5.2 Configuration Validation
|
||||
**File**: `pkg/config/validation.go`
|
||||
|
||||
```go
|
||||
func isValidConfig(config *Config) bool {
|
||||
// Check required fields
|
||||
if config.Node.ID == "" || config.Node.Role == "" {
|
||||
return false
|
||||
}
|
||||
|
||||
// Check repository configuration
|
||||
if config.Repository.Provider == "" || config.Repository.Config.Owner == "" {
|
||||
return false
|
||||
}
|
||||
|
||||
// Check agent configuration
|
||||
if config.Agent.ID == "" || len(config.Agent.Expertise) == 0 {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
```
|
||||
|
||||
## Integration with Existing Systems
|
||||
|
||||
### ✅ **Leverage Without Changes**
|
||||
1. **HTTP Server** (`api/http_server.go`) - Extend with setup routes
|
||||
2. **Configuration System** (`pkg/config/`) - Use existing YAML structure
|
||||
3. **Repository Factory** (`repository/factory.go`) - Validate credentials
|
||||
4. **Task Coordinator** (`coordinator/task_coordinator.go`) - Agent management
|
||||
|
||||
### 🔧 **Minimal Extensions**
|
||||
1. **Setup Manager** - New component using existing systems
|
||||
2. **Web UI Routes** - Add to existing HTTP server
|
||||
3. **Embedded Files** - Add web UI to binary
|
||||
4. **Startup Logic** - Add configuration check to main.go
|
||||
|
||||
## File Structure
|
||||
|
||||
```
|
||||
/home/tony/chorus/project-queues/active/BZZZ/
|
||||
├── main.go # Enhanced startup logic
|
||||
├── api/
|
||||
│ ├── http_server.go # Extended with setup routes
|
||||
│ ├── setup_handlers.go # New setup API handlers
|
||||
│ └── setup_repository.go # Repository configuration API
|
||||
├── pkg/
|
||||
│ ├── config/
|
||||
│ │ ├── config.go # Existing
|
||||
│ │ ├── setup.go # New setup manager
|
||||
│ │ └── validation.go # New validation logic
|
||||
│ └── webui/
|
||||
│ └── embed.go # New embedded web UI
|
||||
├── install/config-ui/ # Existing React app
|
||||
│ ├── app/setup/page.tsx # Existing wizard framework
|
||||
│ ├── app/setup/components/ # Complete component implementations
|
||||
│ └── package.json # Existing
|
||||
└── web-ui/ # Build output (embedded)
|
||||
└── dist/ # Generated by build process
|
||||
```
|
||||
|
||||
## Implementation Timeline
|
||||
|
||||
### Week 1: Core Integration
|
||||
- **Day 1**: Setup manager and configuration validation
|
||||
- **Day 2**: Extend HTTP server with setup routes
|
||||
- **Day 3**: Repository configuration API integration
|
||||
- **Day 4**: System detection and hardware profiling
|
||||
- **Day 5**: Build process and file embedding
|
||||
|
||||
### Week 2: Web UI Implementation
|
||||
- **Day 1-2**: Complete SystemDetection and RepositoryConfiguration components
|
||||
- **Day 3-4**: Cluster formation and validation components
|
||||
- **Day 5**: UI polish and error handling
|
||||
|
||||
### Week 3: Integration and Testing
|
||||
- **Day 1-2**: End-to-end configuration flow testing
|
||||
- **Day 3-4**: Multi-node cluster testing
|
||||
- **Day 5**: Documentation and deployment
|
||||
|
||||
## Success Criteria
|
||||
|
||||
### Technical
|
||||
- [ ] BZZZ binary serves web UI when no config exists
|
||||
- [ ] Complete 8-step setup wizard functional
|
||||
- [ ] Repository integration with GITEA/GitHub validation
|
||||
- [ ] Configuration saves to existing YAML format
|
||||
- [ ] Seamless transition from setup to normal operation
|
||||
|
||||
### User Experience
|
||||
- [ ] Zero-config startup launches web wizard
|
||||
- [ ] Intuitive setup flow with validation
|
||||
- [ ] Professional UI matching BZZZ branding
|
||||
- [ ] Clear error messages and recovery options
|
||||
- [ ] Mobile-responsive design
|
||||
|
||||
This plan keeps the clear separation between the chorus.services installer (already working) and BZZZ's built-in configuration system (to be implemented).
|
||||
251
install/ENHANCED_VS_VISION_COMPARISON.md
Normal file
251
install/ENHANCED_VS_VISION_COMPARISON.md
Normal file
@@ -0,0 +1,251 @@
|
||||
# Enhanced Installer vs INSTALLATION_SYSTEM Vision Comparison
|
||||
|
||||
## Executive Summary
|
||||
|
||||
Our enhanced installer (`install-chorus-enhanced.sh`) addresses the **repository integration gap** but falls significantly short of the comprehensive **INSTALLATION_SYSTEM.md** vision. While we delivered immediate functionality, we missed the sophisticated multi-phase setup system with web UI that was originally planned.
|
||||
|
||||
## Detailed Feature Comparison
|
||||
|
||||
### ✅ **What We Successfully Delivered**
|
||||
|
||||
| Feature | Enhanced Installer | Original Vision | Status |
|
||||
|---------|-------------------|-----------------|--------|
|
||||
| One-command install | ✅ `curl \| sh` | ✅ `curl \| sh` | **MATCH** |
|
||||
| System detection | ✅ OS, arch, packages | ✅ Hardware, GPU, network | **PARTIAL** |
|
||||
| Binary installation | ✅ Architecture-specific | ✅ `/opt/bzzz/` structure | **BASIC** |
|
||||
| Service management | ✅ SystemD integration | ✅ SystemD + monitoring | **PARTIAL** |
|
||||
| Configuration generation | ✅ YAML config files | ✅ Web-based wizard | **SIMPLIFIED** |
|
||||
| Repository integration | ✅ GITEA/GitHub setup | ❌ Not specified | **EXCEEDED** |
|
||||
|
||||
### 🔴 **Critical Missing Components**
|
||||
|
||||
#### 1. Web-Based Configuration Interface
|
||||
**Vision**: React-based setup wizard at `:8080/setup`
|
||||
```
|
||||
🚀 8-Step Configuration Wizard:
|
||||
1. System Detection & Validation
|
||||
2. Network Configuration
|
||||
3. Security Setup
|
||||
4. AI Integration
|
||||
5. Resource Allocation
|
||||
6. Service Deployment
|
||||
7. Cluster Formation
|
||||
8. Testing & Validation
|
||||
```
|
||||
|
||||
**Our Implementation**: Command-line prompts only
|
||||
- ❌ No web UI
|
||||
- ❌ No beautiful React interface
|
||||
- ❌ No progressive setup wizard
|
||||
- ❌ No real-time validation
|
||||
|
||||
#### 2. GPU Detection & Parallama Integration
|
||||
**Vision**: Intelligent multi-GPU detection
|
||||
```bash
|
||||
🚀 Multi-GPU Setup Detected (4 NVIDIA GPUs)
|
||||
Parallama is RECOMMENDED for optimal multi-GPU performance!
|
||||
|
||||
Options:
|
||||
1. Install Parallama (recommended for GPU setups)
|
||||
2. Install standard Ollama
|
||||
3. Skip Ollama installation (configure later)
|
||||
```
|
||||
|
||||
**Our Implementation**: Basic Ollama installation
|
||||
- ❌ No GPU detection
|
||||
- ❌ No Parallama recommendation
|
||||
- ❌ No multi-GPU optimization
|
||||
- ✅ Basic Ollama model installation
|
||||
|
||||
#### 3. Advanced System Detection
|
||||
**Vision**: Comprehensive hardware analysis
|
||||
- CPU cores and model detection
|
||||
- GPU configuration (NVIDIA/AMD)
|
||||
- Memory and storage analysis
|
||||
- Network interface detection
|
||||
|
||||
**Our Implementation**: Basic OS detection
|
||||
- ✅ OS and architecture detection
|
||||
- ✅ Package manager detection
|
||||
- ❌ No hardware profiling
|
||||
- ❌ No GPU analysis
|
||||
|
||||
#### 4. Security Configuration
|
||||
**Vision**: Enterprise-grade security setup
|
||||
- SSH key generation/management
|
||||
- TLS/SSL certificate configuration
|
||||
- Authentication method selection (token, OAuth2, LDAP)
|
||||
- Security policy configuration
|
||||
|
||||
**Our Implementation**: Basic token storage
|
||||
- ✅ Repository token management
|
||||
- ✅ Secure file permissions
|
||||
- ❌ No SSH key management
|
||||
- ❌ No TLS configuration
|
||||
- ❌ No enterprise authentication
|
||||
|
||||
#### 5. Resource Management Interface
|
||||
**Vision**: Interactive resource allocation
|
||||
- CPU/Memory allocation sliders
|
||||
- Storage path configuration
|
||||
- GPU assignment for Parallama
|
||||
- Resource monitoring setup
|
||||
|
||||
**Our Implementation**: Static configuration
|
||||
- ✅ Basic resource settings in YAML
|
||||
- ❌ No interactive allocation
|
||||
- ❌ No resource monitoring
|
||||
- ❌ No GPU management
|
||||
|
||||
#### 6. Professional Installation Experience
|
||||
**Vision**: Modern, branded installation
|
||||
```bash
|
||||
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||
🔥 BZZZ Distributed AI Coordination Platform
|
||||
Installer v1.0
|
||||
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||
|
||||
[INFO] Detected OS: Ubuntu 22.04
|
||||
[SUCCESS] System requirements check passed
|
||||
[SUCCESS] BZZZ binaries installed successfully
|
||||
```
|
||||
|
||||
**Our Implementation**: Basic colored output
|
||||
- ✅ Colored logging functions
|
||||
- ✅ ASCII banner
|
||||
- ❌ No professional progress indicators
|
||||
- ❌ No detailed installation steps
|
||||
|
||||
## Architecture Philosophy Differences
|
||||
|
||||
### Original INSTALLATION_SYSTEM Vision
|
||||
- **Web-First**: React-based configuration interface
|
||||
- **GPU-Optimized**: Parallama multi-GPU support
|
||||
- **Enterprise-Ready**: LDAP, TLS, advanced security
|
||||
- **Production-Grade**: Comprehensive monitoring and validation
|
||||
- **User-Friendly**: Beautiful UI with real-time feedback
|
||||
|
||||
### Our Enhanced Installer Implementation
|
||||
- **CLI-First**: Command-line configuration
|
||||
- **Repository-Focused**: Git-based task coordination
|
||||
- **Functional-Minimal**: Working system with basic features
|
||||
- **Manual-Friendly**: Interactive prompts and text output
|
||||
- **Gap-Solving**: Addresses immediate deployment needs
|
||||
|
||||
## Feature Gap Analysis
|
||||
|
||||
### 🔴 **HIGH PRIORITY MISSING**
|
||||
|
||||
1. **Web Configuration UI** (`/setup` interface)
|
||||
- Impact: No user-friendly setup experience
|
||||
- Effort: High (full React app)
|
||||
- Priority: Critical for adoption
|
||||
|
||||
2. **GPU Detection & Parallama**
|
||||
- Impact: Suboptimal multi-GPU performance
|
||||
- Effort: Medium (hardware detection)
|
||||
- Priority: High for AI workloads
|
||||
|
||||
3. **Advanced System Detection**
|
||||
- Impact: Manual configuration required
|
||||
- Effort: Medium (system introspection)
|
||||
- Priority: Medium for automation
|
||||
|
||||
### 🟡 **MEDIUM PRIORITY MISSING**
|
||||
|
||||
4. **SSH Key Management**
|
||||
- Impact: Manual cluster deployment
|
||||
- Effort: Medium (key generation/distribution)
|
||||
- Priority: Medium for scaling
|
||||
|
||||
5. **Resource Allocation Interface**
|
||||
- Impact: Static resource assignment
|
||||
- Effort: High (interactive UI)
|
||||
- Priority: Medium for optimization
|
||||
|
||||
6. **TLS/SSL Configuration**
|
||||
- Impact: Insecure communications
|
||||
- Effort: Medium (cert management)
|
||||
- Priority: Medium for production
|
||||
|
||||
### 🟢 **LOW PRIORITY MISSING**
|
||||
|
||||
7. **LDAP/Enterprise Auth**
|
||||
- Impact: Basic authentication only
|
||||
- Effort: High (enterprise integration)
|
||||
- Priority: Low for initial deployment
|
||||
|
||||
8. **Advanced Monitoring**
|
||||
- Impact: Basic health checking
|
||||
- Effort: Medium (monitoring stack)
|
||||
- Priority: Low for MVP
|
||||
|
||||
## What We Actually Built vs Vision
|
||||
|
||||
### Our Enhanced Installer Strengths
|
||||
✅ **Repository Integration**: Complete GITEA/GitHub setup
|
||||
✅ **Working System**: Functional task coordination immediately
|
||||
✅ **Simple Deployment**: Single command installation
|
||||
✅ **Documentation**: Comprehensive setup guide
|
||||
✅ **Token Management**: Secure credential handling
|
||||
|
||||
### Vision's Comprehensive Approach
|
||||
🔴 **Missing Web UI**: No React-based setup wizard
|
||||
🔴 **Missing GPU Optimization**: No Parallama integration
|
||||
🔴 **Missing Enterprise Features**: No LDAP, TLS, advanced security
|
||||
🔴 **Missing Resource Management**: No interactive allocation
|
||||
🔴 **Missing Professional UX**: No modern installation experience
|
||||
|
||||
## Implementation Recommendations
|
||||
|
||||
### Immediate (Address Critical Gaps)
|
||||
1. **Create Web UI** - Implement basic `/setup` interface
|
||||
2. **Add GPU Detection** - Basic hardware profiling
|
||||
3. **Improve Installation UX** - Better progress indicators
|
||||
|
||||
### Medium-term (Professional Features)
|
||||
1. **Parallama Integration** - Multi-GPU optimization
|
||||
2. **SSH Key Management** - Automated cluster deployment
|
||||
3. **Resource Allocation** - Interactive configuration
|
||||
|
||||
### Long-term (Enterprise Grade)
|
||||
1. **Advanced Security** - TLS, LDAP, enterprise auth
|
||||
2. **Monitoring Stack** - Comprehensive system monitoring
|
||||
3. **Professional UI** - Full React setup wizard
|
||||
|
||||
## Strategic Decision Points
|
||||
|
||||
### Current State Assessment
|
||||
- ✅ **Functional**: System works for task coordination
|
||||
- ✅ **Deployable**: Can install and run immediately
|
||||
- ❌ **Professional**: Lacks enterprise-grade UX
|
||||
- ❌ **Optimized**: Missing GPU and resource optimization
|
||||
- ❌ **Scalable**: No automated cluster deployment
|
||||
|
||||
### Path Forward Options
|
||||
|
||||
#### Option A: Enhance Current Approach
|
||||
- Add web UI to existing installer
|
||||
- Maintain CLI-first philosophy
|
||||
- Gradual feature addition
|
||||
|
||||
#### Option B: Rebuild to Vision
|
||||
- Implement full INSTALLATION_SYSTEM design
|
||||
- Web-first configuration experience
|
||||
- Complete feature parity
|
||||
|
||||
#### Option C: Hybrid Approach
|
||||
- Keep working CLI installer
|
||||
- Build parallel web UI system
|
||||
- Allow both installation methods
|
||||
|
||||
## Conclusion
|
||||
|
||||
Our enhanced installer successfully **solved the immediate repository integration problem** but represents a **significant simplification** of the original comprehensive vision.
|
||||
|
||||
**Current Achievement**: ✅ Working repository-integrated task coordination system
|
||||
**Original Vision**: 🔴 Professional, GPU-optimized, web-based installation platform
|
||||
|
||||
The implementation prioritizes **immediate functionality** over **comprehensive user experience**. While this enables rapid deployment and testing, it means we're missing the professional installation experience that would make BZZZ competitive with enterprise platforms.
|
||||
|
||||
**Strategic Recommendation**: Implement the web UI (`/setup` interface) as the next major milestone to bridge the gap between our functional system and the original professional vision.
|
||||
245
install/PLAN_COMPARISON.md
Normal file
245
install/PLAN_COMPARISON.md
Normal file
@@ -0,0 +1,245 @@
|
||||
# BZZZ Installer: Plan vs Implementation Comparison
|
||||
|
||||
## Executive Summary
|
||||
|
||||
Our enhanced installer (`install-chorus-enhanced.sh`) addresses **Phase 1: Initial Node Setup** but diverges significantly from the original comprehensive deployment plan. The implementation prioritizes immediate functionality over the sophisticated multi-phase security architecture originally envisioned.
|
||||
|
||||
## Phase-by-Phase Analysis
|
||||
|
||||
### ✅ Phase 1: Initial Node Setup & Key Generation
|
||||
|
||||
**Original Plan:**
|
||||
- Web UI at `:8080/setup` for configuration
|
||||
- Master key generation with ONCE-ONLY display
|
||||
- Shamir's Secret Sharing for admin keys
|
||||
- Security-first design with complex key management
|
||||
|
||||
**Our Implementation:**
|
||||
- ✅ Single-command installation (`curl | sh`)
|
||||
- ✅ System detection and validation
|
||||
- ✅ BZZZ binary installation
|
||||
- ✅ Interactive configuration prompts
|
||||
- ❌ **MAJOR GAP**: No web UI setup interface
|
||||
- ❌ **CRITICAL MISSING**: No master key generation
|
||||
- ❌ **SECURITY GAP**: No Shamir's Secret Sharing
|
||||
- ❌ **SIMPLIFICATION**: Basic YAML config instead of sophisticated key management
|
||||
|
||||
**Gap Assessment:** 🔴 **SIGNIFICANT DEVIATION**
|
||||
The enhanced installer implements a simplified approach focused on repository integration rather than the security-first cryptographic design.
|
||||
|
||||
### ❌ Phase 2: SSH Cluster Deployment
|
||||
|
||||
**Original Plan:**
|
||||
- Web UI for manual IP entry
|
||||
- SSH-based remote installation across cluster
|
||||
- Automated deployment to multiple nodes
|
||||
- Cluster coordination through central web interface
|
||||
|
||||
**Our Implementation:**
|
||||
- ✅ Manual installation per node (user runs script on each machine)
|
||||
- ✅ Repository configuration with credentials
|
||||
- ❌ **MISSING**: No SSH-based remote deployment
|
||||
- ❌ **MISSING**: No centralized cluster management
|
||||
- ❌ **MANUAL PROCESS**: User must run installer on each node individually
|
||||
|
||||
**Gap Assessment:** 🔴 **NOT IMPLEMENTED**
|
||||
Current approach requires manual installation on each node. No automated cluster deployment.
|
||||
|
||||
### ❌ Phase 3: P2P Network Formation & Capability Discovery
|
||||
|
||||
**Original Plan:**
|
||||
- Automatic P2P network bootstrap
|
||||
- Capability announcement (GPU, CPU, memory, storage)
|
||||
- Dynamic network topology optimization
|
||||
- Shamir share distribution across peers
|
||||
|
||||
**Our Implementation:**
|
||||
- ✅ P2P network components exist in codebase
|
||||
- ✅ Node capability configuration in YAML
|
||||
- ❌ **MISSING**: No automatic capability discovery
|
||||
- ❌ **MISSING**: No dynamic network formation
|
||||
- ❌ **MISSING**: No Shamir share distribution
|
||||
|
||||
**Gap Assessment:** 🔴 **FOUNDATIONAL MISSING**
|
||||
P2P capabilities exist but installer doesn't configure automatic network formation.
|
||||
|
||||
### ❌ Phase 4: Leader Election & SLURP Responsibilities
|
||||
|
||||
**Original Plan:**
|
||||
- Sophisticated leader election with weighted scoring
|
||||
- SLURP (Service Layer Unified Resource Protocol) coordination
|
||||
- Leader handles resource orchestration and model distribution
|
||||
- Clear separation between Leader (operations) and Admin (oversight)
|
||||
|
||||
**Our Implementation:**
|
||||
- ✅ Election code exists in codebase (`pkg/election/`)
|
||||
- ✅ SLURP architecture implemented
|
||||
- ❌ **MISSING**: No automatic leader election setup
|
||||
- ❌ **MISSING**: No SLURP coordination configuration
|
||||
- ❌ **CONFIGURATION GAP**: Manual role assignment only
|
||||
|
||||
**Gap Assessment:** 🔴 **ADVANCED FEATURES MISSING**
|
||||
Infrastructure exists but not activated by installer.
|
||||
|
||||
### ❌ Phase 5: Business Configuration & DHT Storage
|
||||
|
||||
**Original Plan:**
|
||||
- DHT network for distributed business data storage
|
||||
- UCXL addressing for configuration data
|
||||
- Migration from local to distributed storage
|
||||
- Encrypted business data in DHT
|
||||
|
||||
**Our Implementation:**
|
||||
- ✅ DHT code exists (`pkg/dht/`)
|
||||
- ✅ UCXL addressing implemented
|
||||
- ❌ **MISSING**: No DHT network activation
|
||||
- ❌ **MISSING**: No business data migration
|
||||
- ❌ **BASIC CONFIG**: Simple local YAML files only
|
||||
|
||||
**Gap Assessment:** 🔴 **DISTRIBUTED STORAGE UNUSED**
|
||||
Sophisticated storage architecture exists but installer uses basic local configs.
|
||||
|
||||
### ❌ Phase 6: Model Distribution & Synchronization
|
||||
|
||||
**Original Plan:**
|
||||
- P2P model distribution based on VRAM capacity
|
||||
- Automatic model replication and redundancy
|
||||
- Load balancing and geographic distribution
|
||||
- Version synchronization (marked as TODO in plan)
|
||||
|
||||
**Our Implementation:**
|
||||
- ✅ Ollama integration for model management
|
||||
- ✅ Model installation via command line flags
|
||||
- ❌ **MISSING**: No P2P model distribution
|
||||
- ❌ **MISSING**: No automatic model replication
|
||||
- ❌ **SIMPLE**: Local Ollama model installation only
|
||||
|
||||
**Gap Assessment:** 🔴 **BASIC MODEL MANAGEMENT**
|
||||
Individual node model installation, no cluster-wide distribution.
|
||||
|
||||
### ❌ Phase 7: Role-Based Key Generation
|
||||
|
||||
**Original Plan:**
|
||||
- Dynamic role definition via web UI
|
||||
- Admin key reconstruction for role signing
|
||||
- Role-based access control deployment
|
||||
- Sophisticated permission management
|
||||
|
||||
**Our Implementation:**
|
||||
- ✅ Repository-based role assignment (basic)
|
||||
- ✅ Agent role configuration in YAML
|
||||
- ❌ **MISSING**: No dynamic role creation
|
||||
- ❌ **MISSING**: No key-based role management
|
||||
- ❌ **BASIC**: Simple string-based role assignment
|
||||
|
||||
**Gap Assessment:** 🔴 **ENTERPRISE FEATURES MISSING**
|
||||
Basic role strings instead of cryptographic role management.
|
||||
|
||||
## Implementation Philosophy Divergence
|
||||
|
||||
### Original Plan Philosophy
|
||||
- **Security-First**: Complex cryptographic key management
|
||||
- **Enterprise-Grade**: Sophisticated multi-phase deployment
|
||||
- **Centralized Management**: Web UI for cluster coordination
|
||||
- **Automated Operations**: SSH-based remote deployment
|
||||
- **Distributed Architecture**: DHT storage, P2P model distribution
|
||||
|
||||
### Our Implementation Philosophy
|
||||
- **Simplicity-First**: Get working system quickly
|
||||
- **Repository-Centric**: Focus on task coordination via Git
|
||||
- **Manual-Friendly**: User-driven installation per node
|
||||
- **Local Configuration**: YAML files instead of distributed storage
|
||||
- **Immediate Functionality**: Working agent over complex architecture
|
||||
|
||||
## Critical Missing Components
|
||||
|
||||
### 🔴 HIGH PRIORITY GAPS
|
||||
|
||||
1. **Web UI Setup Interface**
|
||||
- Original: Rich web interface at `:8080/setup`
|
||||
- Current: Command-line prompts only
|
||||
- Impact: No user-friendly cluster management
|
||||
|
||||
2. **Master Key Generation & Display**
|
||||
- Original: One-time master key display with security warnings
|
||||
- Current: No cryptographic key management
|
||||
- Impact: No secure cluster recovery mechanism
|
||||
|
||||
3. **SSH-Based Cluster Deployment**
|
||||
- Original: Deploy from one node to entire cluster
|
||||
- Current: Manual installation on each node
|
||||
- Impact: Scaling difficulty, no centralized deployment
|
||||
|
||||
4. **Automatic P2P Network Formation**
|
||||
- Original: Nodes discover and organize automatically
|
||||
- Current: Static configuration per node
|
||||
- Impact: No dynamic cluster topology
|
||||
|
||||
### 🟡 MEDIUM PRIORITY GAPS
|
||||
|
||||
5. **Shamir's Secret Sharing**
|
||||
- Original: Distributed admin key management
|
||||
- Current: No key splitting or distribution
|
||||
- Impact: Single points of failure
|
||||
|
||||
6. **Leader Election Activation**
|
||||
- Original: Automatic leader selection with weighted scoring
|
||||
- Current: Manual coordinator assignment
|
||||
- Impact: No dynamic leadership, manual failover
|
||||
|
||||
7. **DHT Business Configuration**
|
||||
- Original: Distributed configuration storage
|
||||
- Current: Local YAML files
|
||||
- Impact: No configuration replication or consistency
|
||||
|
||||
8. **P2P Model Distribution**
|
||||
- Original: Cluster-wide model synchronization
|
||||
- Current: Individual node model management
|
||||
- Impact: Manual model management across cluster
|
||||
|
||||
## Architectural Trade-offs Made
|
||||
|
||||
### ✅ **GAINED: Simplicity & Speed**
|
||||
- Fast installation (single command)
|
||||
- Working system in minutes
|
||||
- Repository integration works immediately
|
||||
- Clear configuration files
|
||||
- Easy troubleshooting
|
||||
|
||||
### ❌ **LOST: Enterprise Features**
|
||||
- No centralized cluster management
|
||||
- No cryptographic security model
|
||||
- No automatic scaling capabilities
|
||||
- No distributed configuration
|
||||
- No sophisticated failure recovery
|
||||
|
||||
## Recommendations
|
||||
|
||||
### Short-term (Immediate)
|
||||
1. **Document the gap** - Users need to understand current limitations
|
||||
2. **Manual cluster setup guide** - Document how to deploy across multiple nodes manually
|
||||
3. **Basic health checking** - Add cluster connectivity validation
|
||||
4. **Configuration templates** - Provide coordinator vs worker config examples
|
||||
|
||||
### Medium-term (Next Phase)
|
||||
1. **Web UI Development** - Implement the missing `:8080/setup` interface
|
||||
2. **SSH Deployment Module** - Add remote installation capabilities
|
||||
3. **P2P Network Activation** - Enable automatic peer discovery
|
||||
4. **Basic Key Management** - Implement simplified security model
|
||||
|
||||
### Long-term (Strategic)
|
||||
1. **Full Plan Implementation** - Gradually implement all 7 phases
|
||||
2. **Security Architecture** - Add Shamir's Secret Sharing and master keys
|
||||
3. **Enterprise Features** - Leader election, DHT storage, model distribution
|
||||
4. **Migration Path** - Allow upgrading from simple to sophisticated deployment
|
||||
|
||||
## Conclusion
|
||||
|
||||
Our enhanced installer successfully delivers **immediate functionality** for repository-based task coordination but represents a **significant simplification** of the original comprehensive plan.
|
||||
|
||||
**Current State:** ✅ Single-node ready, repository integrated, immediately useful
|
||||
**Original Vision:** 🔴 Enterprise-grade, security-first, fully distributed cluster
|
||||
|
||||
The implementation prioritizes **time-to-value** over **comprehensive architecture**. While this enables rapid deployment and testing, it means users must manually scale and manage clusters rather than having sophisticated automated deployment and management capabilities.
|
||||
|
||||
**Strategic Decision Point:** Continue with simplified approach for rapid iteration, or invest in implementing the full sophisticated architecture as originally planned.
|
||||
355
install/SETUP_INTEGRATION_GUIDE.md
Normal file
355
install/SETUP_INTEGRATION_GUIDE.md
Normal file
@@ -0,0 +1,355 @@
|
||||
# BZZZ Web Configuration Setup Integration Guide
|
||||
|
||||
This guide explains how to use the new integrated web-based configuration system for BZZZ.
|
||||
|
||||
## Overview
|
||||
|
||||
BZZZ now includes an embedded web configuration interface that automatically activates when:
|
||||
- No configuration file exists
|
||||
- The existing configuration is invalid or incomplete
|
||||
- Setup is explicitly required
|
||||
|
||||
## Features
|
||||
|
||||
### 🎯 Automatic Setup Detection
|
||||
- BZZZ automatically detects when setup is required on startup
|
||||
- No separate installation or configuration needed
|
||||
- Seamless transition from setup to normal operation
|
||||
|
||||
### 🌐 Embedded Web Interface
|
||||
- Complete React-based setup wizard embedded in the Go binary
|
||||
- No external dependencies required
|
||||
- Works offline and in air-gapped environments
|
||||
|
||||
### 🔧 Comprehensive Configuration
|
||||
- System detection and hardware analysis
|
||||
- Repository integration (GitHub, GitLab, Gitea)
|
||||
- Network and security configuration
|
||||
- AI model and capability setup
|
||||
- Service deployment options
|
||||
|
||||
## Quick Start
|
||||
|
||||
### 1. Build BZZZ with Embedded UI
|
||||
|
||||
```bash
|
||||
# Build the complete system with embedded web UI
|
||||
make build
|
||||
|
||||
# Or build just the binary (uses placeholder UI)
|
||||
make build-go
|
||||
```
|
||||
|
||||
### 2. First-Time Setup
|
||||
|
||||
```bash
|
||||
# Start BZZZ - it will automatically enter setup mode
|
||||
./build/bzzz
|
||||
|
||||
# Or use the transition script for guided setup
|
||||
./scripts/setup-transition.sh
|
||||
```
|
||||
|
||||
### 3. Access Setup Interface
|
||||
|
||||
Open your browser to: **http://localhost:8080**
|
||||
|
||||
The setup wizard will guide you through:
|
||||
1. **System Detection** - Hardware and environment analysis
|
||||
2. **Agent Configuration** - ID, capabilities, and AI models
|
||||
3. **Repository Setup** - Git integration configuration
|
||||
4. **Network Configuration** - P2P and cluster settings
|
||||
5. **Security Setup** - Encryption and access control
|
||||
6. **Service Deployment** - Additional services configuration
|
||||
7. **Testing & Validation** - Configuration verification
|
||||
|
||||
### 4. Complete Setup
|
||||
|
||||
After saving configuration:
|
||||
1. BZZZ will create the configuration file
|
||||
2. Restart BZZZ to enter normal operation mode
|
||||
3. The web interface will no longer be available
|
||||
|
||||
## Development Workflow
|
||||
|
||||
### Building the Web UI
|
||||
|
||||
```bash
|
||||
# Install dependencies
|
||||
make deps
|
||||
|
||||
# Build just the web UI
|
||||
make build-ui
|
||||
|
||||
# Embed web UI in Go binary
|
||||
make embed-ui
|
||||
|
||||
# Complete build process
|
||||
make build
|
||||
```
|
||||
|
||||
### Development Mode
|
||||
|
||||
```bash
|
||||
# Start both React dev server and Go API
|
||||
make dev
|
||||
|
||||
# React UI: http://localhost:3000
|
||||
# Go API: http://localhost:8080
|
||||
```
|
||||
|
||||
### Project Structure
|
||||
|
||||
```
|
||||
BZZZ/
|
||||
├── install/config-ui/ # React setup wizard
|
||||
│ ├── app/ # Next.js application
|
||||
│ ├── package.json # Node.js dependencies
|
||||
│ └── next.config.js # Build configuration
|
||||
├── pkg/web/ # Embedded file system
|
||||
│ ├── embed.go # File embedding logic
|
||||
│ └── index.html # Fallback page
|
||||
├── api/ # Go HTTP server
|
||||
│ ├── http_server.go # Main server with setup routes
|
||||
│ └── setup_manager.go # Setup logic
|
||||
├── Makefile # Build automation
|
||||
└── scripts/
|
||||
└── setup-transition.sh # Setup helper script
|
||||
```
|
||||
|
||||
## Configuration Management
|
||||
|
||||
### Configuration Files
|
||||
|
||||
- **Default Location**: `~/.bzzz/config.yaml`
|
||||
- **Environment Override**: `BZZZ_CONFIG_PATH`
|
||||
- **Backup Directory**: `~/.bzzz/backups/`
|
||||
|
||||
### Setup Requirements Detection
|
||||
|
||||
BZZZ checks for setup requirements using:
|
||||
1. Configuration file existence
|
||||
2. Configuration file validity
|
||||
3. Essential fields completion (Agent ID, capabilities, models)
|
||||
|
||||
### Configuration Validation
|
||||
|
||||
The setup system validates:
|
||||
- Required fields presence
|
||||
- Repository connectivity
|
||||
- AI model availability
|
||||
- Network configuration
|
||||
- Security settings
|
||||
|
||||
## API Endpoints
|
||||
|
||||
### Setup Mode APIs
|
||||
|
||||
When in setup mode, BZZZ exposes these endpoints:
|
||||
|
||||
```bash
|
||||
# Check if setup is required
|
||||
GET /api/setup/required
|
||||
|
||||
# Get system information
|
||||
GET /api/setup/system
|
||||
|
||||
# Validate repository configuration
|
||||
POST /api/setup/repository/validate
|
||||
|
||||
# Get supported repository providers
|
||||
GET /api/setup/repository/providers
|
||||
|
||||
# Validate complete configuration
|
||||
POST /api/setup/validate
|
||||
|
||||
# Save configuration
|
||||
POST /api/setup/save
|
||||
|
||||
# Health check
|
||||
GET /api/health
|
||||
```
|
||||
|
||||
### Web UI Routes
|
||||
|
||||
```bash
|
||||
# Setup interface (embedded React app)
|
||||
GET /
|
||||
GET /setup
|
||||
GET /setup/*
|
||||
|
||||
# API proxy (development only)
|
||||
/api/* -> http://localhost:8080/api/*
|
||||
```
|
||||
|
||||
## Deployment Scenarios
|
||||
|
||||
### 1. Fresh Installation
|
||||
|
||||
```bash
|
||||
# Build and start BZZZ
|
||||
make build
|
||||
./build/bzzz
|
||||
|
||||
# Access setup at http://localhost:8080
|
||||
# Complete configuration wizard
|
||||
# Restart BZZZ for normal operation
|
||||
```
|
||||
|
||||
### 2. Existing Installation
|
||||
|
||||
```bash
|
||||
# Backup existing configuration
|
||||
./scripts/setup-transition.sh
|
||||
|
||||
# BZZZ will use existing config if valid
|
||||
# Or enter setup mode if invalid
|
||||
```
|
||||
|
||||
### 3. Container Deployment
|
||||
|
||||
```dockerfile
|
||||
# Build container with embedded UI
|
||||
FROM golang:1.21-alpine AS builder
|
||||
COPY . /app
|
||||
WORKDIR /app
|
||||
RUN make build
|
||||
|
||||
FROM alpine:latest
|
||||
COPY --from=builder /app/build/bzzz /usr/local/bin/
|
||||
EXPOSE 8080
|
||||
CMD ["bzzz"]
|
||||
```
|
||||
|
||||
### 4. Cluster Deployment
|
||||
|
||||
```bash
|
||||
# Build BZZZ with embedded UI
|
||||
make build
|
||||
|
||||
# Deploy to each cluster node
|
||||
scp build/bzzz node1:/usr/local/bin/
|
||||
ssh node1 'bzzz' # Setup via web interface
|
||||
|
||||
# Repeat for additional nodes
|
||||
# Nodes will discover each other via mDNS
|
||||
```
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
### Common Issues
|
||||
|
||||
**Web UI Not Loading**
|
||||
```bash
|
||||
# Check if web UI was built
|
||||
make build-ui
|
||||
|
||||
# Verify embedded files
|
||||
ls -la pkg/web/
|
||||
|
||||
# Rebuild if necessary
|
||||
make clean && make build
|
||||
```
|
||||
|
||||
**Setup Not Starting**
|
||||
```bash
|
||||
# Check configuration status
|
||||
./scripts/setup-transition.sh
|
||||
|
||||
# Force setup mode by removing config
|
||||
rm ~/.bzzz/config.yaml
|
||||
./build/bzzz
|
||||
```
|
||||
|
||||
**Port Conflicts**
|
||||
```bash
|
||||
# Check if port 8080 is in use
|
||||
netstat -tulpn | grep 8080
|
||||
|
||||
# Kill conflicting processes
|
||||
sudo lsof -ti:8080 | xargs kill -9
|
||||
```
|
||||
|
||||
### Debug Mode
|
||||
|
||||
```bash
|
||||
# Enable debug logging
|
||||
export BZZZ_LOG_LEVEL=debug
|
||||
./build/bzzz
|
||||
|
||||
# Check embedded files
|
||||
curl http://localhost:8080/api/health
|
||||
```
|
||||
|
||||
## Security Considerations
|
||||
|
||||
### Network Security
|
||||
- Setup interface only accessible on localhost by default
|
||||
- CORS enabled for development, restricted in production
|
||||
- HTTPS recommended for external access
|
||||
|
||||
### Configuration Security
|
||||
- Sensitive values (tokens, keys) stored in separate files
|
||||
- Configuration backups created automatically
|
||||
- Audit logging for configuration changes
|
||||
|
||||
### Access Control
|
||||
- Setup mode automatically disabled after configuration
|
||||
- No authentication required for initial setup
|
||||
- Full authentication required for normal operation
|
||||
|
||||
## Advanced Usage
|
||||
|
||||
### Custom Build Configuration
|
||||
|
||||
```bash
|
||||
# Build with custom UI path
|
||||
UI_DIR=custom-ui make build
|
||||
|
||||
# Build without UI (API only)
|
||||
make build-go
|
||||
|
||||
# Production build with optimizations
|
||||
NODE_ENV=production make build
|
||||
```
|
||||
|
||||
### Configuration Migration
|
||||
|
||||
```bash
|
||||
# Export existing configuration
|
||||
bzzz --export-config > backup.yaml
|
||||
|
||||
# Import configuration
|
||||
bzzz --import-config backup.yaml
|
||||
|
||||
# Validate configuration
|
||||
bzzz --config-check
|
||||
```
|
||||
|
||||
### Integration Testing
|
||||
|
||||
```bash
|
||||
# Test complete setup flow
|
||||
make test
|
||||
|
||||
# Test web UI components
|
||||
cd install/config-ui && npm test
|
||||
|
||||
# Test Go integration
|
||||
go test ./api/...
|
||||
```
|
||||
|
||||
## Next Steps
|
||||
|
||||
After completing setup:
|
||||
|
||||
1. **Verify Operation**: Check BZZZ logs and peer connections
|
||||
2. **Configure Repositories**: Add GitHub/GitLab tokens and repositories
|
||||
3. **Join Cluster**: Configure additional nodes to join the cluster
|
||||
4. **Monitor Health**: Use `/api/health` endpoint for monitoring
|
||||
5. **Scale Services**: Deploy additional BZZZ components as needed
|
||||
|
||||
For advanced configuration and cluster management, see:
|
||||
- [BZZZ Architecture Documentation](../docs/BZZZ-2B-ARCHITECTURE.md)
|
||||
- [Operations Guide](../docs/BZZZv2B-OPERATIONS.md)
|
||||
- [Developer Manual](../docs/BZZZv2B-DEVELOPER.md)
|
||||
425
install/WEB_UI_DEVELOPMENT_PLAN.md
Normal file
425
install/WEB_UI_DEVELOPMENT_PLAN.md
Normal file
@@ -0,0 +1,425 @@
|
||||
# BZZZ Web Installation/Configuration Development Plan
|
||||
|
||||
## Overview
|
||||
|
||||
This plan leverages existing BZZZ infrastructure to implement the missing web-based installation and configuration functionality without reinventing the wheel. We'll integrate the existing config-ui with our enhanced installer and BZZZ's existing systems.
|
||||
|
||||
## Existing Infrastructure Analysis
|
||||
|
||||
### ✅ **What We Already Have**
|
||||
|
||||
1. **HTTP API Server** (`api/http_server.go`)
|
||||
- Existing HTTP server with CORS support
|
||||
- Health endpoints (`/api/health`, `/api/status`)
|
||||
- Hypercore log API endpoints
|
||||
- Gorilla Mux router setup
|
||||
|
||||
2. **Config UI Foundation** (`install/config-ui/`)
|
||||
- Complete Next.js 14 setup
|
||||
- 8-step setup wizard framework
|
||||
- TypeScript + Tailwind CSS
|
||||
- Component structure already defined
|
||||
- Progress tracking and navigation
|
||||
|
||||
3. **Task Coordinator** (`coordinator/task_coordinator.go`)
|
||||
- Agent management and role assignment
|
||||
- Repository integration framework
|
||||
- Status reporting capabilities
|
||||
|
||||
4. **Configuration System** (`pkg/config/`)
|
||||
- YAML configuration management
|
||||
- Role and agent configuration
|
||||
- Network and service settings
|
||||
|
||||
5. **Repository Integration** (`repository/factory.go`)
|
||||
- GITEA and GitHub providers
|
||||
- Task management interfaces
|
||||
- Credential handling
|
||||
|
||||
## Implementation Strategy
|
||||
|
||||
### Phase 1: Backend API Integration (1-2 days)
|
||||
|
||||
#### 1.1 Extend HTTP Server with Setup APIs
|
||||
**File**: `api/http_server.go`
|
||||
|
||||
Add new endpoints to existing server:
|
||||
```go
|
||||
// Setup and configuration endpoints
|
||||
api.HandleFunc("/setup/system", h.handleSystemInfo).Methods("GET")
|
||||
api.HandleFunc("/setup/network", h.handleNetworkConfig).Methods("GET", "POST")
|
||||
api.HandleFunc("/setup/security", h.handleSecurityConfig).Methods("GET", "POST")
|
||||
api.HandleFunc("/setup/ai", h.handleAIConfig).Methods("GET", "POST")
|
||||
api.HandleFunc("/setup/resources", h.handleResourceConfig).Methods("GET", "POST")
|
||||
api.HandleFunc("/setup/deploy", h.handleServiceDeploy).Methods("POST")
|
||||
api.HandleFunc("/setup/cluster", h.handleClusterConfig).Methods("GET", "POST")
|
||||
api.HandleFunc("/setup/validate", h.handleValidation).Methods("POST")
|
||||
|
||||
// Repository configuration (integrate with existing factory)
|
||||
api.HandleFunc("/setup/repository", h.handleRepositoryConfig).Methods("GET", "POST")
|
||||
```
|
||||
|
||||
#### 1.2 System Detection Integration
|
||||
Leverage existing system info from enhanced installer:
|
||||
```go
|
||||
func (h *HTTPServer) handleSystemInfo(w http.ResponseWriter, r *http.Request) {
|
||||
info := map[string]interface{}{
|
||||
"os": detectOS(), // From enhanced installer
|
||||
"architecture": detectArchitecture(), // From enhanced installer
|
||||
"hardware": detectHardware(), // New GPU detection
|
||||
"network": detectNetwork(), // Network interface discovery
|
||||
"services": detectServices(), // Docker, Ollama status
|
||||
}
|
||||
json.NewEncoder(w).Encode(info)
|
||||
}
|
||||
```
|
||||
|
||||
#### 1.3 Configuration Management
|
||||
Extend existing config system to support web updates:
|
||||
```go
|
||||
// New file: api/setup_handlers.go
|
||||
type SetupManager struct {
|
||||
configPath string
|
||||
coordinator *coordinator.TaskCoordinator
|
||||
repoFactory *repository.DefaultProviderFactory
|
||||
}
|
||||
|
||||
func (s *SetupManager) UpdateNetworkConfig(config NetworkConfig) error {
|
||||
// Update YAML configuration
|
||||
// Restart network services if needed
|
||||
// Validate connectivity
|
||||
}
|
||||
```
|
||||
|
||||
### Phase 2: Web UI Enhancement (2-3 days)
|
||||
|
||||
#### 2.1 Complete Existing Components
|
||||
The config-ui framework exists but components need implementation:
|
||||
|
||||
**SystemDetection.tsx** - Leverage system detection API:
|
||||
```typescript
|
||||
const SystemDetection = ({ onComplete, systemInfo }) => {
|
||||
// Display detected hardware (GPU detection for Parallama)
|
||||
// Show system requirements validation
|
||||
// Network interface selection
|
||||
// Prerequisite checking
|
||||
}
|
||||
```
|
||||
|
||||
**NetworkConfiguration.tsx** - Network setup:
|
||||
```typescript
|
||||
const NetworkConfiguration = ({ onComplete, configData }) => {
|
||||
// Port configuration (8080, 8081, 4001)
|
||||
// Firewall rules setup
|
||||
// Network interface selection
|
||||
// Connectivity testing
|
||||
}
|
||||
```
|
||||
|
||||
**SecuritySetup.tsx** - Security configuration:
|
||||
```typescript
|
||||
const SecuritySetup = ({ onComplete, configData }) => {
|
||||
// SSH key generation/upload (for cluster deployment)
|
||||
// TLS certificate setup
|
||||
// Authentication method selection
|
||||
// Security policy configuration
|
||||
}
|
||||
```
|
||||
|
||||
#### 2.2 Repository Integration Component
|
||||
**File**: `install/config-ui/app/setup/components/RepositoryConfiguration.tsx`
|
||||
```typescript
|
||||
const RepositoryConfiguration = ({ onComplete, configData }) => {
|
||||
// GITEA/GitHub provider selection
|
||||
// Credential input and validation
|
||||
// Repository access testing
|
||||
// Task label configuration
|
||||
// Integration with existing repository factory
|
||||
}
|
||||
```
|
||||
|
||||
#### 2.3 AI Configuration Enhancement
|
||||
**AIConfiguration.tsx** - GPU optimization:
|
||||
```typescript
|
||||
const AIConfiguration = ({ onComplete, systemInfo }) => {
|
||||
// GPU detection display
|
||||
// Parallama vs Ollama recommendation
|
||||
// OpenAI API configuration
|
||||
// Model selection and downloading
|
||||
// Resource allocation per model
|
||||
}
|
||||
```
|
||||
|
||||
### Phase 3: Installer Integration (1 day)
|
||||
|
||||
#### 3.1 Enhanced Installer Web Mode
|
||||
**File**: `/home/tony/chorus/project-queues/active/chorus.services/installer/install-chorus-enhanced.sh`
|
||||
|
||||
Add web UI mode option:
|
||||
```bash
|
||||
# Add new command line option
|
||||
while [[ $# -gt 0 ]]; do
|
||||
case $1 in
|
||||
--web-ui)
|
||||
ENABLE_WEB_UI=true
|
||||
shift
|
||||
;;
|
||||
# ... existing options
|
||||
esac
|
||||
done
|
||||
|
||||
# After basic installation
|
||||
if [[ "$ENABLE_WEB_UI" == "true" ]]; then
|
||||
setup_web_ui
|
||||
fi
|
||||
|
||||
setup_web_ui() {
|
||||
log_step "Setting up web configuration interface..."
|
||||
|
||||
# Copy config-ui to BZZZ directory
|
||||
cp -r "$BZZZ_DIR/../install/config-ui" "$BZZZ_DIR/web-ui"
|
||||
|
||||
# Install Node.js and dependencies
|
||||
install_nodejs
|
||||
cd "$BZZZ_DIR/web-ui" && npm install
|
||||
|
||||
# Start web UI in background
|
||||
npm run build && npm run start &
|
||||
|
||||
echo ""
|
||||
echo "🌐 Web configuration available at: http://$(hostname):8080/setup"
|
||||
echo "⚡ Continue setup in your browser"
|
||||
}
|
||||
```
|
||||
|
||||
#### 3.2 Hybrid Installation Flow
|
||||
```bash
|
||||
# Enhanced installer usage options:
|
||||
curl -fsSL https://chorus.services/install-enhanced.sh | sh # CLI mode (current)
|
||||
curl -fsSL https://chorus.services/install-enhanced.sh | sh -s -- --web-ui # Web mode (new)
|
||||
```
|
||||
|
||||
### Phase 4: Cluster Deployment Integration (2-3 days)
|
||||
|
||||
#### 4.1 SSH Deployment System
|
||||
**File**: `api/cluster_deployment.go`
|
||||
```go
|
||||
type ClusterDeployer struct {
|
||||
sshConfig SSHConfig
|
||||
installer string // Enhanced installer script
|
||||
coordinator *coordinator.TaskCoordinator
|
||||
}
|
||||
|
||||
func (c *ClusterDeployer) DeployToNodes(nodes []NodeConfig) error {
|
||||
for _, node := range nodes {
|
||||
// SSH to remote node
|
||||
// Execute enhanced installer with node-specific config
|
||||
// Verify installation
|
||||
// Add to cluster coordination
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
#### 4.2 Cluster Formation Component
|
||||
**ClusterFormation.tsx** - Multi-node coordination:
|
||||
```typescript
|
||||
const ClusterFormation = ({ onComplete, configData }) => {
|
||||
// Node discovery (SSH-based or manual IP entry)
|
||||
// SSH credential configuration
|
||||
// Remote deployment progress tracking
|
||||
// Cluster validation and health checking
|
||||
// P2P network formation verification
|
||||
}
|
||||
```
|
||||
|
||||
#### 4.3 P2P Network Integration
|
||||
Leverage existing P2P infrastructure:
|
||||
```go
|
||||
// Integration with existing p2p/node.go
|
||||
func (h *HTTPServer) handleClusterConfig(w http.ResponseWriter, r *http.Request) {
|
||||
// Use existing P2P node configuration
|
||||
// Coordinate with task coordinator
|
||||
// Enable automatic peer discovery
|
||||
}
|
||||
```
|
||||
|
||||
### Phase 5: Professional Installation Experience (1-2 days)
|
||||
|
||||
#### 5.1 Enhanced Installation Output
|
||||
```bash
|
||||
# Professional branded installer output
|
||||
print_professional_banner() {
|
||||
echo -e "${PURPLE}"
|
||||
cat << 'EOF'
|
||||
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||
🔥 BZZZ Distributed AI Coordination Platform
|
||||
Professional Installation System v2.0
|
||||
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||
EOF
|
||||
echo -e "${NC}"
|
||||
}
|
||||
|
||||
show_installation_progress() {
|
||||
local step="$1"
|
||||
local total="$2"
|
||||
local message="$3"
|
||||
|
||||
echo -e "${BLUE}[$step/$total]${NC} $message"
|
||||
|
||||
# Progress bar
|
||||
local progress=$((step * 100 / total))
|
||||
printf "Progress: ["
|
||||
for ((i=0; i<progress/5; i++)); do printf "█"; done
|
||||
for ((i=progress/5; i<20; i++)); do printf "░"; done
|
||||
printf "] %d%%\n" $progress
|
||||
}
|
||||
```
|
||||
|
||||
#### 5.2 GPU Detection and Parallama Integration
|
||||
```bash
|
||||
detect_gpu_configuration() {
|
||||
log_step "Analyzing GPU configuration..."
|
||||
|
||||
# Detect NVIDIA GPUs
|
||||
if command -v nvidia-smi >/dev/null 2>&1; then
|
||||
GPU_COUNT=$(nvidia-smi --list-gpus | wc -l)
|
||||
GPU_INFO=$(nvidia-smi --query-gpu=name,memory.total --format=csv,noheader)
|
||||
|
||||
if [[ $GPU_COUNT -gt 1 ]]; then
|
||||
echo ""
|
||||
echo -e "${GREEN}🚀 Multi-GPU Setup Detected ($GPU_COUNT NVIDIA GPUs)${NC}"
|
||||
echo -e "${CYAN}Parallama is RECOMMENDED for optimal multi-GPU performance!${NC}"
|
||||
echo ""
|
||||
echo "Detected GPUs:"
|
||||
echo "$GPU_INFO" | sed 's/^/ • /'
|
||||
echo ""
|
||||
|
||||
read -p "Install Parallama (recommended) or standard Ollama? [P/o]: " choice
|
||||
case $choice in
|
||||
[Oo]* ) INSTALL_OLLAMA_TYPE="standard" ;;
|
||||
* ) INSTALL_OLLAMA_TYPE="parallama" ;;
|
||||
esac
|
||||
fi
|
||||
fi
|
||||
}
|
||||
```
|
||||
|
||||
## Implementation Timeline
|
||||
|
||||
### Week 1: Backend Foundation
|
||||
- **Day 1-2**: Extend HTTP server with setup APIs
|
||||
- **Day 3-4**: Implement system detection and configuration management
|
||||
- **Day 5**: Repository integration and credential handling
|
||||
|
||||
### Week 2: Web UI Development
|
||||
- **Day 1-2**: Complete existing setup components
|
||||
- **Day 3-4**: Repository configuration and AI setup components
|
||||
- **Day 5**: Integration testing and UI polish
|
||||
|
||||
### Week 3: Cluster and Professional Features
|
||||
- **Day 1-2**: SSH deployment system and cluster formation
|
||||
- **Day 3-4**: Professional installation experience and GPU detection
|
||||
- **Day 5**: End-to-end testing and documentation
|
||||
|
||||
## Leveraging Existing BZZZ Systems
|
||||
|
||||
### ✅ **Reuse Without Modification**
|
||||
1. **HTTP Server Architecture** - Extend existing `api/http_server.go`
|
||||
2. **Configuration System** - Use existing `pkg/config/` YAML management
|
||||
3. **Repository Integration** - Leverage `repository/factory.go` providers
|
||||
4. **Task Coordination** - Integrate with `coordinator/task_coordinator.go`
|
||||
5. **P2P Networking** - Use existing `p2p/node.go` infrastructure
|
||||
|
||||
### 🔧 **Extend Existing Systems**
|
||||
1. **Enhanced Installer** - Add web UI mode to existing script
|
||||
2. **Config UI Framework** - Complete existing component implementations
|
||||
3. **API Endpoints** - Add setup endpoints to existing HTTP server
|
||||
4. **System Detection** - Enhance existing OS detection with hardware profiling
|
||||
|
||||
### 🆕 **New Components Needed**
|
||||
1. **Cluster Deployment Manager** - SSH-based remote installation
|
||||
2. **GPU Detection System** - Hardware profiling and Parallama integration
|
||||
3. **Professional Installation UX** - Enhanced progress and branding
|
||||
4. **Setup API Handlers** - Backend logic for web configuration
|
||||
|
||||
## Integration Points
|
||||
|
||||
### Repository Integration
|
||||
```go
|
||||
// Leverage existing repository factory
|
||||
func (h *HTTPServer) handleRepositoryConfig(w http.ResponseWriter, r *http.Request) {
|
||||
factory := &repository.DefaultProviderFactory{}
|
||||
|
||||
// Create provider based on web UI input
|
||||
provider, err := factory.CreateProvider(ctx, repoConfig)
|
||||
|
||||
// Test connectivity
|
||||
// Store configuration
|
||||
// Update task coordinator
|
||||
}
|
||||
```
|
||||
|
||||
### Task Coordinator Integration
|
||||
```go
|
||||
// Use existing task coordinator for cluster management
|
||||
func (h *HTTPServer) handleClusterStatus(w http.ResponseWriter, r *http.Request) {
|
||||
status := h.taskCoordinator.GetStatus()
|
||||
json.NewEncoder(w).Encode(status)
|
||||
}
|
||||
```
|
||||
|
||||
### Configuration Management
|
||||
```go
|
||||
// Extend existing config system
|
||||
func (s *SetupManager) SaveConfiguration(config SetupConfig) error {
|
||||
// Convert web config to BZZZ YAML format
|
||||
// Use existing config.Config struct
|
||||
// Restart services as needed
|
||||
}
|
||||
```
|
||||
|
||||
## Success Metrics
|
||||
|
||||
### Technical Completeness
|
||||
- [ ] Web UI accessible at `:8080/setup`
|
||||
- [ ] 8-step configuration wizard functional
|
||||
- [ ] GPU detection and Parallama recommendation
|
||||
- [ ] SSH-based cluster deployment
|
||||
- [ ] Repository integration (GITEA/GitHub)
|
||||
- [ ] Professional installation experience
|
||||
|
||||
### User Experience
|
||||
- [ ] Single-command installation with web option
|
||||
- [ ] Intuitive progress tracking and navigation
|
||||
- [ ] Real-time validation and error handling
|
||||
- [ ] Mobile-responsive design
|
||||
- [ ] Comprehensive help and documentation
|
||||
|
||||
### Integration Quality
|
||||
- [ ] Seamless integration with existing BZZZ systems
|
||||
- [ ] No disruption to current enhanced installer
|
||||
- [ ] Proper error handling and rollback
|
||||
- [ ] Production-ready security and performance
|
||||
|
||||
## Risk Mitigation
|
||||
|
||||
### Technical Risks
|
||||
- **API Integration Complexity**: Use existing HTTP server patterns
|
||||
- **Configuration Conflicts**: Maintain YAML compatibility
|
||||
- **Service Coordination**: Leverage existing task coordinator
|
||||
|
||||
### User Experience Risks
|
||||
- **Installation Complexity**: Provide both CLI and web options
|
||||
- **Error Recovery**: Implement proper rollback mechanisms
|
||||
- **Performance**: Optimize for low-resource environments
|
||||
|
||||
## Conclusion
|
||||
|
||||
This plan leverages 80% of existing BZZZ infrastructure while delivering the professional web-based installation experience envisioned in the original plans. By extending rather than replacing existing systems, we minimize development time and maintain compatibility with current deployments.
|
||||
|
||||
**Key Benefits:**
|
||||
- ✅ Rapid implementation using existing code
|
||||
- ✅ Maintains backward compatibility
|
||||
- ✅ Professional installation experience
|
||||
- ✅ Complete feature parity with original vision
|
||||
- ✅ Seamless integration with enhanced installer
|
||||
143
install/config-ui/CHORUS-BRANDING-TRANSFORMATION.md
Normal file
143
install/config-ui/CHORUS-BRANDING-TRANSFORMATION.md
Normal file
@@ -0,0 +1,143 @@
|
||||
# CHORUS Branding Transformation - Config UI
|
||||
|
||||
## Overview
|
||||
Successfully transformed the BZZZ configuration UI to reflect the ultra-minimalist CHORUS branding and design system.
|
||||
|
||||
## 🎨 Visual Transformation Completed
|
||||
|
||||
### **Before (BZZZ)** → **After (CHORUS)**
|
||||
|
||||
| **Element** | **Original (BZZZ)** | **New (CHORUS)** |
|
||||
|-------------|-------------------|------------------|
|
||||
| **Primary Color** | Orange `#FF6B35` | Dark Mulberry `#0b0213` |
|
||||
| **Secondary Color** | Blue `#004E89` | Orchestration Blue `#5a6c80` |
|
||||
| **Background** | Gray `#F7F7F7` | Natural Paper `#F5F5DC` |
|
||||
| **Logo** | Orange "B" icon | Mobius ring logo |
|
||||
| **Card Style** | Rounded + shadows | Clean + invisible borders |
|
||||
| **Corners** | 8px rounded | 3-5px subtle curves |
|
||||
| **Spacing** | Standard 24px | Generous 32px+ |
|
||||
| **Typography** | Mixed hierarchy | Clean SF Pro system |
|
||||
|
||||
---
|
||||
|
||||
## ✅ Changes Implemented
|
||||
|
||||
### 1. **Brand Identity Update**
|
||||
- ✅ Changed all "BZZZ" references to "CHORUS" or "CHORUS Agent"
|
||||
- ✅ Updated page titles and descriptions
|
||||
- ✅ Integrated Mobius ring logo from brand assets
|
||||
- ✅ Updated localStorage keys from `bzzz-setup-state` to `chorus-setup-state`
|
||||
|
||||
### 2. **Color System Implementation**
|
||||
- ✅ **Primary Actions**: Dark Mulberry `#0b0213` (sophisticated, minimal)
|
||||
- ✅ **Secondary Actions**: Orchestration Blue `#5a6c80` (corporate blue)
|
||||
- ✅ **Accent Elements**: Brushed Nickel `#c1bfb1` (subtle highlights)
|
||||
- ✅ **Background System**: Natural Paper `#F5F5DC` (warm, professional)
|
||||
- ✅ **Text Hierarchy**: 5-level grayscale system for perfect readability
|
||||
|
||||
### 3. **Ultra-Minimalist Design System**
|
||||
- ✅ **Subtle Rounded Corners**: 3px (small), 4px (standard), 5px (large)
|
||||
- ✅ **Invisible Borders**: `#FAFAFA` for organization without visual weight
|
||||
- ✅ **Clean Cards**: No shadows, generous 32px padding
|
||||
- ✅ **Button System**: Opacity-based states, no gradients
|
||||
- ✅ **Typography**: SF Pro Display hierarchy with proper line heights
|
||||
|
||||
### 4. **Layout & Spacing**
|
||||
- ✅ **Header**: Clean logo + title layout with 24px spacing
|
||||
- ✅ **Progress Sidebar**: Minimalist step indicators
|
||||
- ✅ **Grid System**: Increased gap from 32px to 48px for breathing room
|
||||
- ✅ **Form Elements**: Clean inputs with subtle focus states
|
||||
|
||||
### 5. **Component Updates**
|
||||
- ✅ **Progress Steps**: Color-coded current/completed/accessible states
|
||||
- ✅ **Status Indicators**: Monochromatic instead of colorful badges
|
||||
- ✅ **Navigation**: Clean text-based links with hover states
|
||||
- ✅ **Resume Notification**: Subtle blue background with proper contrast
|
||||
|
||||
---
|
||||
|
||||
## 🚀 Technical Implementation
|
||||
|
||||
### Files Modified:
|
||||
1. **`tailwind.config.js`** - Complete color system and design tokens
|
||||
2. **`app/globals.css`** - Ultra-minimalist component classes
|
||||
3. **`app/layout.tsx`** - Header/footer with CHORUS branding
|
||||
4. **`app/setup/page.tsx`** - Progress indicators and content updates
|
||||
5. **`public/assets/`** - Added Mobius ring logo assets
|
||||
|
||||
### Build Status:
|
||||
✅ **Successfully Built** - All TypeScript compilation passed
|
||||
✅ **Static Export** - Ready for deployment
|
||||
✅ **Asset Integration** - Logo files properly referenced
|
||||
|
||||
---
|
||||
|
||||
## 🎯 Key Features Maintained
|
||||
|
||||
### Functionality Preserved:
|
||||
- ✅ **10-step setup wizard** - All steps maintained
|
||||
- ✅ **Progress persistence** - localStorage state management
|
||||
- ✅ **Responsive design** - Mobile and desktop layouts
|
||||
- ✅ **Accessibility** - WCAG 2.1 AA contrast compliance
|
||||
- ✅ **Step navigation** - Forward/backward flow logic
|
||||
|
||||
### Enhanced UX:
|
||||
- ✅ **Visual hierarchy** - Cleaner typography system
|
||||
- ✅ **Reduced cognitive load** - Minimalist interface
|
||||
- ✅ **Professional aesthetic** - Corporate-grade appearance
|
||||
- ✅ **Brand consistency** - Aligned with CHORUS identity
|
||||
|
||||
---
|
||||
|
||||
## 📁 Asset Integration
|
||||
|
||||
### Logo Files Added:
|
||||
- `public/assets/chorus-mobius-on-white.png` - Primary logo for light backgrounds
|
||||
- `public/assets/chorus-landscape-on-white.png` - Horizontal layout option
|
||||
|
||||
### CSS Classes Created:
|
||||
- `.btn-primary`, `.btn-secondary`, `.btn-text` - Button variants
|
||||
- `.card`, `.card-elevated` - Container styles
|
||||
- `.progress-step-*` - Step indicator states
|
||||
- `.heading-*`, `.text-*` - Typography hierarchy
|
||||
|
||||
---
|
||||
|
||||
## 🔍 Quality Assurance
|
||||
|
||||
### Testing Completed:
|
||||
- ✅ **Build Verification** - Next.js production build successful
|
||||
- ✅ **Asset Loading** - Logo images properly referenced
|
||||
- ✅ **CSS Compilation** - Tailwind classes generated correctly
|
||||
- ✅ **Static Export** - HTML files generated for deployment
|
||||
|
||||
### Performance:
|
||||
- ✅ **Bundle Size** - No significant increase (108 kB First Load JS)
|
||||
- ✅ **CSS Optimization** - Tailwind purging working correctly
|
||||
- ✅ **Image Optimization** - Logo assets properly preloaded
|
||||
|
||||
---
|
||||
|
||||
## 🎨 Visual Preview
|
||||
|
||||
The transformed interface now features:
|
||||
|
||||
1. **Clean Header** with Mobius ring logo and sophisticated typography
|
||||
2. **Minimalist Progress Sidebar** with subtle state indicators
|
||||
3. **Ultra-Clean Cards** with generous spacing and invisible borders
|
||||
4. **Professional Color Palette** using CHORUS corporate colors
|
||||
5. **Refined Typography** with proper hierarchy and readability
|
||||
|
||||
---
|
||||
|
||||
## 🚢 Deployment Ready
|
||||
|
||||
The CHORUS-branded configuration UI is now ready for:
|
||||
- ✅ **Production deployment** as part of BZZZ/CHORUS system
|
||||
- ✅ **Integration testing** with backend services
|
||||
- ✅ **User acceptance testing** with the new branding
|
||||
- ✅ **Documentation updates** to reflect CHORUS naming
|
||||
|
||||
---
|
||||
|
||||
**Transformation Complete** - The setup wizard now perfectly represents the CHORUS brand with an ultra-minimalist, sophisticated aesthetic while maintaining all original functionality.
|
||||
55
install/config-ui/app/components/ThemeToggle.tsx
Normal file
55
install/config-ui/app/components/ThemeToggle.tsx
Normal file
@@ -0,0 +1,55 @@
|
||||
'use client'
|
||||
|
||||
import { useState, useEffect } from 'react'
|
||||
import { SunIcon, MoonIcon } from '@heroicons/react/24/outline'
|
||||
|
||||
export default function ThemeToggle() {
|
||||
const [isDark, setIsDark] = useState(true) // Default to dark mode
|
||||
|
||||
useEffect(() => {
|
||||
// Check for saved theme preference or default to dark
|
||||
const savedTheme = localStorage.getItem('chorus-theme')
|
||||
const prefersDark = !savedTheme || savedTheme === 'dark'
|
||||
|
||||
setIsDark(prefersDark)
|
||||
updateTheme(prefersDark)
|
||||
}, [])
|
||||
|
||||
const updateTheme = (dark: boolean) => {
|
||||
const html = document.documentElement
|
||||
if (dark) {
|
||||
html.classList.add('dark')
|
||||
} else {
|
||||
html.classList.remove('dark')
|
||||
}
|
||||
}
|
||||
|
||||
const toggleTheme = () => {
|
||||
const newIsDark = !isDark
|
||||
setIsDark(newIsDark)
|
||||
updateTheme(newIsDark)
|
||||
|
||||
// Save preference
|
||||
localStorage.setItem('chorus-theme', newIsDark ? 'dark' : 'light')
|
||||
}
|
||||
|
||||
return (
|
||||
<button
|
||||
onClick={toggleTheme}
|
||||
className="btn-text flex items-center space-x-2 p-2 rounded-md transition-colors duration-200"
|
||||
aria-label={`Switch to ${isDark ? 'light' : 'dark'} theme`}
|
||||
>
|
||||
{isDark ? (
|
||||
<>
|
||||
<SunIcon className="h-4 w-4" />
|
||||
<span className="text-xs">Light</span>
|
||||
</>
|
||||
) : (
|
||||
<>
|
||||
<MoonIcon className="h-4 w-4" />
|
||||
<span className="text-xs">Dark</span>
|
||||
</>
|
||||
)}
|
||||
</button>
|
||||
)
|
||||
}
|
||||
@@ -4,56 +4,122 @@
|
||||
|
||||
@layer base {
|
||||
html {
|
||||
font-family: system-ui, sans-serif;
|
||||
font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', system-ui, sans-serif;
|
||||
}
|
||||
|
||||
body {
|
||||
@apply bg-chorus-paper text-chorus-text-primary transition-colors duration-200;
|
||||
}
|
||||
}
|
||||
|
||||
@layer components {
|
||||
/* Ultra-Minimalist Button System */
|
||||
.btn-primary {
|
||||
@apply bg-bzzz-primary hover:bg-opacity-90 text-white font-medium py-2 px-4 rounded-lg transition-all duration-200 disabled:opacity-50 disabled:cursor-not-allowed;
|
||||
@apply bg-chorus-primary hover:opacity-90 text-white font-medium py-3 px-6 rounded-md transition-opacity duration-200 disabled:opacity-40 disabled:cursor-not-allowed border-none;
|
||||
}
|
||||
|
||||
.btn-secondary {
|
||||
@apply bg-bzzz-secondary hover:bg-opacity-90 text-white font-medium py-2 px-4 rounded-lg transition-all duration-200 disabled:opacity-50 disabled:cursor-not-allowed;
|
||||
@apply bg-transparent border border-chorus-secondary text-chorus-secondary hover:bg-chorus-secondary hover:text-white font-medium py-3 px-6 rounded-md transition-all duration-200 disabled:opacity-40 disabled:cursor-not-allowed;
|
||||
}
|
||||
|
||||
.btn-outline {
|
||||
@apply border-2 border-bzzz-primary text-bzzz-primary hover:bg-bzzz-primary hover:text-white font-medium py-2 px-4 rounded-lg transition-all duration-200;
|
||||
@apply border border-chorus-primary text-chorus-primary hover:bg-chorus-primary hover:text-white font-medium py-3 px-6 rounded-md transition-all duration-200;
|
||||
}
|
||||
|
||||
.btn-text {
|
||||
@apply bg-transparent text-chorus-secondary hover:text-white font-medium py-2 px-0 border-none transition-colors duration-200;
|
||||
}
|
||||
|
||||
/* Clean Card System */
|
||||
.card {
|
||||
@apply bg-white rounded-lg shadow-lg p-6 border border-gray-200;
|
||||
@apply bg-white dark:bg-gray-900 border border-gray-200 dark:border-gray-700 p-8 rounded-lg transition-colors duration-200;
|
||||
}
|
||||
|
||||
.card-elevated {
|
||||
@apply bg-gray-50 dark:bg-gray-800 border border-gray-100 dark:border-gray-600 p-8 rounded-lg transition-colors duration-200;
|
||||
}
|
||||
|
||||
/* Form Elements */
|
||||
.input-field {
|
||||
@apply block w-full rounded-md border-gray-300 shadow-sm focus:border-bzzz-primary focus:ring-bzzz-primary sm:text-sm;
|
||||
@apply block w-full border border-gray-300 dark:border-gray-600 p-3 rounded-sm focus:border-chorus-secondary focus:outline-none transition-colors duration-200 bg-white dark:bg-gray-800 text-gray-900 dark:text-gray-100;
|
||||
}
|
||||
|
||||
.input-field:focus {
|
||||
@apply border-chorus-secondary ring-0;
|
||||
}
|
||||
|
||||
.label {
|
||||
@apply block text-sm font-medium text-gray-700 mb-2;
|
||||
@apply block text-sm font-medium text-gray-900 dark:text-gray-100 mb-2;
|
||||
}
|
||||
|
||||
.error-text {
|
||||
@apply text-red-600 text-sm mt-1;
|
||||
@apply text-red-400 text-sm mt-1;
|
||||
}
|
||||
|
||||
.success-text {
|
||||
@apply text-green-600 text-sm mt-1;
|
||||
@apply text-green-400 text-sm mt-1;
|
||||
}
|
||||
|
||||
/* Status System */
|
||||
.status-indicator {
|
||||
@apply inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium;
|
||||
@apply text-xs font-medium;
|
||||
}
|
||||
|
||||
.status-online {
|
||||
@apply status-indicator bg-green-100 text-green-800;
|
||||
@apply status-indicator text-chorus-secondary;
|
||||
}
|
||||
|
||||
.status-offline {
|
||||
@apply status-indicator bg-red-100 text-red-800;
|
||||
@apply status-indicator text-chorus-text-subtle;
|
||||
}
|
||||
|
||||
.status-pending {
|
||||
@apply status-indicator bg-yellow-100 text-yellow-800;
|
||||
@apply status-indicator text-chorus-brown;
|
||||
}
|
||||
|
||||
/* Progress Elements */
|
||||
.progress-step {
|
||||
@apply p-3 rounded-md border transition-all duration-200;
|
||||
}
|
||||
|
||||
.progress-step-current {
|
||||
@apply border-chorus-secondary bg-chorus-secondary bg-opacity-20 text-chorus-secondary;
|
||||
}
|
||||
|
||||
.progress-step-completed {
|
||||
@apply border-chorus-secondary bg-chorus-secondary bg-opacity-10 text-chorus-secondary;
|
||||
}
|
||||
|
||||
.progress-step-accessible {
|
||||
@apply border-chorus-border-defined hover:border-chorus-border-emphasis text-chorus-text-secondary;
|
||||
}
|
||||
|
||||
.progress-step-disabled {
|
||||
@apply border-chorus-border-invisible text-chorus-text-subtle cursor-not-allowed;
|
||||
}
|
||||
|
||||
/* Typography Hierarchy */
|
||||
.heading-hero {
|
||||
@apply text-3xl font-semibold text-gray-900 dark:text-gray-100 tracking-tight;
|
||||
}
|
||||
|
||||
.heading-section {
|
||||
@apply text-2xl font-semibold text-gray-900 dark:text-gray-100;
|
||||
}
|
||||
|
||||
.heading-subsection {
|
||||
@apply text-lg font-medium text-gray-100 dark:text-gray-200;
|
||||
}
|
||||
|
||||
.text-body {
|
||||
@apply text-base text-gray-700 dark:text-gray-300 leading-relaxed;
|
||||
}
|
||||
|
||||
.text-small {
|
||||
@apply text-sm text-gray-600 dark:text-gray-400;
|
||||
}
|
||||
|
||||
.text-ghost {
|
||||
@apply text-sm text-gray-500 dark:text-gray-500;
|
||||
}
|
||||
}
|
||||
@@ -1,9 +1,10 @@
|
||||
import type { Metadata } from 'next'
|
||||
import './globals.css'
|
||||
import ThemeToggle from './components/ThemeToggle'
|
||||
|
||||
export const metadata: Metadata = {
|
||||
title: 'BZZZ Cluster Configuration',
|
||||
description: 'Configure your BZZZ distributed AI coordination cluster',
|
||||
title: 'CHORUS Agent Configuration',
|
||||
description: 'Configure your CHORUS distributed agent orchestration platform',
|
||||
viewport: 'width=device-width, initial-scale=1',
|
||||
}
|
||||
|
||||
@@ -14,30 +15,33 @@ export default function RootLayout({
|
||||
}) {
|
||||
return (
|
||||
<html lang="en">
|
||||
<body className="bg-gray-50 min-h-screen">
|
||||
<body className="bg-gray-50 dark:bg-gray-900 text-gray-900 dark:text-gray-100 min-h-screen transition-colors duration-200">
|
||||
<div className="min-h-screen flex flex-col">
|
||||
<header className="bg-white shadow-sm border-b border-gray-200">
|
||||
<div className="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
|
||||
<div className="flex justify-between items-center py-4">
|
||||
<div className="flex items-center">
|
||||
<header className="bg-gray-900 dark:bg-black border-b border-gray-200 dark:border-gray-800 transition-colors duration-200">
|
||||
<div className="max-w-7xl mx-auto px-8 py-6">
|
||||
<div className="flex justify-between items-center">
|
||||
<div className="flex items-center space-x-4">
|
||||
<div className="flex-shrink-0">
|
||||
<div className="w-8 h-8 bg-bzzz-primary rounded-lg flex items-center justify-center">
|
||||
<span className="text-white font-bold text-lg">B</span>
|
||||
</div>
|
||||
<img
|
||||
src="/assets/chorus-mobius-on-white.png"
|
||||
alt="CHORUS"
|
||||
className="w-10 h-10"
|
||||
/>
|
||||
</div>
|
||||
<div className="ml-3">
|
||||
<h1 className="text-xl font-semibold text-gray-900">
|
||||
BZZZ Cluster Configuration
|
||||
<div>
|
||||
<h1 className="heading-subsection">
|
||||
CHORUS Agent Configuration
|
||||
</h1>
|
||||
<p className="text-sm text-gray-500">
|
||||
Distributed AI Coordination Platform
|
||||
<p className="text-small">
|
||||
Distributed Agent Orchestration Platform
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<div className="flex items-center space-x-4">
|
||||
<div className="flex items-center space-x-6">
|
||||
<div className="status-online">
|
||||
System Online
|
||||
</div>
|
||||
<ThemeToggle />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -47,24 +51,24 @@ export default function RootLayout({
|
||||
{children}
|
||||
</main>
|
||||
|
||||
<footer className="bg-white border-t border-gray-200">
|
||||
<div className="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-4">
|
||||
<div className="flex justify-between items-center text-sm text-gray-500">
|
||||
<footer className="bg-gray-900 dark:bg-black border-t border-gray-200 dark:border-gray-800 transition-colors duration-200">
|
||||
<div className="max-w-7xl mx-auto px-8 py-6">
|
||||
<div className="flex justify-between items-center text-sm text-gray-400">
|
||||
<div>
|
||||
© 2025 Chorus Services. All rights reserved.
|
||||
</div>
|
||||
<div className="flex space-x-4">
|
||||
<div className="flex space-x-6">
|
||||
<a
|
||||
href="https://docs.chorus.services/bzzz"
|
||||
href="https://docs.chorus.services/agents"
|
||||
target="_blank"
|
||||
className="hover:text-bzzz-primary transition-colors"
|
||||
className="btn-text"
|
||||
>
|
||||
Documentation
|
||||
</a>
|
||||
<a
|
||||
href="https://discord.gg/chorus-services"
|
||||
target="_blank"
|
||||
className="hover:text-bzzz-primary transition-colors"
|
||||
className="btn-text"
|
||||
>
|
||||
Support
|
||||
</a>
|
||||
|
||||
@@ -1,22 +1,6 @@
|
||||
'use client'
|
||||
|
||||
import { useEffect } from 'react'
|
||||
import { useRouter } from 'next/navigation'
|
||||
import SetupPage from './setup/page'
|
||||
|
||||
export default function HomePage() {
|
||||
const router = useRouter()
|
||||
|
||||
useEffect(() => {
|
||||
// Redirect to setup page
|
||||
router.push('/setup')
|
||||
}, [router])
|
||||
|
||||
return (
|
||||
<div className="flex items-center justify-center min-h-screen">
|
||||
<div className="text-center">
|
||||
<div className="animate-spin rounded-full h-12 w-12 border-b-2 border-bzzz-primary mx-auto mb-4"></div>
|
||||
<p className="text-gray-600">Redirecting to setup...</p>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
// Serve setup page directly at root to avoid redirect loops
|
||||
return <SetupPage />
|
||||
}
|
||||
@@ -1,6 +1,53 @@
|
||||
'use client'
|
||||
|
||||
import { useState } from 'react'
|
||||
import { useState, useEffect } from 'react'
|
||||
import {
|
||||
CpuChipIcon,
|
||||
SparklesIcon,
|
||||
CurrencyDollarIcon,
|
||||
ServerIcon,
|
||||
CheckCircleIcon,
|
||||
ExclamationTriangleIcon,
|
||||
InformationCircleIcon,
|
||||
EyeIcon,
|
||||
EyeSlashIcon,
|
||||
ArrowPathIcon
|
||||
} from '@heroicons/react/24/outline'
|
||||
|
||||
interface GPUInfo {
|
||||
name: string
|
||||
memory: string
|
||||
type: string
|
||||
driver: string
|
||||
}
|
||||
|
||||
interface AIConfig {
|
||||
// OpenAI Configuration
|
||||
openaiEnabled: boolean
|
||||
openaiApiKey: string
|
||||
openaiOrganization: string
|
||||
openaiDefaultModel: string
|
||||
|
||||
// Cost Management
|
||||
dailyCostLimit: number
|
||||
monthlyCostLimit: number
|
||||
costAlerts: boolean
|
||||
|
||||
// Local AI (Ollama/Parallama)
|
||||
localAIEnabled: boolean
|
||||
localAIType: 'ollama' | 'parallama'
|
||||
localAIEndpoint: string
|
||||
localAIModels: string[]
|
||||
|
||||
// GPU Configuration
|
||||
gpuAcceleration: boolean
|
||||
preferredGPU: string
|
||||
maxGPUMemory: number
|
||||
|
||||
// Model Selection
|
||||
preferredProvider: 'openai' | 'local' | 'hybrid'
|
||||
fallbackEnabled: boolean
|
||||
}
|
||||
|
||||
interface AIConfigurationProps {
|
||||
systemInfo: any
|
||||
@@ -17,35 +64,535 @@ export default function AIConfiguration({
|
||||
onBack,
|
||||
isCompleted
|
||||
}: AIConfigurationProps) {
|
||||
const [config, setConfig] = useState({
|
||||
const [config, setConfig] = useState<AIConfig>({
|
||||
openaiEnabled: false,
|
||||
openaiApiKey: '',
|
||||
defaultModel: 'gpt-5',
|
||||
dailyCostLimit: 100,
|
||||
monthlyCostLimit: 1000,
|
||||
ollamaEnabled: true
|
||||
openaiOrganization: '',
|
||||
openaiDefaultModel: 'gpt-4',
|
||||
|
||||
dailyCostLimit: 50,
|
||||
monthlyCostLimit: 500,
|
||||
costAlerts: true,
|
||||
|
||||
localAIEnabled: true,
|
||||
localAIType: 'ollama',
|
||||
localAIEndpoint: 'http://localhost:11434',
|
||||
localAIModels: ['llama2', 'codellama'],
|
||||
|
||||
gpuAcceleration: false,
|
||||
preferredGPU: '',
|
||||
maxGPUMemory: 8,
|
||||
|
||||
preferredProvider: 'local',
|
||||
fallbackEnabled: true
|
||||
})
|
||||
|
||||
const [showApiKey, setShowApiKey] = useState(false)
|
||||
const [validatingOpenAI, setValidatingOpenAI] = useState(false)
|
||||
const [validatingLocal, setValidatingLocal] = useState(false)
|
||||
const [openaiValid, setOpenaiValid] = useState<boolean | null>(null)
|
||||
const [localAIValid, setLocalAIValid] = useState<boolean | null>(null)
|
||||
|
||||
// Initialize configuration from existing data
|
||||
useEffect(() => {
|
||||
if (configData.ai) {
|
||||
setConfig(prev => ({ ...prev, ...configData.ai }))
|
||||
}
|
||||
|
||||
// Auto-detect GPU capabilities
|
||||
if (systemInfo?.gpus?.length > 0) {
|
||||
const hasNVIDIA = systemInfo.gpus.some((gpu: GPUInfo) => gpu.type === 'nvidia')
|
||||
const hasAMD = systemInfo.gpus.some((gpu: GPUInfo) => gpu.type === 'amd')
|
||||
|
||||
if (hasNVIDIA) {
|
||||
setConfig(prev => ({
|
||||
...prev,
|
||||
gpuAcceleration: true,
|
||||
localAIType: 'parallama', // Parallama typically better for NVIDIA
|
||||
preferredGPU: systemInfo.gpus.find((gpu: GPUInfo) => gpu.type === 'nvidia')?.name || ''
|
||||
}))
|
||||
} else if (hasAMD) {
|
||||
setConfig(prev => ({
|
||||
...prev,
|
||||
gpuAcceleration: true,
|
||||
localAIType: 'ollama', // Ollama works well with AMD
|
||||
preferredGPU: systemInfo.gpus.find((gpu: GPUInfo) => gpu.type === 'amd')?.name || ''
|
||||
}))
|
||||
}
|
||||
}
|
||||
}, [systemInfo, configData])
|
||||
|
||||
const validateOpenAI = async () => {
|
||||
if (!config.openaiApiKey) {
|
||||
setOpenaiValid(false)
|
||||
return
|
||||
}
|
||||
|
||||
setValidatingOpenAI(true)
|
||||
try {
|
||||
// This would be a real API validation in production
|
||||
// For now, just simulate validation
|
||||
await new Promise(resolve => setTimeout(resolve, 1000))
|
||||
setOpenaiValid(true)
|
||||
} catch (error) {
|
||||
setOpenaiValid(false)
|
||||
} finally {
|
||||
setValidatingOpenAI(false)
|
||||
}
|
||||
}
|
||||
|
||||
const validateLocalAI = async () => {
|
||||
if (!config.localAIEndpoint) {
|
||||
setLocalAIValid(false)
|
||||
return
|
||||
}
|
||||
|
||||
setValidatingLocal(true)
|
||||
try {
|
||||
const response = await fetch(`${config.localAIEndpoint}/api/tags`)
|
||||
setLocalAIValid(response.ok)
|
||||
} catch (error) {
|
||||
setLocalAIValid(false)
|
||||
} finally {
|
||||
setValidatingLocal(false)
|
||||
}
|
||||
}
|
||||
|
||||
const getGPURecommendations = () => {
|
||||
if (!systemInfo?.gpus?.length) {
|
||||
return {
|
||||
recommendation: 'No GPU detected. CPU-only processing will be used.',
|
||||
type: 'info',
|
||||
details: 'Consider adding a GPU for better AI performance.'
|
||||
}
|
||||
}
|
||||
|
||||
const gpus = systemInfo.gpus
|
||||
const nvidiaGPUs = gpus.filter((gpu: GPUInfo) => gpu.type === 'nvidia')
|
||||
const amdGPUs = gpus.filter((gpu: GPUInfo) => gpu.type === 'amd')
|
||||
|
||||
if (nvidiaGPUs.length > 0) {
|
||||
return {
|
||||
recommendation: 'NVIDIA GPU detected - Parallama recommended for optimal performance',
|
||||
type: 'success',
|
||||
details: `${nvidiaGPUs[0].name} with ${nvidiaGPUs[0].memory} VRAM detected. Parallama provides excellent NVIDIA GPU acceleration.`
|
||||
}
|
||||
}
|
||||
|
||||
if (amdGPUs.length > 0) {
|
||||
return {
|
||||
recommendation: 'AMD GPU detected - Ollama with ROCm support recommended',
|
||||
type: 'warning',
|
||||
details: `${amdGPUs[0].name} detected. Ollama provides good AMD GPU support through ROCm.`
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
recommendation: 'Integrated GPU detected - Limited AI acceleration available',
|
||||
type: 'warning',
|
||||
details: 'Integrated GPUs provide limited AI acceleration. Consider a dedicated GPU for better performance.'
|
||||
}
|
||||
}
|
||||
|
||||
const getRecommendedModels = () => {
|
||||
const memoryGB = systemInfo?.memory_mb ? Math.round(systemInfo.memory_mb / 1024) : 8
|
||||
|
||||
if (memoryGB >= 32) {
|
||||
return ['llama2:70b', 'codellama:34b', 'mixtral:8x7b']
|
||||
} else if (memoryGB >= 16) {
|
||||
return ['llama2:13b', 'codellama:13b', 'llama2:7b']
|
||||
} else {
|
||||
return ['llama2:7b', 'codellama:7b', 'phi2']
|
||||
}
|
||||
}
|
||||
|
||||
const handleSubmit = (e: React.FormEvent) => {
|
||||
e.preventDefault()
|
||||
|
||||
// Validate that at least one AI provider is configured
|
||||
if (!config.openaiEnabled && !config.localAIEnabled) {
|
||||
alert('Please enable at least one AI provider (OpenAI or Local AI)')
|
||||
return
|
||||
}
|
||||
|
||||
onComplete({ ai: config })
|
||||
}
|
||||
|
||||
const gpuRecommendation = getGPURecommendations()
|
||||
const recommendedModels = getRecommendedModels()
|
||||
|
||||
return (
|
||||
<form onSubmit={handleSubmit} className="space-y-6">
|
||||
<div className="text-center py-12">
|
||||
<h3 className="text-lg font-medium text-gray-900 mb-2">
|
||||
AI Integration
|
||||
</h3>
|
||||
<p className="text-gray-600">
|
||||
Configure OpenAI API, Ollama/Parallama, and cost management settings.
|
||||
</p>
|
||||
<div className="mt-8">
|
||||
<div className="bg-yellow-50 border border-yellow-200 rounded-lg p-4 text-yellow-800">
|
||||
This component is under development. AI configuration will be implemented here.
|
||||
{/* GPU Detection & Recommendations */}
|
||||
{systemInfo?.gpus && (
|
||||
<div className="bg-gray-50 rounded-lg p-6">
|
||||
<h3 className="text-lg font-medium text-gray-900 mb-4 flex items-center">
|
||||
<CpuChipIcon className="h-6 w-6 text-bzzz-primary mr-2" />
|
||||
GPU Configuration
|
||||
</h3>
|
||||
|
||||
<div className={`p-4 rounded-lg border mb-4 ${
|
||||
gpuRecommendation.type === 'success' ? 'bg-green-50 border-green-200' :
|
||||
gpuRecommendation.type === 'warning' ? 'bg-yellow-50 border-yellow-200' :
|
||||
'bg-blue-50 border-blue-200'
|
||||
}`}>
|
||||
<div className="flex items-start">
|
||||
<InformationCircleIcon className={`h-5 w-5 mt-0.5 mr-2 ${
|
||||
gpuRecommendation.type === 'success' ? 'text-green-600' :
|
||||
gpuRecommendation.type === 'warning' ? 'text-yellow-600' :
|
||||
'text-blue-600'
|
||||
}`} />
|
||||
<div>
|
||||
<div className={`font-medium ${
|
||||
gpuRecommendation.type === 'success' ? 'text-green-800' :
|
||||
gpuRecommendation.type === 'warning' ? 'text-yellow-800' :
|
||||
'text-blue-800'
|
||||
}`}>
|
||||
{gpuRecommendation.recommendation}
|
||||
</div>
|
||||
<div className={`text-sm mt-1 ${
|
||||
gpuRecommendation.type === 'success' ? 'text-green-700' :
|
||||
gpuRecommendation.type === 'warning' ? 'text-yellow-700' :
|
||||
'text-blue-700'
|
||||
}`}>
|
||||
{gpuRecommendation.details}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{systemInfo.gpus.length > 0 && (
|
||||
<div className="space-y-3">
|
||||
<div className="flex items-center">
|
||||
<input
|
||||
type="checkbox"
|
||||
id="gpuAcceleration"
|
||||
checked={config.gpuAcceleration}
|
||||
onChange={(e) => setConfig(prev => ({ ...prev, gpuAcceleration: e.target.checked }))}
|
||||
className="h-4 w-4 text-bzzz-primary focus:ring-bzzz-primary border-gray-300 rounded"
|
||||
/>
|
||||
<label htmlFor="gpuAcceleration" className="ml-2 text-sm font-medium text-gray-700">
|
||||
Enable GPU acceleration for AI processing
|
||||
</label>
|
||||
</div>
|
||||
|
||||
{config.gpuAcceleration && (
|
||||
<div>
|
||||
<label className="label">Preferred GPU</label>
|
||||
<select
|
||||
value={config.preferredGPU}
|
||||
onChange={(e) => setConfig(prev => ({ ...prev, preferredGPU: e.target.value }))}
|
||||
className="input-field"
|
||||
>
|
||||
<option value="">Auto-select</option>
|
||||
{systemInfo.gpus.map((gpu: GPUInfo, index: number) => (
|
||||
<option key={index} value={gpu.name}>
|
||||
{gpu.name} ({gpu.type.toUpperCase()}) - {gpu.memory}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* Local AI Configuration */}
|
||||
<div className="bg-white border border-gray-200 rounded-lg p-6">
|
||||
<div className="flex items-center justify-between mb-4">
|
||||
<h3 className="text-lg font-medium text-gray-900 flex items-center">
|
||||
<ServerIcon className="h-6 w-6 text-bzzz-primary mr-2" />
|
||||
Local AI (Ollama/Parallama)
|
||||
</h3>
|
||||
<div className="flex items-center">
|
||||
<input
|
||||
type="checkbox"
|
||||
id="localAIEnabled"
|
||||
checked={config.localAIEnabled}
|
||||
onChange={(e) => setConfig(prev => ({ ...prev, localAIEnabled: e.target.checked }))}
|
||||
className="h-4 w-4 text-bzzz-primary focus:ring-bzzz-primary border-gray-300 rounded"
|
||||
/>
|
||||
<label htmlFor="localAIEnabled" className="ml-2 text-sm font-medium text-gray-700">
|
||||
Enable Local AI
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{config.localAIEnabled && (
|
||||
<div className="space-y-4">
|
||||
<div>
|
||||
<label className="label">Local AI Provider</label>
|
||||
<div className="grid grid-cols-1 md:grid-cols-2 gap-4">
|
||||
<div
|
||||
className={`border-2 rounded-lg p-4 cursor-pointer transition-all ${
|
||||
config.localAIType === 'ollama'
|
||||
? 'border-bzzz-primary bg-bzzz-primary bg-opacity-10'
|
||||
: 'border-gray-200 hover:border-gray-300'
|
||||
}`}
|
||||
onClick={() => setConfig(prev => ({ ...prev, localAIType: 'ollama' }))}
|
||||
>
|
||||
<div className="font-medium text-gray-900">Ollama</div>
|
||||
<div className="text-sm text-gray-600">Open-source, self-hosted AI models</div>
|
||||
<div className="text-xs text-gray-500 mt-1">Best for: AMD GPUs, CPU-only setups</div>
|
||||
</div>
|
||||
|
||||
<div
|
||||
className={`border-2 rounded-lg p-4 cursor-pointer transition-all ${
|
||||
config.localAIType === 'parallama'
|
||||
? 'border-bzzz-primary bg-bzzz-primary bg-opacity-10'
|
||||
: 'border-gray-200 hover:border-gray-300'
|
||||
}`}
|
||||
onClick={() => setConfig(prev => ({ ...prev, localAIType: 'parallama' }))}
|
||||
>
|
||||
<div className="font-medium text-gray-900">Parallama</div>
|
||||
<div className="text-sm text-gray-600">Optimized for parallel processing</div>
|
||||
<div className="text-xs text-gray-500 mt-1">Best for: NVIDIA GPUs, high performance</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label className="label">API Endpoint</label>
|
||||
<div className="flex space-x-2">
|
||||
<input
|
||||
type="url"
|
||||
value={config.localAIEndpoint}
|
||||
onChange={(e) => setConfig(prev => ({ ...prev, localAIEndpoint: e.target.value }))}
|
||||
placeholder="http://localhost:11434"
|
||||
className="input-field flex-1"
|
||||
/>
|
||||
<button
|
||||
type="button"
|
||||
onClick={validateLocalAI}
|
||||
disabled={validatingLocal}
|
||||
className="btn-outline whitespace-nowrap"
|
||||
>
|
||||
{validatingLocal ? (
|
||||
<ArrowPathIcon className="h-4 w-4 animate-spin" />
|
||||
) : (
|
||||
'Test'
|
||||
)}
|
||||
</button>
|
||||
</div>
|
||||
{localAIValid === true && (
|
||||
<div className="flex items-center mt-1 text-green-600 text-sm">
|
||||
<CheckCircleIcon className="h-4 w-4 mr-1" />
|
||||
Connection successful
|
||||
</div>
|
||||
)}
|
||||
{localAIValid === false && (
|
||||
<div className="flex items-center mt-1 text-red-600 text-sm">
|
||||
<ExclamationTriangleIcon className="h-4 w-4 mr-1" />
|
||||
Connection failed
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label className="label">Recommended Models for your system</label>
|
||||
<div className="bg-blue-50 border border-blue-200 rounded-lg p-3">
|
||||
<div className="text-sm text-blue-800">
|
||||
<p className="font-medium mb-2">Based on your system memory ({Math.round(systemInfo?.memory_mb / 1024 || 8)} GB):</p>
|
||||
<div className="flex flex-wrap gap-2">
|
||||
{recommendedModels.map((model, index) => (
|
||||
<span key={index} className="bg-blue-100 text-blue-800 px-2 py-1 rounded text-xs">
|
||||
{model}
|
||||
</span>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
|
||||
{/* OpenAI Configuration */}
|
||||
<div className="bg-white border border-gray-200 rounded-lg p-6">
|
||||
<div className="flex items-center justify-between mb-4">
|
||||
<h3 className="text-lg font-medium text-gray-900 flex items-center">
|
||||
<SparklesIcon className="h-6 w-6 text-bzzz-primary mr-2" />
|
||||
OpenAI API
|
||||
</h3>
|
||||
<div className="flex items-center">
|
||||
<input
|
||||
type="checkbox"
|
||||
id="openaiEnabled"
|
||||
checked={config.openaiEnabled}
|
||||
onChange={(e) => setConfig(prev => ({ ...prev, openaiEnabled: e.target.checked }))}
|
||||
className="h-4 w-4 text-bzzz-primary focus:ring-bzzz-primary border-gray-300 rounded"
|
||||
/>
|
||||
<label htmlFor="openaiEnabled" className="ml-2 text-sm font-medium text-gray-700">
|
||||
Enable OpenAI API
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{config.openaiEnabled && (
|
||||
<div className="space-y-4">
|
||||
<div>
|
||||
<label className="label">API Key</label>
|
||||
<div className="flex space-x-2">
|
||||
<div className="relative flex-1">
|
||||
<input
|
||||
type={showApiKey ? 'text' : 'password'}
|
||||
value={config.openaiApiKey}
|
||||
onChange={(e) => setConfig(prev => ({ ...prev, openaiApiKey: e.target.value }))}
|
||||
placeholder="sk-..."
|
||||
className="input-field pr-10"
|
||||
/>
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => setShowApiKey(!showApiKey)}
|
||||
className="absolute inset-y-0 right-0 pr-3 flex items-center"
|
||||
>
|
||||
{showApiKey ? (
|
||||
<EyeSlashIcon className="h-5 w-5 text-gray-400" />
|
||||
) : (
|
||||
<EyeIcon className="h-5 w-5 text-gray-400" />
|
||||
)}
|
||||
</button>
|
||||
</div>
|
||||
<button
|
||||
type="button"
|
||||
onClick={validateOpenAI}
|
||||
disabled={validatingOpenAI || !config.openaiApiKey}
|
||||
className="btn-outline whitespace-nowrap"
|
||||
>
|
||||
{validatingOpenAI ? (
|
||||
<ArrowPathIcon className="h-4 w-4 animate-spin" />
|
||||
) : (
|
||||
'Validate'
|
||||
)}
|
||||
</button>
|
||||
</div>
|
||||
{openaiValid === true && (
|
||||
<div className="flex items-center mt-1 text-green-600 text-sm">
|
||||
<CheckCircleIcon className="h-4 w-4 mr-1" />
|
||||
API key valid
|
||||
</div>
|
||||
)}
|
||||
{openaiValid === false && (
|
||||
<div className="flex items-center mt-1 text-red-600 text-sm">
|
||||
<ExclamationTriangleIcon className="h-4 w-4 mr-1" />
|
||||
Invalid API key
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label className="label">Organization (Optional)</label>
|
||||
<input
|
||||
type="text"
|
||||
value={config.openaiOrganization}
|
||||
onChange={(e) => setConfig(prev => ({ ...prev, openaiOrganization: e.target.value }))}
|
||||
placeholder="org-..."
|
||||
className="input-field"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label className="label">Default Model</label>
|
||||
<select
|
||||
value={config.openaiDefaultModel}
|
||||
onChange={(e) => setConfig(prev => ({ ...prev, openaiDefaultModel: e.target.value }))}
|
||||
className="input-field"
|
||||
>
|
||||
<option value="gpt-4">GPT-4</option>
|
||||
<option value="gpt-4-turbo">GPT-4 Turbo</option>
|
||||
<option value="gpt-3.5-turbo">GPT-3.5 Turbo</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
|
||||
{/* Cost Management */}
|
||||
{config.openaiEnabled && (
|
||||
<div className="bg-white border border-gray-200 rounded-lg p-6">
|
||||
<h3 className="text-lg font-medium text-gray-900 mb-4 flex items-center">
|
||||
<CurrencyDollarIcon className="h-6 w-6 text-bzzz-primary mr-2" />
|
||||
Cost Management
|
||||
</h3>
|
||||
|
||||
<div className="grid grid-cols-1 md:grid-cols-2 gap-4">
|
||||
<div>
|
||||
<label className="label">Daily Cost Limit ($)</label>
|
||||
<input
|
||||
type="number"
|
||||
value={config.dailyCostLimit}
|
||||
onChange={(e) => setConfig(prev => ({ ...prev, dailyCostLimit: parseFloat(e.target.value) || 0 }))}
|
||||
min="0"
|
||||
step="0.01"
|
||||
className="input-field"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label className="label">Monthly Cost Limit ($)</label>
|
||||
<input
|
||||
type="number"
|
||||
value={config.monthlyCostLimit}
|
||||
onChange={(e) => setConfig(prev => ({ ...prev, monthlyCostLimit: parseFloat(e.target.value) || 0 }))}
|
||||
min="0"
|
||||
step="0.01"
|
||||
className="input-field"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="mt-4">
|
||||
<div className="flex items-center">
|
||||
<input
|
||||
type="checkbox"
|
||||
id="costAlerts"
|
||||
checked={config.costAlerts}
|
||||
onChange={(e) => setConfig(prev => ({ ...prev, costAlerts: e.target.checked }))}
|
||||
className="h-4 w-4 text-bzzz-primary focus:ring-bzzz-primary border-gray-300 rounded"
|
||||
/>
|
||||
<label htmlFor="costAlerts" className="ml-2 text-sm font-medium text-gray-700">
|
||||
Send alerts when approaching cost limits
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* Provider Preference */}
|
||||
<div className="bg-white border border-gray-200 rounded-lg p-6">
|
||||
<h3 className="text-lg font-medium text-gray-900 mb-4">Provider Preference</h3>
|
||||
|
||||
<div className="space-y-3">
|
||||
<div>
|
||||
<label className="label">Preferred AI Provider</label>
|
||||
<select
|
||||
value={config.preferredProvider}
|
||||
onChange={(e) => setConfig(prev => ({ ...prev, preferredProvider: e.target.value as 'openai' | 'local' | 'hybrid' }))}
|
||||
className="input-field"
|
||||
>
|
||||
<option value="local">Local AI Only</option>
|
||||
<option value="openai">OpenAI Only</option>
|
||||
<option value="hybrid">Hybrid (Local first, OpenAI fallback)</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div className="flex items-center">
|
||||
<input
|
||||
type="checkbox"
|
||||
id="fallbackEnabled"
|
||||
checked={config.fallbackEnabled}
|
||||
onChange={(e) => setConfig(prev => ({ ...prev, fallbackEnabled: e.target.checked }))}
|
||||
className="h-4 w-4 text-bzzz-primary focus:ring-bzzz-primary border-gray-300 rounded"
|
||||
/>
|
||||
<label htmlFor="fallbackEnabled" className="ml-2 text-sm font-medium text-gray-700">
|
||||
Enable automatic fallback between providers
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Action Buttons */}
|
||||
<div className="flex justify-between pt-6 border-t border-gray-200">
|
||||
<div>
|
||||
{onBack && (
|
||||
@@ -54,7 +601,12 @@ export default function AIConfiguration({
|
||||
</button>
|
||||
)}
|
||||
</div>
|
||||
<button type="submit" className="btn-primary">
|
||||
|
||||
<button
|
||||
type="submit"
|
||||
className="btn-primary"
|
||||
disabled={!config.openaiEnabled && !config.localAIEnabled}
|
||||
>
|
||||
{isCompleted ? 'Continue' : 'Next: Resource Allocation'}
|
||||
</button>
|
||||
</div>
|
||||
|
||||
@@ -1,6 +1,42 @@
|
||||
'use client'
|
||||
|
||||
import { useState } from 'react'
|
||||
import { useState, useEffect } from 'react'
|
||||
import {
|
||||
ServerStackIcon,
|
||||
PlusIcon,
|
||||
MagnifyingGlassIcon,
|
||||
WifiIcon,
|
||||
ComputerDesktopIcon,
|
||||
ArrowPathIcon,
|
||||
CheckCircleIcon,
|
||||
ExclamationTriangleIcon,
|
||||
InformationCircleIcon,
|
||||
UserGroupIcon,
|
||||
KeyIcon
|
||||
} from '@heroicons/react/24/outline'
|
||||
|
||||
interface DiscoveredNode {
|
||||
id: string
|
||||
hostname: string
|
||||
ip: string
|
||||
port: number
|
||||
version: string
|
||||
capabilities: string[]
|
||||
status: 'online' | 'offline' | 'pending'
|
||||
lastSeen: Date
|
||||
}
|
||||
|
||||
interface ClusterConfig {
|
||||
mode: 'create' | 'join'
|
||||
networkId: string
|
||||
clusterName: string
|
||||
nodeRole: 'coordinator' | 'worker' | 'hybrid'
|
||||
joinKey?: string
|
||||
targetNode?: string
|
||||
autoDiscovery: boolean
|
||||
encryption: boolean
|
||||
redundancy: number
|
||||
}
|
||||
|
||||
interface ClusterFormationProps {
|
||||
systemInfo: any
|
||||
@@ -17,32 +53,480 @@ export default function ClusterFormation({
|
||||
onBack,
|
||||
isCompleted
|
||||
}: ClusterFormationProps) {
|
||||
const [config, setConfig] = useState({
|
||||
clusterMode: 'create',
|
||||
networkId: 'bzzz-cluster-001'
|
||||
const [config, setConfig] = useState<ClusterConfig>({
|
||||
mode: 'create',
|
||||
networkId: '',
|
||||
clusterName: '',
|
||||
nodeRole: 'hybrid',
|
||||
autoDiscovery: true,
|
||||
encryption: true,
|
||||
redundancy: 2
|
||||
})
|
||||
|
||||
const [discoveredNodes, setDiscoveredNodes] = useState<DiscoveredNode[]>([])
|
||||
const [scanning, setScanning] = useState(false)
|
||||
const [generatingKey, setGeneratingKey] = useState(false)
|
||||
const [clusterKey, setClusterKey] = useState('')
|
||||
|
||||
// Initialize configuration
|
||||
useEffect(() => {
|
||||
if (configData.cluster) {
|
||||
setConfig(prev => ({ ...prev, ...configData.cluster }))
|
||||
}
|
||||
|
||||
// Generate default network ID based on hostname
|
||||
if (!config.networkId && systemInfo?.network?.hostname) {
|
||||
const hostname = systemInfo.network.hostname
|
||||
const timestamp = Date.now().toString(36).slice(-4)
|
||||
setConfig(prev => ({
|
||||
...prev,
|
||||
networkId: `bzzz-${hostname}-${timestamp}`,
|
||||
clusterName: `${hostname} BZZZ Cluster`
|
||||
}))
|
||||
}
|
||||
}, [systemInfo, configData])
|
||||
|
||||
// Auto-discover nodes when joining
|
||||
useEffect(() => {
|
||||
if (config.mode === 'join' && config.autoDiscovery) {
|
||||
scanForNodes()
|
||||
}
|
||||
}, [config.mode, config.autoDiscovery])
|
||||
|
||||
const scanForNodes = async () => {
|
||||
setScanning(true)
|
||||
try {
|
||||
// This would be a real mDNS/network scan in production
|
||||
// Simulating discovery for demo
|
||||
await new Promise(resolve => setTimeout(resolve, 2000))
|
||||
|
||||
const mockNodes: DiscoveredNode[] = [
|
||||
{
|
||||
id: 'node-001',
|
||||
hostname: 'ironwood',
|
||||
ip: '192.168.1.72',
|
||||
port: 8080,
|
||||
version: '2.0.0',
|
||||
capabilities: ['coordinator', 'storage', 'compute'],
|
||||
status: 'online',
|
||||
lastSeen: new Date()
|
||||
},
|
||||
{
|
||||
id: 'node-002',
|
||||
hostname: 'walnut',
|
||||
ip: '192.168.1.27',
|
||||
port: 8080,
|
||||
version: '2.0.0',
|
||||
capabilities: ['worker', 'compute'],
|
||||
status: 'online',
|
||||
lastSeen: new Date()
|
||||
}
|
||||
]
|
||||
|
||||
setDiscoveredNodes(mockNodes)
|
||||
} catch (error) {
|
||||
console.error('Node discovery failed:', error)
|
||||
} finally {
|
||||
setScanning(false)
|
||||
}
|
||||
}
|
||||
|
||||
const generateClusterKey = async () => {
|
||||
setGeneratingKey(true)
|
||||
try {
|
||||
// Generate a secure cluster key
|
||||
const key = Array.from(crypto.getRandomValues(new Uint8Array(32)))
|
||||
.map(b => b.toString(16).padStart(2, '0'))
|
||||
.join('')
|
||||
setClusterKey(key)
|
||||
} catch (error) {
|
||||
// Fallback key generation
|
||||
const key = Math.random().toString(36).substr(2, 32)
|
||||
setClusterKey(key)
|
||||
} finally {
|
||||
setGeneratingKey(false)
|
||||
}
|
||||
}
|
||||
|
||||
const getNodeRoleDescription = (role: string) => {
|
||||
switch (role) {
|
||||
case 'coordinator':
|
||||
return 'Manages cluster state and coordinates tasks. Requires stable network connection.'
|
||||
case 'worker':
|
||||
return 'Executes tasks assigned by coordinators. Can be dynamically added/removed.'
|
||||
case 'hybrid':
|
||||
return 'Can act as both coordinator and worker. Recommended for most deployments.'
|
||||
default:
|
||||
return ''
|
||||
}
|
||||
}
|
||||
|
||||
const getSystemRecommendation = () => {
|
||||
const memoryGB = systemInfo?.memory_mb ? Math.round(systemInfo.memory_mb / 1024) : 8
|
||||
const cpuCores = systemInfo?.cpu_cores || 4
|
||||
const hasGPU = systemInfo?.gpus?.length > 0
|
||||
|
||||
if (memoryGB >= 16 && cpuCores >= 8) {
|
||||
return {
|
||||
role: 'coordinator',
|
||||
reason: 'High-performance system suitable for cluster coordination'
|
||||
}
|
||||
} else if (hasGPU) {
|
||||
return {
|
||||
role: 'hybrid',
|
||||
reason: 'GPU acceleration available - good for both coordination and compute tasks'
|
||||
}
|
||||
} else {
|
||||
return {
|
||||
role: 'worker',
|
||||
reason: 'Resource-optimized configuration for task execution'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const handleSubmit = (e: React.FormEvent) => {
|
||||
e.preventDefault()
|
||||
onComplete({ cluster: config })
|
||||
|
||||
const clusterData = {
|
||||
...config,
|
||||
clusterKey: config.mode === 'create' ? clusterKey : undefined,
|
||||
systemInfo: {
|
||||
hostname: systemInfo?.network?.hostname,
|
||||
ip: systemInfo?.network?.private_ips?.[0],
|
||||
capabilities: systemInfo?.gpus?.length > 0 ? ['compute', 'gpu'] : ['compute']
|
||||
}
|
||||
}
|
||||
|
||||
onComplete({ cluster: clusterData })
|
||||
}
|
||||
|
||||
const recommendation = getSystemRecommendation()
|
||||
|
||||
return (
|
||||
<form onSubmit={handleSubmit} className="space-y-6">
|
||||
<div className="text-center py-12">
|
||||
<h3 className="text-lg font-medium text-gray-900 mb-2">
|
||||
Cluster Formation
|
||||
{/* Cluster Mode Selection */}
|
||||
<div className="bg-gray-50 rounded-lg p-6">
|
||||
<h3 className="text-lg font-medium text-gray-900 mb-4 flex items-center">
|
||||
<ServerStackIcon className="h-6 w-6 text-bzzz-primary mr-2" />
|
||||
Cluster Mode
|
||||
</h3>
|
||||
<p className="text-gray-600">
|
||||
Create a new cluster or join an existing BZZZ network.
|
||||
</p>
|
||||
<div className="mt-8">
|
||||
<div className="bg-yellow-50 border border-yellow-200 rounded-lg p-4 text-yellow-800">
|
||||
This component is under development. Cluster formation will be implemented here.
|
||||
|
||||
<div className="grid grid-cols-1 md:grid-cols-2 gap-4">
|
||||
<div
|
||||
className={`border-2 rounded-lg p-4 cursor-pointer transition-all ${
|
||||
config.mode === 'create'
|
||||
? 'border-bzzz-primary bg-bzzz-primary bg-opacity-10'
|
||||
: 'border-gray-200 hover:border-gray-300'
|
||||
}`}
|
||||
onClick={() => setConfig(prev => ({ ...prev, mode: 'create' }))}
|
||||
>
|
||||
<div className="flex items-center mb-2">
|
||||
<PlusIcon className="h-5 w-5 text-bzzz-primary mr-2" />
|
||||
<div className="font-medium text-gray-900">Create New Cluster</div>
|
||||
</div>
|
||||
<div className="text-sm text-gray-600">
|
||||
Start a new BZZZ cluster and become the initial coordinator node.
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div
|
||||
className={`border-2 rounded-lg p-4 cursor-pointer transition-all ${
|
||||
config.mode === 'join'
|
||||
? 'border-bzzz-primary bg-bzzz-primary bg-opacity-10'
|
||||
: 'border-gray-200 hover:border-gray-300'
|
||||
}`}
|
||||
onClick={() => setConfig(prev => ({ ...prev, mode: 'join' }))}
|
||||
>
|
||||
<div className="flex items-center mb-2">
|
||||
<UserGroupIcon className="h-5 w-5 text-bzzz-primary mr-2" />
|
||||
<div className="font-medium text-gray-900">Join Existing Cluster</div>
|
||||
</div>
|
||||
<div className="text-sm text-gray-600">
|
||||
Connect to an existing BZZZ cluster as a worker or coordinator node.
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Create Cluster Configuration */}
|
||||
{config.mode === 'create' && (
|
||||
<div className="space-y-6">
|
||||
<div className="bg-white border border-gray-200 rounded-lg p-6">
|
||||
<h3 className="text-lg font-medium text-gray-900 mb-4">New Cluster Configuration</h3>
|
||||
|
||||
<div className="space-y-4">
|
||||
<div>
|
||||
<label className="label">Cluster Name</label>
|
||||
<input
|
||||
type="text"
|
||||
value={config.clusterName}
|
||||
onChange={(e) => setConfig(prev => ({ ...prev, clusterName: e.target.value }))}
|
||||
placeholder="My BZZZ Cluster"
|
||||
className="input-field"
|
||||
required
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label className="label">Network ID</label>
|
||||
<input
|
||||
type="text"
|
||||
value={config.networkId}
|
||||
onChange={(e) => setConfig(prev => ({ ...prev, networkId: e.target.value }))}
|
||||
placeholder="bzzz-cluster-001"
|
||||
className="input-field"
|
||||
required
|
||||
/>
|
||||
<p className="text-sm text-gray-600 mt-1">
|
||||
Unique identifier for your cluster network
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label className="label">Cluster Security Key</label>
|
||||
<div className="flex space-x-2">
|
||||
<input
|
||||
type="text"
|
||||
value={clusterKey}
|
||||
onChange={(e) => setClusterKey(e.target.value)}
|
||||
placeholder="Click generate or enter custom key"
|
||||
className="input-field flex-1"
|
||||
readOnly={!clusterKey}
|
||||
/>
|
||||
<button
|
||||
type="button"
|
||||
onClick={generateClusterKey}
|
||||
disabled={generatingKey}
|
||||
className="btn-outline whitespace-nowrap"
|
||||
>
|
||||
{generatingKey ? (
|
||||
<ArrowPathIcon className="h-4 w-4 animate-spin" />
|
||||
) : (
|
||||
<>
|
||||
<KeyIcon className="h-4 w-4 mr-1" />
|
||||
Generate
|
||||
</>
|
||||
)}
|
||||
</button>
|
||||
</div>
|
||||
<p className="text-sm text-gray-600 mt-1">
|
||||
This key will be required for other nodes to join your cluster
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* Join Cluster Configuration */}
|
||||
{config.mode === 'join' && (
|
||||
<div className="space-y-6">
|
||||
<div className="bg-white border border-gray-200 rounded-lg p-6">
|
||||
<div className="flex items-center justify-between mb-4">
|
||||
<h3 className="text-lg font-medium text-gray-900">Available Clusters</h3>
|
||||
<button
|
||||
type="button"
|
||||
onClick={scanForNodes}
|
||||
disabled={scanning}
|
||||
className="btn-outline text-sm"
|
||||
>
|
||||
{scanning ? (
|
||||
<>
|
||||
<ArrowPathIcon className="h-4 w-4 animate-spin mr-1" />
|
||||
Scanning...
|
||||
</>
|
||||
) : (
|
||||
<>
|
||||
<MagnifyingGlassIcon className="h-4 w-4 mr-1" />
|
||||
Scan Network
|
||||
</>
|
||||
)}
|
||||
</button>
|
||||
</div>
|
||||
|
||||
{discoveredNodes.length > 0 ? (
|
||||
<div className="space-y-3">
|
||||
{discoveredNodes.map((node) => (
|
||||
<div
|
||||
key={node.id}
|
||||
className={`border rounded-lg p-4 cursor-pointer transition-all ${
|
||||
config.targetNode === node.id
|
||||
? 'border-bzzz-primary bg-bzzz-primary bg-opacity-10'
|
||||
: 'border-gray-200 hover:border-gray-300'
|
||||
}`}
|
||||
onClick={() => setConfig(prev => ({ ...prev, targetNode: node.id }))}
|
||||
>
|
||||
<div className="flex items-center justify-between">
|
||||
<div>
|
||||
<div className="flex items-center">
|
||||
<ComputerDesktopIcon className="h-5 w-5 text-gray-500 mr-2" />
|
||||
<span className="font-medium text-gray-900">{node.hostname}</span>
|
||||
<span className={`ml-2 status-indicator ${
|
||||
node.status === 'online' ? 'status-online' : 'status-offline'
|
||||
}`}>
|
||||
{node.status}
|
||||
</span>
|
||||
</div>
|
||||
<div className="text-sm text-gray-600 mt-1">
|
||||
{node.ip}:{node.port} • Version {node.version}
|
||||
</div>
|
||||
<div className="flex flex-wrap gap-1 mt-1">
|
||||
{node.capabilities.map((cap, index) => (
|
||||
<span key={index} className="bg-gray-100 text-gray-700 px-2 py-1 rounded text-xs">
|
||||
{cap}
|
||||
</span>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
<WifiIcon className="h-5 w-5 text-bzzz-primary" />
|
||||
</div>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
) : (
|
||||
<div className="text-center py-8">
|
||||
<MagnifyingGlassIcon className="h-12 w-12 text-gray-400 mx-auto mb-4" />
|
||||
<p className="text-gray-600">
|
||||
{scanning ? 'Scanning for BZZZ clusters...' : 'No clusters found. Click scan to search for available clusters.'}
|
||||
</p>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{config.targetNode && (
|
||||
<div className="mt-4 pt-4 border-t border-gray-200">
|
||||
<label className="label">Cluster Join Key</label>
|
||||
<input
|
||||
type="password"
|
||||
value={config.joinKey || ''}
|
||||
onChange={(e) => setConfig(prev => ({ ...prev, joinKey: e.target.value }))}
|
||||
placeholder="Enter cluster security key"
|
||||
className="input-field"
|
||||
required
|
||||
/>
|
||||
<p className="text-sm text-gray-600 mt-1">
|
||||
Enter the security key provided by the cluster administrator
|
||||
</p>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* Node Role Configuration */}
|
||||
<div className="bg-white border border-gray-200 rounded-lg p-6">
|
||||
<h3 className="text-lg font-medium text-gray-900 mb-4">Node Role</h3>
|
||||
|
||||
{/* System Recommendation */}
|
||||
<div className="mb-4 p-4 bg-blue-50 border border-blue-200 rounded-lg">
|
||||
<div className="flex items-start">
|
||||
<InformationCircleIcon className="h-5 w-5 text-blue-600 mr-2 mt-0.5" />
|
||||
<div>
|
||||
<div className="font-medium text-blue-800">
|
||||
Recommended: {recommendation.role.charAt(0).toUpperCase() + recommendation.role.slice(1)}
|
||||
</div>
|
||||
<div className="text-sm text-blue-700 mt-1">
|
||||
{recommendation.reason}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="space-y-3">
|
||||
{['coordinator', 'worker', 'hybrid'].map((role) => (
|
||||
<div
|
||||
key={role}
|
||||
className={`border-2 rounded-lg p-4 cursor-pointer transition-all ${
|
||||
config.nodeRole === role
|
||||
? 'border-bzzz-primary bg-bzzz-primary bg-opacity-10'
|
||||
: 'border-gray-200 hover:border-gray-300'
|
||||
}`}
|
||||
onClick={() => setConfig(prev => ({ ...prev, nodeRole: role as any }))}
|
||||
>
|
||||
<div className="flex items-center">
|
||||
<input
|
||||
type="radio"
|
||||
name="nodeRole"
|
||||
value={role}
|
||||
checked={config.nodeRole === role}
|
||||
onChange={() => setConfig(prev => ({ ...prev, nodeRole: role as any }))}
|
||||
className="h-4 w-4 text-bzzz-primary focus:ring-bzzz-primary border-gray-300"
|
||||
/>
|
||||
<div className="ml-3">
|
||||
<div className="font-medium text-gray-900 capitalize">{role}</div>
|
||||
<div className="text-sm text-gray-600">{getNodeRoleDescription(role)}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Advanced Options */}
|
||||
<div className="bg-white border border-gray-200 rounded-lg p-6">
|
||||
<h3 className="text-lg font-medium text-gray-900 mb-4">Advanced Options</h3>
|
||||
|
||||
<div className="space-y-4">
|
||||
<div className="flex items-center">
|
||||
<input
|
||||
type="checkbox"
|
||||
id="autoDiscovery"
|
||||
checked={config.autoDiscovery}
|
||||
onChange={(e) => setConfig(prev => ({ ...prev, autoDiscovery: e.target.checked }))}
|
||||
className="h-4 w-4 text-bzzz-primary focus:ring-bzzz-primary border-gray-300 rounded"
|
||||
/>
|
||||
<label htmlFor="autoDiscovery" className="ml-2 text-sm font-medium text-gray-700">
|
||||
Enable automatic node discovery (mDNS)
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<div className="flex items-center">
|
||||
<input
|
||||
type="checkbox"
|
||||
id="encryption"
|
||||
checked={config.encryption}
|
||||
onChange={(e) => setConfig(prev => ({ ...prev, encryption: e.target.checked }))}
|
||||
className="h-4 w-4 text-bzzz-primary focus:ring-bzzz-primary border-gray-300 rounded"
|
||||
/>
|
||||
<label htmlFor="encryption" className="ml-2 text-sm font-medium text-gray-700">
|
||||
Enable end-to-end encryption for cluster communication
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label className="label">Redundancy Level</label>
|
||||
<select
|
||||
value={config.redundancy}
|
||||
onChange={(e) => setConfig(prev => ({ ...prev, redundancy: parseInt(e.target.value) }))}
|
||||
className="input-field"
|
||||
>
|
||||
<option value={1}>Low (1 replica)</option>
|
||||
<option value={2}>Medium (2 replicas)</option>
|
||||
<option value={3}>High (3 replicas)</option>
|
||||
</select>
|
||||
<p className="text-sm text-gray-600 mt-1">
|
||||
Number of replicas for critical cluster data
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Configuration Summary */}
|
||||
<div className="bg-blue-50 border border-blue-200 rounded-lg p-4">
|
||||
<div className="flex items-center mb-2">
|
||||
<CheckCircleIcon className="h-5 w-5 text-blue-600 mr-2" />
|
||||
<span className="text-blue-800 font-medium">Configuration Summary</span>
|
||||
</div>
|
||||
<div className="text-blue-700 text-sm space-y-1">
|
||||
<p>• Mode: {config.mode === 'create' ? 'Create new cluster' : 'Join existing cluster'}</p>
|
||||
<p>• Role: {config.nodeRole}</p>
|
||||
<p>• Hostname: {systemInfo?.network?.hostname || 'Unknown'}</p>
|
||||
<p>• IP Address: {systemInfo?.network?.private_ips?.[0] || 'Unknown'}</p>
|
||||
{config.mode === 'create' && <p>• Cluster: {config.clusterName}</p>}
|
||||
{config.encryption && <p>• Security: Encrypted communication enabled</p>}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Action Buttons */}
|
||||
<div className="flex justify-between pt-6 border-t border-gray-200">
|
||||
<div>
|
||||
{onBack && (
|
||||
@@ -51,7 +535,15 @@ export default function ClusterFormation({
|
||||
</button>
|
||||
)}
|
||||
</div>
|
||||
<button type="submit" className="btn-primary">
|
||||
|
||||
<button
|
||||
type="submit"
|
||||
disabled={
|
||||
(config.mode === 'create' && (!config.clusterName || !config.networkId || !clusterKey)) ||
|
||||
(config.mode === 'join' && (!config.targetNode || !config.joinKey))
|
||||
}
|
||||
className="btn-primary"
|
||||
>
|
||||
{isCompleted ? 'Continue' : 'Next: Testing & Validation'}
|
||||
</button>
|
||||
</div>
|
||||
|
||||
301
install/config-ui/app/setup/components/LicenseValidation.tsx
Normal file
301
install/config-ui/app/setup/components/LicenseValidation.tsx
Normal file
@@ -0,0 +1,301 @@
|
||||
'use client'
|
||||
|
||||
import { useState } from 'react'
|
||||
import {
|
||||
KeyIcon,
|
||||
CheckCircleIcon,
|
||||
ExclamationTriangleIcon,
|
||||
UserIcon,
|
||||
DocumentTextIcon
|
||||
} from '@heroicons/react/24/outline'
|
||||
|
||||
interface LicenseValidationProps {
|
||||
systemInfo: any
|
||||
configData: any
|
||||
onComplete: (data: any) => void
|
||||
onBack?: () => void
|
||||
isCompleted: boolean
|
||||
}
|
||||
|
||||
interface LicenseData {
|
||||
email: string
|
||||
licenseKey: string
|
||||
organizationName?: string
|
||||
acceptedAt?: string
|
||||
}
|
||||
|
||||
export default function LicenseValidation({
|
||||
systemInfo,
|
||||
configData,
|
||||
onComplete,
|
||||
onBack,
|
||||
isCompleted
|
||||
}: LicenseValidationProps) {
|
||||
const [licenseData, setLicenseData] = useState<LicenseData>({
|
||||
email: configData?.license?.email || '',
|
||||
licenseKey: configData?.license?.licenseKey || '',
|
||||
organizationName: configData?.license?.organizationName || ''
|
||||
})
|
||||
|
||||
const [validating, setValidating] = useState(false)
|
||||
const [validationResult, setValidationResult] = useState<{
|
||||
valid: boolean
|
||||
message: string
|
||||
details?: any
|
||||
} | null>(null)
|
||||
const [error, setError] = useState('')
|
||||
|
||||
// Email validation function
|
||||
const isValidEmail = (email: string): boolean => {
|
||||
const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/
|
||||
return emailRegex.test(email)
|
||||
}
|
||||
|
||||
// Check if form is ready for validation
|
||||
const canValidate = licenseData.email &&
|
||||
isValidEmail(licenseData.email) &&
|
||||
licenseData.licenseKey
|
||||
|
||||
const validateLicense = async () => {
|
||||
if (!licenseData.email || !licenseData.licenseKey) {
|
||||
setError('Both email and license key are required')
|
||||
return
|
||||
}
|
||||
|
||||
if (!isValidEmail(licenseData.email)) {
|
||||
setError('Please enter a valid email address')
|
||||
return
|
||||
}
|
||||
|
||||
setValidating(true)
|
||||
setError('')
|
||||
setValidationResult(null)
|
||||
|
||||
try {
|
||||
const response = await fetch('/api/setup/license/validate', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
body: JSON.stringify({
|
||||
email: licenseData.email,
|
||||
licenseKey: licenseData.licenseKey,
|
||||
organizationName: licenseData.organizationName
|
||||
}),
|
||||
})
|
||||
|
||||
const result = await response.json()
|
||||
|
||||
if (response.ok && result.valid) {
|
||||
setValidationResult({
|
||||
valid: true,
|
||||
message: result.message || 'License validated successfully',
|
||||
details: result.details
|
||||
})
|
||||
} else {
|
||||
setValidationResult({
|
||||
valid: false,
|
||||
message: result.message || 'License validation failed',
|
||||
details: result.details
|
||||
})
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('License validation error:', error)
|
||||
setValidationResult({
|
||||
valid: false,
|
||||
message: 'Failed to validate license. Please check your connection and try again.'
|
||||
})
|
||||
} finally {
|
||||
setValidating(false)
|
||||
}
|
||||
}
|
||||
|
||||
const handleSubmit = (e: React.FormEvent) => {
|
||||
e.preventDefault()
|
||||
|
||||
if (!licenseData.email || !licenseData.licenseKey) {
|
||||
setError('Both email and license key are required')
|
||||
return
|
||||
}
|
||||
|
||||
if (!validationResult?.valid) {
|
||||
setError('Please validate your license before continuing')
|
||||
return
|
||||
}
|
||||
|
||||
setError('')
|
||||
onComplete({
|
||||
license: {
|
||||
...licenseData,
|
||||
validatedAt: new Date().toISOString(),
|
||||
validationDetails: validationResult.details
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
return (
|
||||
<form onSubmit={handleSubmit} className="space-y-8">
|
||||
|
||||
{/* License Information */}
|
||||
<div className="card">
|
||||
<div className="flex items-center mb-4">
|
||||
<KeyIcon className="h-6 w-6 text-bzzz-primary mr-2" />
|
||||
<h3 className="text-lg font-medium text-gray-900">License Information</h3>
|
||||
{validationResult?.valid && <CheckCircleIcon className="h-5 w-5 text-green-500 ml-2" />}
|
||||
</div>
|
||||
|
||||
<div className="space-y-4">
|
||||
<div>
|
||||
<label className="block text-sm font-medium text-gray-700 mb-2">
|
||||
Email Address
|
||||
</label>
|
||||
<div className="relative">
|
||||
<UserIcon className="h-5 w-5 text-gray-400 absolute left-3 top-1/2 transform -translate-y-1/2" />
|
||||
<input
|
||||
type="email"
|
||||
value={licenseData.email}
|
||||
onChange={(e) => setLicenseData(prev => ({ ...prev, email: e.target.value }))}
|
||||
placeholder="your-email@company.com"
|
||||
className={`w-full pl-10 pr-4 py-3 border rounded-lg focus:ring-bzzz-primary focus:border-bzzz-primary ${
|
||||
licenseData.email && !isValidEmail(licenseData.email)
|
||||
? 'border-red-300 bg-red-50'
|
||||
: 'border-gray-300'
|
||||
}`}
|
||||
required
|
||||
/>
|
||||
</div>
|
||||
{licenseData.email && !isValidEmail(licenseData.email) ? (
|
||||
<p className="text-sm text-red-600 mt-1">Please enter a valid email address</p>
|
||||
) : (
|
||||
<p className="text-sm text-gray-500 mt-1">
|
||||
The email address associated with your CHORUS:agents license
|
||||
</p>
|
||||
)}
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label className="block text-sm font-medium text-gray-700 mb-2">
|
||||
License Key
|
||||
</label>
|
||||
<div className="relative">
|
||||
<KeyIcon className="h-5 w-5 text-gray-400 absolute left-3 top-1/2 transform -translate-y-1/2" />
|
||||
<input
|
||||
type="text"
|
||||
value={licenseData.licenseKey}
|
||||
onChange={(e) => setLicenseData(prev => ({ ...prev, licenseKey: e.target.value }))}
|
||||
placeholder="BZZZ-XXXX-XXXX-XXXX-XXXX"
|
||||
className="w-full pl-10 pr-4 py-3 border border-gray-300 rounded-lg focus:ring-bzzz-primary focus:border-bzzz-primary font-mono"
|
||||
required
|
||||
/>
|
||||
</div>
|
||||
<p className="text-sm text-gray-500 mt-1">
|
||||
Your unique CHORUS:agents license key (found in your purchase confirmation email)
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label className="block text-sm font-medium text-gray-700 mb-2">
|
||||
Organization Name (Optional)
|
||||
</label>
|
||||
<input
|
||||
type="text"
|
||||
value={licenseData.organizationName}
|
||||
onChange={(e) => setLicenseData(prev => ({ ...prev, organizationName: e.target.value }))}
|
||||
placeholder="Your Company Name"
|
||||
className="w-full px-4 py-3 border border-gray-300 rounded-lg focus:ring-bzzz-primary focus:border-bzzz-primary"
|
||||
/>
|
||||
<p className="text-sm text-gray-500 mt-1">
|
||||
Optional: Organization name for license tracking
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<button
|
||||
type="button"
|
||||
onClick={validateLicense}
|
||||
disabled={validating || !canValidate}
|
||||
className={`w-full py-3 px-4 rounded-lg font-medium transition-colors ${
|
||||
validating || !canValidate
|
||||
? 'bg-gray-100 text-gray-400 cursor-not-allowed'
|
||||
: 'bg-bzzz-primary text-white hover:bg-bzzz-primary-dark'
|
||||
}`}
|
||||
>
|
||||
{validating ? 'Validating License...' : 'Validate License'}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Validation Result */}
|
||||
{validationResult && (
|
||||
<div className={`card ${validationResult.valid ? 'border-green-200 bg-green-50' : 'border-red-200 bg-red-50'}`}>
|
||||
<div className="flex items-start">
|
||||
<div className="flex-shrink-0">
|
||||
{validationResult.valid ? (
|
||||
<CheckCircleIcon className="h-6 w-6 text-green-500" />
|
||||
) : (
|
||||
<ExclamationTriangleIcon className="h-6 w-6 text-red-500" />
|
||||
)}
|
||||
</div>
|
||||
<div className="ml-3">
|
||||
<h4 className={`text-sm font-medium ${validationResult.valid ? 'text-green-800' : 'text-red-800'}`}>
|
||||
{validationResult.valid ? 'License Valid' : 'License Invalid'}
|
||||
</h4>
|
||||
<p className={`text-sm mt-1 ${validationResult.valid ? 'text-green-700' : 'text-red-700'}`}>
|
||||
{validationResult.message}
|
||||
</p>
|
||||
|
||||
{validationResult.valid && validationResult.details && (
|
||||
<div className="mt-3 text-sm text-green-700">
|
||||
<p><strong>License Type:</strong> {validationResult.details.licenseType || 'Standard'}</p>
|
||||
<p><strong>Max Nodes:</strong> {validationResult.details.maxNodes || 'Unlimited'}</p>
|
||||
<p><strong>Expires:</strong> {validationResult.details.expiresAt || 'Never'}</p>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{error && (
|
||||
<div className="flex items-center text-red-600 text-sm">
|
||||
<ExclamationTriangleIcon className="h-4 w-4 mr-1" />
|
||||
{error}
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* License Information */}
|
||||
<div className="bg-blue-50 border border-blue-200 rounded-lg p-4">
|
||||
<div className="flex items-start">
|
||||
<DocumentTextIcon className="h-5 w-5 text-blue-500 mt-0.5 mr-2" />
|
||||
<div className="text-sm">
|
||||
<h4 className="font-medium text-blue-800 mb-1">Need a License?</h4>
|
||||
<p className="text-blue-700">
|
||||
If you don't have a CHORUS:agents license yet, you can:
|
||||
</p>
|
||||
<ul className="text-blue-700 mt-1 space-y-1 ml-4">
|
||||
<li>• Visit <a href="https://chorus.services/bzzz" target="_blank" className="underline hover:no-underline">chorus.services/bzzz</a> to purchase a license</li>
|
||||
<li>• Contact our sales team at <a href="mailto:sales@chorus.services" className="underline hover:no-underline">sales@chorus.services</a></li>
|
||||
<li>• Request a trial license for evaluation purposes</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="flex justify-between pt-6 border-t border-gray-200">
|
||||
<div>
|
||||
{onBack && (
|
||||
<button type="button" onClick={onBack} className="btn-outline">
|
||||
Back
|
||||
</button>
|
||||
)}
|
||||
</div>
|
||||
<button
|
||||
type="submit"
|
||||
disabled={!validationResult?.valid}
|
||||
className={`${validationResult?.valid ? 'btn-primary' : 'btn-disabled'}`}
|
||||
>
|
||||
{isCompleted ? 'Continue' : 'Next: System Detection'}
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
)
|
||||
}
|
||||
@@ -1,6 +1,33 @@
|
||||
'use client'
|
||||
|
||||
import { useState } from 'react'
|
||||
import { useState, useEffect } from 'react'
|
||||
import {
|
||||
GlobeAltIcon,
|
||||
ServerIcon,
|
||||
ShieldCheckIcon,
|
||||
ExclamationTriangleIcon,
|
||||
CheckCircleIcon,
|
||||
InformationCircleIcon
|
||||
} from '@heroicons/react/24/outline'
|
||||
|
||||
interface NetworkInterface {
|
||||
name: string
|
||||
ip: string
|
||||
status: string
|
||||
speed?: string
|
||||
}
|
||||
|
||||
interface NetworkConfig {
|
||||
primaryInterface: string
|
||||
primaryIP: string
|
||||
bzzzPort: number
|
||||
mcpPort: number
|
||||
webUIPort: number
|
||||
p2pPort: number
|
||||
autoFirewall: boolean
|
||||
allowedIPs: string[]
|
||||
dnsServers: string[]
|
||||
}
|
||||
|
||||
interface NetworkConfigurationProps {
|
||||
systemInfo: any
|
||||
@@ -17,36 +44,354 @@ export default function NetworkConfiguration({
|
||||
onBack,
|
||||
isCompleted
|
||||
}: NetworkConfigurationProps) {
|
||||
const [config, setConfig] = useState({
|
||||
subnet: '192.168.1.0/24',
|
||||
primaryInterface: 'eth0',
|
||||
const [config, setConfig] = useState<NetworkConfig>({
|
||||
primaryInterface: '',
|
||||
primaryIP: '',
|
||||
bzzzPort: 8080,
|
||||
mcpPort: 3000,
|
||||
webUIPort: 8080,
|
||||
autoFirewall: true
|
||||
p2pPort: 7000,
|
||||
autoFirewall: true,
|
||||
allowedIPs: ['192.168.0.0/16', '10.0.0.0/8', '172.16.0.0/12'],
|
||||
dnsServers: ['8.8.8.8', '8.8.4.4']
|
||||
})
|
||||
|
||||
const [errors, setErrors] = useState<string[]>([])
|
||||
const [portConflicts, setPortConflicts] = useState<string[]>([])
|
||||
|
||||
// Initialize with system info and existing config
|
||||
useEffect(() => {
|
||||
if (systemInfo?.network) {
|
||||
setConfig(prev => ({
|
||||
...prev,
|
||||
primaryInterface: systemInfo.network.interfaces?.[0] || prev.primaryInterface,
|
||||
primaryIP: systemInfo.network.private_ips?.[0] || prev.primaryIP
|
||||
}))
|
||||
}
|
||||
|
||||
if (configData.network) {
|
||||
setConfig(prev => ({ ...prev, ...configData.network }))
|
||||
}
|
||||
}, [systemInfo, configData])
|
||||
|
||||
// Validate configuration
|
||||
useEffect(() => {
|
||||
validateConfiguration()
|
||||
}, [config])
|
||||
|
||||
const validateConfiguration = () => {
|
||||
const newErrors: string[] = []
|
||||
const conflicts: string[] = []
|
||||
|
||||
// Check for port conflicts
|
||||
const ports = [config.bzzzPort, config.mcpPort, config.webUIPort, config.p2pPort]
|
||||
const uniquePorts = new Set(ports)
|
||||
if (uniquePorts.size !== ports.length) {
|
||||
conflicts.push('Port numbers must be unique')
|
||||
}
|
||||
|
||||
// Check port ranges
|
||||
ports.forEach((port, index) => {
|
||||
const portNames = ['BZZZ API', 'MCP Server', 'Web UI', 'P2P Network']
|
||||
if (port < 1024) {
|
||||
newErrors.push(`${portNames[index]} port should be above 1024 to avoid requiring root privileges`)
|
||||
}
|
||||
if (port > 65535) {
|
||||
newErrors.push(`${portNames[index]} port must be below 65536`)
|
||||
}
|
||||
})
|
||||
|
||||
// Validate IP addresses in allowed IPs
|
||||
config.allowedIPs.forEach(ip => {
|
||||
if (ip && !isValidCIDR(ip)) {
|
||||
newErrors.push(`Invalid CIDR notation: ${ip}`)
|
||||
}
|
||||
})
|
||||
|
||||
// Validate DNS servers
|
||||
config.dnsServers.forEach(dns => {
|
||||
if (dns && !isValidIPAddress(dns)) {
|
||||
newErrors.push(`Invalid DNS server IP: ${dns}`)
|
||||
}
|
||||
})
|
||||
|
||||
setErrors(newErrors)
|
||||
setPortConflicts(conflicts)
|
||||
}
|
||||
|
||||
const isValidCIDR = (cidr: string): boolean => {
|
||||
const regex = /^(\d{1,3}\.){3}\d{1,3}\/\d{1,2}$/
|
||||
return regex.test(cidr)
|
||||
}
|
||||
|
||||
const isValidIPAddress = (ip: string): boolean => {
|
||||
const regex = /^(\d{1,3}\.){3}\d{1,3}$/
|
||||
if (!regex.test(ip)) return false
|
||||
return ip.split('.').every(part => parseInt(part) >= 0 && parseInt(part) <= 255)
|
||||
}
|
||||
|
||||
const handlePortChange = (field: keyof NetworkConfig, value: string) => {
|
||||
const numValue = parseInt(value) || 0
|
||||
setConfig(prev => ({ ...prev, [field]: numValue }))
|
||||
}
|
||||
|
||||
const handleArrayChange = (field: 'allowedIPs' | 'dnsServers', index: number, value: string) => {
|
||||
setConfig(prev => ({
|
||||
...prev,
|
||||
[field]: prev[field].map((item, i) => i === index ? value : item)
|
||||
}))
|
||||
}
|
||||
|
||||
const addArrayItem = (field: 'allowedIPs' | 'dnsServers') => {
|
||||
setConfig(prev => ({
|
||||
...prev,
|
||||
[field]: [...prev[field], '']
|
||||
}))
|
||||
}
|
||||
|
||||
const removeArrayItem = (field: 'allowedIPs' | 'dnsServers', index: number) => {
|
||||
setConfig(prev => ({
|
||||
...prev,
|
||||
[field]: prev[field].filter((_, i) => i !== index)
|
||||
}))
|
||||
}
|
||||
|
||||
const handleSubmit = (e: React.FormEvent) => {
|
||||
e.preventDefault()
|
||||
onComplete({ network: config })
|
||||
|
||||
if (errors.length === 0 && portConflicts.length === 0) {
|
||||
onComplete({ network: config })
|
||||
}
|
||||
}
|
||||
|
||||
const isFormValid = errors.length === 0 && portConflicts.length === 0
|
||||
|
||||
return (
|
||||
<form onSubmit={handleSubmit} className="space-y-6">
|
||||
<div className="text-center py-12">
|
||||
<h3 className="text-lg font-medium text-gray-900 mb-2">
|
||||
Network Configuration
|
||||
{/* Network Interface Selection */}
|
||||
<div className="bg-gray-50 rounded-lg p-6">
|
||||
<h3 className="text-lg font-medium text-gray-900 mb-4 flex items-center">
|
||||
<GlobeAltIcon className="h-6 w-6 text-bzzz-primary mr-2" />
|
||||
Network Interface
|
||||
</h3>
|
||||
<p className="text-gray-600">
|
||||
Configure your cluster's network settings and firewall rules.
|
||||
</p>
|
||||
<div className="mt-8">
|
||||
<div className="bg-yellow-50 border border-yellow-200 rounded-lg p-4 text-yellow-800">
|
||||
This component is under development. Network configuration will be implemented here.
|
||||
|
||||
{systemInfo?.network?.interfaces && (
|
||||
<div className="space-y-3">
|
||||
<label className="label">Primary Network Interface</label>
|
||||
<select
|
||||
value={config.primaryInterface}
|
||||
onChange={(e) => setConfig(prev => ({ ...prev, primaryInterface: e.target.value }))}
|
||||
className="input-field"
|
||||
>
|
||||
<option value="">Select network interface</option>
|
||||
{systemInfo.network.interfaces.map((interfaceName: string, index: number) => (
|
||||
<option key={index} value={interfaceName}>
|
||||
{interfaceName} - {systemInfo.network.private_ips[index] || 'Unknown IP'}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
|
||||
{config.primaryInterface && (
|
||||
<div className="text-sm text-gray-600">
|
||||
Primary IP: {systemInfo.network.private_ips?.[systemInfo.network.interfaces.indexOf(config.primaryInterface)] || 'Unknown'}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
|
||||
{/* Port Configuration */}
|
||||
<div className="bg-white border border-gray-200 rounded-lg p-6">
|
||||
<h3 className="text-lg font-medium text-gray-900 mb-4 flex items-center">
|
||||
<ServerIcon className="h-6 w-6 text-bzzz-primary mr-2" />
|
||||
Port Configuration
|
||||
</h3>
|
||||
|
||||
<div className="grid grid-cols-1 md:grid-cols-2 gap-4">
|
||||
<div>
|
||||
<label className="label">BZZZ API Port</label>
|
||||
<input
|
||||
type="number"
|
||||
value={config.bzzzPort}
|
||||
onChange={(e) => handlePortChange('bzzzPort', e.target.value)}
|
||||
min="1024"
|
||||
max="65535"
|
||||
className="input-field"
|
||||
/>
|
||||
<p className="text-sm text-gray-600 mt-1">Main BZZZ HTTP API endpoint</p>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label className="label">MCP Server Port</label>
|
||||
<input
|
||||
type="number"
|
||||
value={config.mcpPort}
|
||||
onChange={(e) => handlePortChange('mcpPort', e.target.value)}
|
||||
min="1024"
|
||||
max="65535"
|
||||
className="input-field"
|
||||
/>
|
||||
<p className="text-sm text-gray-600 mt-1">Model Context Protocol server</p>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label className="label">Web UI Port</label>
|
||||
<input
|
||||
type="number"
|
||||
value={config.webUIPort}
|
||||
onChange={(e) => handlePortChange('webUIPort', e.target.value)}
|
||||
min="1024"
|
||||
max="65535"
|
||||
className="input-field"
|
||||
/>
|
||||
<p className="text-sm text-gray-600 mt-1">Web interface port</p>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label className="label">P2P Network Port</label>
|
||||
<input
|
||||
type="number"
|
||||
value={config.p2pPort}
|
||||
onChange={(e) => handlePortChange('p2pPort', e.target.value)}
|
||||
min="1024"
|
||||
max="65535"
|
||||
className="input-field"
|
||||
/>
|
||||
<p className="text-sm text-gray-600 mt-1">Peer-to-peer communication</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{portConflicts.length > 0 && (
|
||||
<div className="mt-4 p-3 bg-red-50 border border-red-200 rounded-lg">
|
||||
<div className="flex items-center">
|
||||
<ExclamationTriangleIcon className="h-5 w-5 text-red-600 mr-2" />
|
||||
<span className="text-red-800 font-medium">Port Conflicts</span>
|
||||
</div>
|
||||
{portConflicts.map((conflict, index) => (
|
||||
<p key={index} className="text-red-700 text-sm mt-1">{conflict}</p>
|
||||
))}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
|
||||
{/* Security & Access Control */}
|
||||
<div className="bg-white border border-gray-200 rounded-lg p-6">
|
||||
<h3 className="text-lg font-medium text-gray-900 mb-4 flex items-center">
|
||||
<ShieldCheckIcon className="h-6 w-6 text-bzzz-primary mr-2" />
|
||||
Security & Access Control
|
||||
</h3>
|
||||
|
||||
<div className="space-y-4">
|
||||
<div className="flex items-center">
|
||||
<input
|
||||
type="checkbox"
|
||||
id="autoFirewall"
|
||||
checked={config.autoFirewall}
|
||||
onChange={(e) => setConfig(prev => ({ ...prev, autoFirewall: e.target.checked }))}
|
||||
className="h-4 w-4 text-bzzz-primary focus:ring-bzzz-primary border-gray-300 rounded"
|
||||
/>
|
||||
<label htmlFor="autoFirewall" className="ml-2 text-sm font-medium text-gray-700">
|
||||
Automatically configure firewall rules
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label className="label">Allowed IP Ranges (CIDR)</label>
|
||||
{config.allowedIPs.map((ip, index) => (
|
||||
<div key={index} className="flex items-center space-x-2 mb-2">
|
||||
<input
|
||||
type="text"
|
||||
value={ip}
|
||||
onChange={(e) => handleArrayChange('allowedIPs', index, e.target.value)}
|
||||
placeholder="192.168.1.0/24"
|
||||
className="input-field flex-1"
|
||||
/>
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => removeArrayItem('allowedIPs', index)}
|
||||
className="text-red-600 hover:text-red-800"
|
||||
>
|
||||
Remove
|
||||
</button>
|
||||
</div>
|
||||
))}
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => addArrayItem('allowedIPs')}
|
||||
className="text-bzzz-primary hover:text-bzzz-primary/80 text-sm"
|
||||
>
|
||||
+ Add IP Range
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* DNS Configuration */}
|
||||
<div className="bg-white border border-gray-200 rounded-lg p-6">
|
||||
<h3 className="text-lg font-medium text-gray-900 mb-4">DNS Configuration</h3>
|
||||
|
||||
<div>
|
||||
<label className="label">DNS Servers</label>
|
||||
{config.dnsServers.map((dns, index) => (
|
||||
<div key={index} className="flex items-center space-x-2 mb-2">
|
||||
<input
|
||||
type="text"
|
||||
value={dns}
|
||||
onChange={(e) => handleArrayChange('dnsServers', index, e.target.value)}
|
||||
placeholder="8.8.8.8"
|
||||
className="input-field flex-1"
|
||||
/>
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => removeArrayItem('dnsServers', index)}
|
||||
className="text-red-600 hover:text-red-800"
|
||||
>
|
||||
Remove
|
||||
</button>
|
||||
</div>
|
||||
))}
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => addArrayItem('dnsServers')}
|
||||
className="text-bzzz-primary hover:text-bzzz-primary/80 text-sm"
|
||||
>
|
||||
+ Add DNS Server
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Validation Errors */}
|
||||
{errors.length > 0 && (
|
||||
<div className="bg-red-50 border border-red-200 rounded-lg p-4">
|
||||
<div className="flex items-center mb-2">
|
||||
<ExclamationTriangleIcon className="h-5 w-5 text-red-600 mr-2" />
|
||||
<span className="text-red-800 font-medium">Configuration Issues</span>
|
||||
</div>
|
||||
{errors.map((error, index) => (
|
||||
<p key={index} className="text-red-700 text-sm">{error}</p>
|
||||
))}
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* Configuration Summary */}
|
||||
{isFormValid && (
|
||||
<div className="bg-blue-50 border border-blue-200 rounded-lg p-4">
|
||||
<div className="flex items-center mb-2">
|
||||
<InformationCircleIcon className="h-5 w-5 text-blue-600 mr-2" />
|
||||
<span className="text-blue-800 font-medium">Configuration Summary</span>
|
||||
</div>
|
||||
<div className="text-blue-700 text-sm space-y-1">
|
||||
<p>• Primary interface: {config.primaryInterface}</p>
|
||||
<p>• BZZZ API will be available on port {config.bzzzPort}</p>
|
||||
<p>• MCP server will run on port {config.mcpPort}</p>
|
||||
<p>• Web UI will be accessible on port {config.webUIPort}</p>
|
||||
<p>• P2P network will use port {config.p2pPort}</p>
|
||||
{config.autoFirewall && <p>• Firewall rules will be configured automatically</p>}
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* Action Buttons */}
|
||||
<div className="flex justify-between pt-6 border-t border-gray-200">
|
||||
<div>
|
||||
{onBack && (
|
||||
@@ -55,7 +400,12 @@ export default function NetworkConfiguration({
|
||||
</button>
|
||||
)}
|
||||
</div>
|
||||
<button type="submit" className="btn-primary">
|
||||
|
||||
<button
|
||||
type="submit"
|
||||
disabled={!isFormValid}
|
||||
className="btn-primary"
|
||||
>
|
||||
{isCompleted ? 'Continue' : 'Next: Security Setup'}
|
||||
</button>
|
||||
</div>
|
||||
|
||||
@@ -0,0 +1,414 @@
|
||||
'use client'
|
||||
|
||||
import { useState, useEffect } from 'react'
|
||||
import {
|
||||
CodeBracketIcon,
|
||||
CheckCircleIcon,
|
||||
XCircleIcon,
|
||||
ArrowPathIcon,
|
||||
ExclamationTriangleIcon,
|
||||
EyeIcon,
|
||||
EyeSlashIcon
|
||||
} from '@heroicons/react/24/outline'
|
||||
|
||||
interface RepositoryProvider {
|
||||
name: string
|
||||
displayName: string
|
||||
description: string
|
||||
requiresBaseURL: boolean
|
||||
defaultBaseURL?: string
|
||||
}
|
||||
|
||||
interface RepositoryConfig {
|
||||
provider: string
|
||||
baseURL: string
|
||||
accessToken: string
|
||||
owner: string
|
||||
repository: string
|
||||
}
|
||||
|
||||
interface ValidationResult {
|
||||
valid: boolean
|
||||
message?: string
|
||||
error?: string
|
||||
}
|
||||
|
||||
interface RepositoryConfigurationProps {
|
||||
systemInfo: any
|
||||
configData: any
|
||||
onComplete: (data: any) => void
|
||||
onBack?: () => void
|
||||
isCompleted: boolean
|
||||
}
|
||||
|
||||
export default function RepositoryConfiguration({
|
||||
systemInfo,
|
||||
configData,
|
||||
onComplete,
|
||||
onBack,
|
||||
isCompleted
|
||||
}: RepositoryConfigurationProps) {
|
||||
const [providers, setProviders] = useState<RepositoryProvider[]>([])
|
||||
const [config, setConfig] = useState<RepositoryConfig>({
|
||||
provider: '',
|
||||
baseURL: '',
|
||||
accessToken: '',
|
||||
owner: '',
|
||||
repository: ''
|
||||
})
|
||||
const [validation, setValidation] = useState<ValidationResult | null>(null)
|
||||
const [validating, setValidating] = useState(false)
|
||||
const [showToken, setShowToken] = useState(false)
|
||||
const [loadingProviders, setLoadingProviders] = useState(true)
|
||||
|
||||
// Load existing config from configData if available
|
||||
useEffect(() => {
|
||||
if (configData.repository) {
|
||||
setConfig({ ...configData.repository })
|
||||
}
|
||||
}, [configData])
|
||||
|
||||
// Load supported providers
|
||||
useEffect(() => {
|
||||
loadProviders()
|
||||
}, [])
|
||||
|
||||
const loadProviders = async () => {
|
||||
try {
|
||||
const response = await fetch('/api/setup/repository/providers')
|
||||
if (response.ok) {
|
||||
const result = await response.json()
|
||||
const providerList = result.providers || []
|
||||
|
||||
// Map provider names to full provider objects
|
||||
const providersData: RepositoryProvider[] = providerList.map((name: string) => {
|
||||
switch (name.toLowerCase()) {
|
||||
case 'gitea':
|
||||
return {
|
||||
name: 'gitea',
|
||||
displayName: 'Gitea',
|
||||
description: 'Self-hosted Git service with issue tracking',
|
||||
requiresBaseURL: true,
|
||||
defaultBaseURL: 'http://gitea.local'
|
||||
}
|
||||
case 'github':
|
||||
return {
|
||||
name: 'github',
|
||||
displayName: 'GitHub',
|
||||
description: 'Cloud-based Git repository hosting service',
|
||||
requiresBaseURL: false,
|
||||
defaultBaseURL: 'https://api.github.com'
|
||||
}
|
||||
default:
|
||||
return {
|
||||
name: name.toLowerCase(),
|
||||
displayName: name,
|
||||
description: 'Git repository service',
|
||||
requiresBaseURL: true
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
setProviders(providersData)
|
||||
|
||||
// Set default provider if none selected
|
||||
if (!config.provider && providersData.length > 0) {
|
||||
const defaultProvider = providersData.find(p => p.name === 'gitea') || providersData[0]
|
||||
handleProviderChange(defaultProvider.name)
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('Failed to load providers:', error)
|
||||
} finally {
|
||||
setLoadingProviders(false)
|
||||
}
|
||||
}
|
||||
|
||||
const handleProviderChange = (provider: string) => {
|
||||
const providerData = providers.find(p => p.name === provider)
|
||||
setConfig(prev => ({
|
||||
...prev,
|
||||
provider,
|
||||
baseURL: providerData?.defaultBaseURL || prev.baseURL
|
||||
}))
|
||||
setValidation(null)
|
||||
}
|
||||
|
||||
const handleInputChange = (field: keyof RepositoryConfig, value: string) => {
|
||||
setConfig(prev => ({ ...prev, [field]: value }))
|
||||
setValidation(null)
|
||||
}
|
||||
|
||||
const validateRepository = async () => {
|
||||
if (!config.provider || !config.accessToken || !config.owner || !config.repository) {
|
||||
setValidation({
|
||||
valid: false,
|
||||
error: 'Please fill in all required fields'
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
setValidating(true)
|
||||
setValidation(null)
|
||||
|
||||
try {
|
||||
const response = await fetch('/api/setup/repository/validate', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
body: JSON.stringify(config)
|
||||
})
|
||||
|
||||
const result = await response.json()
|
||||
|
||||
if (response.ok && result.valid) {
|
||||
setValidation({
|
||||
valid: true,
|
||||
message: result.message || 'Repository connection successful'
|
||||
})
|
||||
} else {
|
||||
setValidation({
|
||||
valid: false,
|
||||
error: result.error || 'Validation failed'
|
||||
})
|
||||
}
|
||||
} catch (error) {
|
||||
setValidation({
|
||||
valid: false,
|
||||
error: 'Network error: Unable to validate repository'
|
||||
})
|
||||
} finally {
|
||||
setValidating(false)
|
||||
}
|
||||
}
|
||||
|
||||
const handleSubmit = (e: React.FormEvent) => {
|
||||
e.preventDefault()
|
||||
|
||||
if (validation?.valid) {
|
||||
onComplete({ repository: config })
|
||||
} else {
|
||||
validateRepository()
|
||||
}
|
||||
}
|
||||
|
||||
const selectedProvider = providers.find(p => p.name === config.provider)
|
||||
const isFormValid = config.provider && config.accessToken && config.owner && config.repository &&
|
||||
(!selectedProvider?.requiresBaseURL || config.baseURL)
|
||||
|
||||
if (loadingProviders) {
|
||||
return (
|
||||
<div className="flex items-center justify-center py-12">
|
||||
<div className="text-center">
|
||||
<ArrowPathIcon className="h-8 w-8 text-bzzz-primary animate-spin mx-auto mb-4" />
|
||||
<p className="text-gray-600">Loading repository providers...</p>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
return (
|
||||
<form onSubmit={handleSubmit} className="space-y-6">
|
||||
{/* Repository Provider Selection */}
|
||||
<div className="bg-gray-50 rounded-lg p-6">
|
||||
<h3 className="text-lg font-medium text-gray-900 mb-4 flex items-center">
|
||||
<CodeBracketIcon className="h-6 w-6 text-bzzz-primary mr-2" />
|
||||
Repository Provider
|
||||
</h3>
|
||||
|
||||
<div className="grid grid-cols-1 md:grid-cols-2 gap-4">
|
||||
{providers.map((provider) => (
|
||||
<div
|
||||
key={provider.name}
|
||||
className={`border-2 rounded-lg p-4 cursor-pointer transition-all ${
|
||||
config.provider === provider.name
|
||||
? 'border-bzzz-primary bg-bzzz-primary bg-opacity-10'
|
||||
: 'border-gray-200 hover:border-gray-300'
|
||||
}`}
|
||||
onClick={() => handleProviderChange(provider.name)}
|
||||
>
|
||||
<div className="flex items-center">
|
||||
<input
|
||||
type="radio"
|
||||
name="provider"
|
||||
value={provider.name}
|
||||
checked={config.provider === provider.name}
|
||||
onChange={() => handleProviderChange(provider.name)}
|
||||
className="h-4 w-4 text-bzzz-primary focus:ring-bzzz-primary border-gray-300"
|
||||
/>
|
||||
<div className="ml-3">
|
||||
<div className="font-medium text-gray-900">{provider.displayName}</div>
|
||||
<div className="text-sm text-gray-600">{provider.description}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Configuration Form */}
|
||||
{config.provider && (
|
||||
<div className="space-y-6">
|
||||
{/* Base URL (for providers that require it) */}
|
||||
{selectedProvider?.requiresBaseURL && (
|
||||
<div>
|
||||
<label className="label">
|
||||
Base URL *
|
||||
</label>
|
||||
<input
|
||||
type="url"
|
||||
value={config.baseURL}
|
||||
onChange={(e) => handleInputChange('baseURL', e.target.value)}
|
||||
placeholder={`e.g., ${selectedProvider.defaultBaseURL || 'https://git.example.com'}`}
|
||||
className="input-field"
|
||||
required
|
||||
/>
|
||||
<p className="text-sm text-gray-600 mt-1">
|
||||
The base URL for your {selectedProvider.displayName} instance
|
||||
</p>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* Access Token */}
|
||||
<div>
|
||||
<label className="label">
|
||||
Access Token *
|
||||
</label>
|
||||
<div className="relative">
|
||||
<input
|
||||
type={showToken ? 'text' : 'password'}
|
||||
value={config.accessToken}
|
||||
onChange={(e) => handleInputChange('accessToken', e.target.value)}
|
||||
placeholder={`Your ${selectedProvider?.displayName} access token`}
|
||||
className="input-field pr-10"
|
||||
required
|
||||
/>
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => setShowToken(!showToken)}
|
||||
className="absolute inset-y-0 right-0 pr-3 flex items-center"
|
||||
>
|
||||
{showToken ? (
|
||||
<EyeSlashIcon className="h-5 w-5 text-gray-400" />
|
||||
) : (
|
||||
<EyeIcon className="h-5 w-5 text-gray-400" />
|
||||
)}
|
||||
</button>
|
||||
</div>
|
||||
<p className="text-sm text-gray-600 mt-1">
|
||||
{selectedProvider?.name === 'github'
|
||||
? 'Generate a personal access token with repo and admin:repo_hook permissions'
|
||||
: 'Generate an access token with repository read/write permissions'
|
||||
}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
{/* Owner/Organization */}
|
||||
<div>
|
||||
<label className="label">
|
||||
Owner/Organization *
|
||||
</label>
|
||||
<input
|
||||
type="text"
|
||||
value={config.owner}
|
||||
onChange={(e) => handleInputChange('owner', e.target.value)}
|
||||
placeholder="username or organization"
|
||||
className="input-field"
|
||||
required
|
||||
/>
|
||||
<p className="text-sm text-gray-600 mt-1">
|
||||
The username or organization that owns the repository
|
||||
</p>
|
||||
</div>
|
||||
|
||||
{/* Repository Name */}
|
||||
<div>
|
||||
<label className="label">
|
||||
Repository Name *
|
||||
</label>
|
||||
<input
|
||||
type="text"
|
||||
value={config.repository}
|
||||
onChange={(e) => handleInputChange('repository', e.target.value)}
|
||||
placeholder="repository-name"
|
||||
className="input-field"
|
||||
required
|
||||
/>
|
||||
<p className="text-sm text-gray-600 mt-1">
|
||||
The name of the repository for task management
|
||||
</p>
|
||||
</div>
|
||||
|
||||
{/* Validation Section */}
|
||||
<div className="bg-white border border-gray-200 rounded-lg p-6">
|
||||
<h4 className="text-md font-medium text-gray-900 mb-3">Connection Test</h4>
|
||||
|
||||
{validation && (
|
||||
<div className={`flex items-center p-3 rounded-lg mb-4 ${
|
||||
validation.valid
|
||||
? 'bg-green-50 border border-green-200'
|
||||
: 'bg-red-50 border border-red-200'
|
||||
}`}>
|
||||
{validation.valid ? (
|
||||
<CheckCircleIcon className="h-5 w-5 text-green-600 mr-2" />
|
||||
) : (
|
||||
<XCircleIcon className="h-5 w-5 text-red-600 mr-2" />
|
||||
)}
|
||||
<span className={`text-sm ${
|
||||
validation.valid ? 'text-green-800' : 'text-red-800'
|
||||
}`}>
|
||||
{validation.valid ? validation.message : validation.error}
|
||||
</span>
|
||||
</div>
|
||||
)}
|
||||
|
||||
<button
|
||||
type="button"
|
||||
onClick={validateRepository}
|
||||
disabled={!isFormValid || validating}
|
||||
className="btn-outline w-full sm:w-auto"
|
||||
>
|
||||
{validating ? (
|
||||
<>
|
||||
<ArrowPathIcon className="h-4 w-4 animate-spin mr-2" />
|
||||
Testing Connection...
|
||||
</>
|
||||
) : (
|
||||
'Test Repository Connection'
|
||||
)}
|
||||
</button>
|
||||
|
||||
{!isFormValid && (
|
||||
<p className="text-sm text-gray-600 mt-2">
|
||||
Please fill in all required fields to test the connection
|
||||
</p>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* Action Buttons */}
|
||||
<div className="flex justify-between pt-6 border-t border-gray-200">
|
||||
<div>
|
||||
{onBack && (
|
||||
<button type="button" onClick={onBack} className="btn-outline">
|
||||
Back
|
||||
</button>
|
||||
)}
|
||||
</div>
|
||||
|
||||
<button
|
||||
type="submit"
|
||||
disabled={!validation?.valid}
|
||||
className="btn-primary"
|
||||
>
|
||||
{validation?.valid
|
||||
? (isCompleted ? 'Continue' : 'Next: Network Configuration')
|
||||
: 'Validate & Continue'
|
||||
}
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
)
|
||||
}
|
||||
@@ -1,6 +1,18 @@
|
||||
'use client'
|
||||
|
||||
import { useState } from 'react'
|
||||
import { useState, useEffect } from 'react'
|
||||
import {
|
||||
ShieldCheckIcon,
|
||||
KeyIcon,
|
||||
LockClosedIcon,
|
||||
ServerIcon,
|
||||
EyeIcon,
|
||||
EyeSlashIcon,
|
||||
DocumentDuplicateIcon,
|
||||
CheckCircleIcon,
|
||||
XCircleIcon,
|
||||
ExclamationTriangleIcon
|
||||
} from '@heroicons/react/24/outline'
|
||||
|
||||
interface SecuritySetupProps {
|
||||
systemInfo: any
|
||||
@@ -10,6 +22,25 @@ interface SecuritySetupProps {
|
||||
isCompleted: boolean
|
||||
}
|
||||
|
||||
interface SecurityConfig {
|
||||
sshKeyType: 'generate' | 'existing' | 'manual'
|
||||
sshPublicKey: string
|
||||
sshPrivateKey: string
|
||||
sshUsername: string
|
||||
sshPassword: string
|
||||
sshPort: number
|
||||
enableTLS: boolean
|
||||
tlsCertType: 'self-signed' | 'letsencrypt' | 'existing'
|
||||
tlsCertPath: string
|
||||
tlsKeyPath: string
|
||||
authMethod: 'token' | 'certificate' | 'hybrid'
|
||||
clusterSecret: string
|
||||
accessPolicy: 'open' | 'restricted' | 'invite-only'
|
||||
enableFirewall: boolean
|
||||
allowedPorts: string[]
|
||||
trustedIPs: string[]
|
||||
}
|
||||
|
||||
export default function SecuritySetup({
|
||||
systemInfo,
|
||||
configData,
|
||||
@@ -17,29 +48,616 @@ export default function SecuritySetup({
|
||||
onBack,
|
||||
isCompleted
|
||||
}: SecuritySetupProps) {
|
||||
const [config, setConfig] = useState({
|
||||
console.log('SecuritySetup: Component rendered with configData:', configData)
|
||||
|
||||
const [config, setConfig] = useState<SecurityConfig>({
|
||||
sshKeyType: 'generate',
|
||||
sshPublicKey: '',
|
||||
sshPrivateKey: '',
|
||||
sshUsername: 'ubuntu',
|
||||
sshPassword: '',
|
||||
sshPort: 22,
|
||||
enableTLS: true,
|
||||
authMethod: 'token'
|
||||
tlsCertType: 'self-signed',
|
||||
tlsCertPath: '',
|
||||
tlsKeyPath: '',
|
||||
authMethod: 'token',
|
||||
clusterSecret: '',
|
||||
accessPolicy: 'restricted',
|
||||
enableFirewall: true,
|
||||
allowedPorts: ['22', '8080', '8090', '9100', '3000'],
|
||||
trustedIPs: [],
|
||||
...configData?.security // Load saved security config if exists
|
||||
})
|
||||
|
||||
const [showPrivateKey, setShowPrivateKey] = useState(false)
|
||||
const [showClusterSecret, setShowClusterSecret] = useState(false)
|
||||
const [showSSHPassword, setShowSSHPassword] = useState(false)
|
||||
const [generating, setGenerating] = useState(false)
|
||||
const [validation, setValidation] = useState<{[key: string]: boolean}>({})
|
||||
const [portsInitialized, setPortsInitialized] = useState(false)
|
||||
|
||||
// Generate cluster secret on mount if not exists
|
||||
useEffect(() => {
|
||||
if (!config.clusterSecret) {
|
||||
generateClusterSecret()
|
||||
}
|
||||
}, [])
|
||||
|
||||
// Update firewall ports based on network configuration from previous step
|
||||
useEffect(() => {
|
||||
console.log('SecuritySetup: configData changed', {
|
||||
hasNetwork: !!configData?.network,
|
||||
portsInitialized,
|
||||
hasSavedSecurity: !!configData?.security?.allowedPorts,
|
||||
networkConfig: configData?.network
|
||||
})
|
||||
|
||||
// If we have network config and haven't initialized ports yet, AND we don't have saved security config
|
||||
if (configData?.network && !portsInitialized && !configData?.security?.allowedPorts) {
|
||||
const networkConfig = configData.network
|
||||
const networkPorts = [
|
||||
networkConfig.bzzzPort?.toString(),
|
||||
networkConfig.mcpPort?.toString(),
|
||||
networkConfig.webUIPort?.toString(),
|
||||
networkConfig.p2pPort?.toString()
|
||||
].filter(port => port && port !== 'undefined')
|
||||
|
||||
console.log('SecuritySetup: Auto-populating ports', { networkPorts, networkConfig })
|
||||
|
||||
// Include standard ports plus network configuration ports
|
||||
const standardPorts = ['22', '8090'] // SSH and setup interface
|
||||
const allPorts = [...new Set([...standardPorts, ...networkPorts])]
|
||||
|
||||
console.log('SecuritySetup: Setting allowed ports to', allPorts)
|
||||
setConfig(prev => ({ ...prev, allowedPorts: allPorts }))
|
||||
setPortsInitialized(true)
|
||||
}
|
||||
}, [configData, portsInitialized])
|
||||
|
||||
const generateClusterSecret = () => {
|
||||
const secret = Array.from(crypto.getRandomValues(new Uint8Array(32)))
|
||||
.map(b => b.toString(16).padStart(2, '0'))
|
||||
.join('')
|
||||
setConfig(prev => ({ ...prev, clusterSecret: secret }))
|
||||
}
|
||||
|
||||
const generateSSHKeys = async () => {
|
||||
setGenerating(true)
|
||||
try {
|
||||
// In a real implementation, this would call the backend to generate SSH keys
|
||||
// For now, simulate the process
|
||||
await new Promise(resolve => setTimeout(resolve, 2000))
|
||||
|
||||
// Mock generated keys (in real implementation, these would come from backend)
|
||||
const mockPublicKey = `ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQC... chorus@${systemInfo?.network?.hostname || 'localhost'}`
|
||||
const mockPrivateKey = `-----BEGIN OPENSSH PRIVATE KEY-----
|
||||
b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAAFwwAAAAd...
|
||||
-----END OPENSSH PRIVATE KEY-----`
|
||||
|
||||
setConfig(prev => ({
|
||||
...prev,
|
||||
sshPublicKey: mockPublicKey,
|
||||
sshPrivateKey: mockPrivateKey
|
||||
}))
|
||||
|
||||
setValidation(prev => ({ ...prev, sshKeys: true }))
|
||||
} catch (error) {
|
||||
console.error('Failed to generate SSH keys:', error)
|
||||
setValidation(prev => ({ ...prev, sshKeys: false }))
|
||||
} finally {
|
||||
setGenerating(false)
|
||||
}
|
||||
}
|
||||
|
||||
const copyToClipboard = async (text: string) => {
|
||||
try {
|
||||
await navigator.clipboard.writeText(text)
|
||||
} catch (error) {
|
||||
console.error('Failed to copy to clipboard:', error)
|
||||
}
|
||||
}
|
||||
|
||||
const handleSubmit = (e: React.FormEvent) => {
|
||||
e.preventDefault()
|
||||
onComplete({ security: config })
|
||||
|
||||
// Validate required fields
|
||||
const newValidation: {[key: string]: boolean} = {}
|
||||
|
||||
if (config.sshKeyType === 'generate' && !config.sshPublicKey) {
|
||||
newValidation.sshKeys = false
|
||||
} else if (config.sshKeyType === 'existing' && !config.sshPublicKey) {
|
||||
newValidation.sshKeys = false
|
||||
} else {
|
||||
newValidation.sshKeys = true
|
||||
}
|
||||
|
||||
if (config.enableTLS && config.tlsCertType === 'existing' && (!config.tlsCertPath || !config.tlsKeyPath)) {
|
||||
newValidation.tlsCert = false
|
||||
} else {
|
||||
newValidation.tlsCert = true
|
||||
}
|
||||
|
||||
if (!config.clusterSecret) {
|
||||
newValidation.clusterSecret = false
|
||||
} else {
|
||||
newValidation.clusterSecret = true
|
||||
}
|
||||
|
||||
if (config.sshKeyType === 'manual' && (!config.sshUsername || !config.sshPassword)) {
|
||||
newValidation.sshCredentials = false
|
||||
} else {
|
||||
newValidation.sshCredentials = true
|
||||
}
|
||||
|
||||
setValidation(newValidation)
|
||||
|
||||
// Check if all validations pass
|
||||
const isValid = Object.values(newValidation).every(v => v)
|
||||
|
||||
if (isValid) {
|
||||
onComplete({ security: config })
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
<form onSubmit={handleSubmit} className="space-y-6">
|
||||
<div className="text-center py-12">
|
||||
<h3 className="text-lg font-medium text-gray-900 mb-2">
|
||||
Security Setup
|
||||
</h3>
|
||||
<p className="text-gray-600">
|
||||
Configure authentication, SSH access, and security certificates.
|
||||
</p>
|
||||
<div className="mt-8">
|
||||
<div className="bg-yellow-50 border border-yellow-200 rounded-lg p-4 text-yellow-800">
|
||||
This component is under development. Security configuration will be implemented here.
|
||||
<form onSubmit={handleSubmit} className="space-y-8">
|
||||
|
||||
{/* SSH Key Configuration */}
|
||||
<div className="card">
|
||||
<div className="flex items-center mb-4">
|
||||
<KeyIcon className="h-6 w-6 text-bzzz-primary mr-2" />
|
||||
<h3 className="text-lg font-medium text-gray-900">SSH Key Management</h3>
|
||||
{validation.sshKeys === true && <CheckCircleIcon className="h-5 w-5 text-green-500 ml-2" />}
|
||||
{validation.sshKeys === false && <XCircleIcon className="h-5 w-5 text-red-500 ml-2" />}
|
||||
</div>
|
||||
|
||||
<div className="space-y-4">
|
||||
<div>
|
||||
<label className="block text-sm font-medium text-gray-700 mb-2">SSH Key Type</label>
|
||||
<div className="space-y-2">
|
||||
<label className="flex items-center">
|
||||
<input
|
||||
type="radio"
|
||||
value="generate"
|
||||
checked={config.sshKeyType === 'generate'}
|
||||
onChange={(e) => setConfig(prev => ({ ...prev, sshKeyType: e.target.value as any }))}
|
||||
className="mr-2"
|
||||
/>
|
||||
Generate new SSH key pair
|
||||
</label>
|
||||
<label className="flex items-center">
|
||||
<input
|
||||
type="radio"
|
||||
value="existing"
|
||||
checked={config.sshKeyType === 'existing'}
|
||||
onChange={(e) => setConfig(prev => ({ ...prev, sshKeyType: e.target.value as any }))}
|
||||
className="mr-2"
|
||||
/>
|
||||
Use existing SSH key
|
||||
</label>
|
||||
<label className="flex items-center">
|
||||
<input
|
||||
type="radio"
|
||||
value="manual"
|
||||
checked={config.sshKeyType === 'manual'}
|
||||
onChange={(e) => setConfig(prev => ({ ...prev, sshKeyType: e.target.value as any }))}
|
||||
className="mr-2"
|
||||
/>
|
||||
Configure manually with SSH username/password
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{config.sshKeyType === 'generate' && (
|
||||
<div className="space-y-4">
|
||||
{!config.sshPublicKey ? (
|
||||
<button
|
||||
type="button"
|
||||
onClick={generateSSHKeys}
|
||||
disabled={generating}
|
||||
className="btn-primary"
|
||||
>
|
||||
{generating ? 'Generating Keys...' : 'Generate SSH Key Pair'}
|
||||
</button>
|
||||
) : (
|
||||
<div className="space-y-4">
|
||||
<div>
|
||||
<label className="block text-sm font-medium text-gray-700 mb-2">Public Key</label>
|
||||
<div className="relative">
|
||||
<textarea
|
||||
value={config.sshPublicKey}
|
||||
readOnly
|
||||
className="w-full p-3 border border-gray-300 rounded-lg bg-gray-50 font-mono text-sm"
|
||||
rows={3}
|
||||
/>
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => copyToClipboard(config.sshPublicKey)}
|
||||
className="absolute top-2 right-2 p-1 text-gray-500 hover:text-gray-700"
|
||||
>
|
||||
<DocumentDuplicateIcon className="h-4 w-4" />
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label className="block text-sm font-medium text-gray-700 mb-2">Private Key</label>
|
||||
<div className="relative">
|
||||
<textarea
|
||||
value={showPrivateKey ? config.sshPrivateKey : '••••••••••••••••••••••••••••••••'}
|
||||
readOnly
|
||||
className="w-full p-3 border border-gray-300 rounded-lg bg-gray-50 font-mono text-sm"
|
||||
rows={6}
|
||||
/>
|
||||
<div className="absolute top-2 right-2 flex space-x-1">
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => setShowPrivateKey(!showPrivateKey)}
|
||||
className="p-1 text-gray-500 hover:text-gray-700"
|
||||
>
|
||||
{showPrivateKey ? <EyeSlashIcon className="h-4 w-4" /> : <EyeIcon className="h-4 w-4" />}
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => copyToClipboard(config.sshPrivateKey)}
|
||||
className="p-1 text-gray-500 hover:text-gray-700"
|
||||
>
|
||||
<DocumentDuplicateIcon className="h-4 w-4" />
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<p className="text-sm text-yellow-600 mt-1">⚠️ Store this private key securely. It cannot be recovered.</p>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
|
||||
{config.sshKeyType === 'existing' && (
|
||||
<div>
|
||||
<label className="block text-sm font-medium text-gray-700 mb-2">SSH Public Key</label>
|
||||
<textarea
|
||||
value={config.sshPublicKey}
|
||||
onChange={(e) => setConfig(prev => ({ ...prev, sshPublicKey: e.target.value }))}
|
||||
placeholder="ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQC..."
|
||||
className="w-full p-3 border border-gray-300 rounded-lg font-mono text-sm"
|
||||
rows={3}
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{config.sshKeyType === 'manual' && (
|
||||
<div className="space-y-4">
|
||||
<div className="bg-yellow-50 border border-yellow-200 rounded-lg p-4">
|
||||
<div className="flex items-start">
|
||||
<div className="flex-shrink-0">
|
||||
<ExclamationTriangleIcon className="h-5 w-5 text-yellow-600 mt-0.5" />
|
||||
</div>
|
||||
<div className="ml-3">
|
||||
<h4 className="text-sm font-medium text-yellow-800">Manual SSH Configuration</h4>
|
||||
<p className="text-sm text-yellow-700 mt-1">
|
||||
Provide SSH credentials for cluster machines. SSH keys will be automatically generated and deployed using these credentials.
|
||||
<strong> Passwords are only used during setup and are not stored.</strong>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="grid grid-cols-1 md:grid-cols-2 gap-4">
|
||||
<div>
|
||||
<label className="block text-sm font-medium text-gray-700 mb-2">
|
||||
SSH Username <span className="text-red-500">*</span>
|
||||
</label>
|
||||
<input
|
||||
type="text"
|
||||
value={config.sshUsername}
|
||||
onChange={(e) => setConfig(prev => ({ ...prev, sshUsername: e.target.value }))}
|
||||
placeholder="ubuntu"
|
||||
className="w-full px-3 py-2 border border-gray-300 rounded-lg focus:ring-bzzz-primary focus:border-bzzz-primary"
|
||||
required
|
||||
/>
|
||||
<p className="text-sm text-gray-500 mt-1">
|
||||
Exact SSH username for cluster machines
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label className="block text-sm font-medium text-gray-700 mb-2">
|
||||
SSH Port
|
||||
</label>
|
||||
<input
|
||||
type="number"
|
||||
value={config.sshPort}
|
||||
onChange={(e) => setConfig(prev => ({ ...prev, sshPort: parseInt(e.target.value) || 22 }))}
|
||||
min="1"
|
||||
max="65535"
|
||||
className="w-full px-3 py-2 border border-gray-300 rounded-lg focus:ring-bzzz-primary focus:border-bzzz-primary"
|
||||
/>
|
||||
<p className="text-sm text-gray-500 mt-1">
|
||||
SSH port number (default: 22)
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label className="block text-sm font-medium text-gray-700 mb-2">
|
||||
SSH Password <span className="text-red-500">*</span>
|
||||
</label>
|
||||
<div className="relative">
|
||||
<input
|
||||
type={showSSHPassword ? 'text' : 'password'}
|
||||
value={config.sshPassword}
|
||||
onChange={(e) => setConfig(prev => ({ ...prev, sshPassword: e.target.value }))}
|
||||
placeholder="Enter SSH password for cluster machines"
|
||||
className="w-full px-3 py-2 pr-10 border border-gray-300 rounded-lg focus:ring-bzzz-primary focus:border-bzzz-primary"
|
||||
required
|
||||
/>
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => setShowSSHPassword(!showSSHPassword)}
|
||||
className="absolute inset-y-0 right-0 pr-3 flex items-center"
|
||||
>
|
||||
{showSSHPassword ? (
|
||||
<EyeSlashIcon className="h-4 w-4 text-gray-400" />
|
||||
) : (
|
||||
<EyeIcon className="h-4 w-4 text-gray-400" />
|
||||
)}
|
||||
</button>
|
||||
</div>
|
||||
<p className="text-sm text-gray-500 mt-1">
|
||||
SSH password for the specified username (used only during setup)
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
{/* TLS/SSL Configuration */}
|
||||
<div className="card">
|
||||
<div className="flex items-center mb-4">
|
||||
<LockClosedIcon className="h-6 w-6 text-bzzz-primary mr-2" />
|
||||
<h3 className="text-lg font-medium text-gray-900">TLS/SSL Configuration</h3>
|
||||
{validation.tlsCert === true && <CheckCircleIcon className="h-5 w-5 text-green-500 ml-2" />}
|
||||
{validation.tlsCert === false && <XCircleIcon className="h-5 w-5 text-red-500 ml-2" />}
|
||||
</div>
|
||||
|
||||
<div className="space-y-4">
|
||||
<label className="flex items-center">
|
||||
<input
|
||||
type="checkbox"
|
||||
checked={config.enableTLS}
|
||||
onChange={(e) => setConfig(prev => ({ ...prev, enableTLS: e.target.checked }))}
|
||||
className="mr-2"
|
||||
/>
|
||||
Enable TLS encryption for cluster communication
|
||||
</label>
|
||||
|
||||
{config.enableTLS && (
|
||||
<div className="space-y-4 ml-6">
|
||||
<div>
|
||||
<label className="block text-sm font-medium text-gray-700 mb-2">Certificate Type</label>
|
||||
<div className="space-y-2">
|
||||
<label className="flex items-center">
|
||||
<input
|
||||
type="radio"
|
||||
value="self-signed"
|
||||
checked={config.tlsCertType === 'self-signed'}
|
||||
onChange={(e) => setConfig(prev => ({ ...prev, tlsCertType: e.target.value as any }))}
|
||||
className="mr-2"
|
||||
/>
|
||||
Generate self-signed certificate
|
||||
</label>
|
||||
<label className="flex items-center">
|
||||
<input
|
||||
type="radio"
|
||||
value="letsencrypt"
|
||||
checked={config.tlsCertType === 'letsencrypt'}
|
||||
onChange={(e) => setConfig(prev => ({ ...prev, tlsCertType: e.target.value as any }))}
|
||||
className="mr-2"
|
||||
/>
|
||||
Use Let's Encrypt (requires domain)
|
||||
</label>
|
||||
<label className="flex items-center">
|
||||
<input
|
||||
type="radio"
|
||||
value="existing"
|
||||
checked={config.tlsCertType === 'existing'}
|
||||
onChange={(e) => setConfig(prev => ({ ...prev, tlsCertType: e.target.value as any }))}
|
||||
className="mr-2"
|
||||
/>
|
||||
Use existing certificate
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{config.tlsCertType === 'existing' && (
|
||||
<div className="space-y-4">
|
||||
<div>
|
||||
<label className="block text-sm font-medium text-gray-700 mb-2">Certificate Path</label>
|
||||
<input
|
||||
type="text"
|
||||
value={config.tlsCertPath}
|
||||
onChange={(e) => setConfig(prev => ({ ...prev, tlsCertPath: e.target.value }))}
|
||||
placeholder="/path/to/certificate.crt"
|
||||
className="w-full p-3 border border-gray-300 rounded-lg"
|
||||
/>
|
||||
</div>
|
||||
<div>
|
||||
<label className="block text-sm font-medium text-gray-700 mb-2">Private Key Path</label>
|
||||
<input
|
||||
type="text"
|
||||
value={config.tlsKeyPath}
|
||||
onChange={(e) => setConfig(prev => ({ ...prev, tlsKeyPath: e.target.value }))}
|
||||
placeholder="/path/to/private.key"
|
||||
className="w-full p-3 border border-gray-300 rounded-lg"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Authentication Method */}
|
||||
<div className="card">
|
||||
<div className="flex items-center mb-4">
|
||||
<ShieldCheckIcon className="h-6 w-6 text-bzzz-primary mr-2" />
|
||||
<h3 className="text-lg font-medium text-gray-900">Authentication Method</h3>
|
||||
</div>
|
||||
|
||||
<div className="space-y-4">
|
||||
<div>
|
||||
<label className="block text-sm font-medium text-gray-700 mb-2">Authentication Type</label>
|
||||
<div className="space-y-2">
|
||||
<label className="flex items-center">
|
||||
<input
|
||||
type="radio"
|
||||
value="token"
|
||||
checked={config.authMethod === 'token'}
|
||||
onChange={(e) => setConfig(prev => ({ ...prev, authMethod: e.target.value as any }))}
|
||||
className="mr-2"
|
||||
/>
|
||||
API Token-based authentication
|
||||
</label>
|
||||
<label className="flex items-center">
|
||||
<input
|
||||
type="radio"
|
||||
value="certificate"
|
||||
checked={config.authMethod === 'certificate'}
|
||||
onChange={(e) => setConfig(prev => ({ ...prev, authMethod: e.target.value as any }))}
|
||||
className="mr-2"
|
||||
/>
|
||||
Certificate-based authentication
|
||||
</label>
|
||||
<label className="flex items-center">
|
||||
<input
|
||||
type="radio"
|
||||
value="hybrid"
|
||||
checked={config.authMethod === 'hybrid'}
|
||||
onChange={(e) => setConfig(prev => ({ ...prev, authMethod: e.target.value as any }))}
|
||||
className="mr-2"
|
||||
/>
|
||||
Hybrid (Token + Certificate)
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label className="block text-sm font-medium text-gray-700 mb-2">Cluster Secret</label>
|
||||
<div className="relative">
|
||||
<input
|
||||
type={showClusterSecret ? "text" : "password"}
|
||||
value={config.clusterSecret}
|
||||
onChange={(e) => setConfig(prev => ({ ...prev, clusterSecret: e.target.value }))}
|
||||
className="w-full p-3 border border-gray-300 rounded-lg font-mono"
|
||||
placeholder="Cluster authentication secret"
|
||||
/>
|
||||
<div className="absolute right-2 top-1/2 transform -translate-y-1/2 flex space-x-1">
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => setShowClusterSecret(!showClusterSecret)}
|
||||
className="p-1 text-gray-500 hover:text-gray-700"
|
||||
>
|
||||
{showClusterSecret ? <EyeSlashIcon className="h-4 w-4" /> : <EyeIcon className="h-4 w-4" />}
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
onClick={generateClusterSecret}
|
||||
className="p-1 text-gray-500 hover:text-gray-700"
|
||||
>
|
||||
<KeyIcon className="h-4 w-4" />
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
{validation.clusterSecret === false && (
|
||||
<p className="text-sm text-red-600 mt-1">Cluster secret is required</p>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Access Control */}
|
||||
<div className="card">
|
||||
<div className="flex items-center mb-4">
|
||||
<ServerIcon className="h-6 w-6 text-bzzz-primary mr-2" />
|
||||
<h3 className="text-lg font-medium text-gray-900">Access Control</h3>
|
||||
</div>
|
||||
|
||||
<div className="space-y-4">
|
||||
<div>
|
||||
<label className="block text-sm font-medium text-gray-700 mb-2">Access Policy</label>
|
||||
<select
|
||||
value={config.accessPolicy}
|
||||
onChange={(e) => setConfig(prev => ({ ...prev, accessPolicy: e.target.value as any }))}
|
||||
className="w-full p-3 border border-gray-300 rounded-lg"
|
||||
>
|
||||
<option value="open">Open (Anyone can join cluster)</option>
|
||||
<option value="restricted">Restricted (Require authentication)</option>
|
||||
<option value="invite-only">Invite Only (Manual approval required)</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<label className="flex items-center">
|
||||
<input
|
||||
type="checkbox"
|
||||
checked={config.enableFirewall}
|
||||
onChange={(e) => setConfig(prev => ({ ...prev, enableFirewall: e.target.checked }))}
|
||||
className="mr-2"
|
||||
/>
|
||||
Enable firewall configuration
|
||||
</label>
|
||||
|
||||
{config.enableFirewall && (
|
||||
<div className="ml-6 space-y-4">
|
||||
<div>
|
||||
<label className="block text-sm font-medium text-gray-700 mb-2">Allowed Ports</label>
|
||||
<input
|
||||
type="text"
|
||||
value={config.allowedPorts.join(', ')}
|
||||
onChange={(e) => setConfig(prev => ({
|
||||
...prev,
|
||||
allowedPorts: e.target.value.split(',').map(p => p.trim()).filter(p => p)
|
||||
}))}
|
||||
placeholder="22, 8080, 8090, 9100, 3000"
|
||||
className="w-full p-3 border border-gray-300 rounded-lg"
|
||||
/>
|
||||
{configData?.network && (
|
||||
<p className="text-sm text-green-600 mt-1 flex items-center">
|
||||
<CheckCircleIcon className="h-4 w-4 mr-1" />
|
||||
Ports automatically configured from Network Settings: {[
|
||||
configData.network.bzzzPort,
|
||||
configData.network.mcpPort,
|
||||
configData.network.webUIPort,
|
||||
configData.network.p2pPort
|
||||
].filter(p => p).join(', ')}
|
||||
</p>
|
||||
)}
|
||||
<p className="text-sm text-gray-500 mt-1">
|
||||
Comma-separated list of ports to allow through the firewall
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Security Summary */}
|
||||
<div className="bg-blue-50 border border-blue-200 rounded-lg p-4">
|
||||
<div className="flex items-start">
|
||||
<ExclamationTriangleIcon className="h-5 w-5 text-blue-500 mt-0.5 mr-2" />
|
||||
<div>
|
||||
<h4 className="text-sm font-medium text-blue-800">Security Summary</h4>
|
||||
<ul className="text-sm text-blue-700 mt-1 space-y-1">
|
||||
<li>• SSH access: {config.sshKeyType === 'generate' ? 'New key pair will be generated' : config.sshKeyType === 'existing' ? 'Using provided key' : 'Manual configuration'}</li>
|
||||
<li>• TLS encryption: {config.enableTLS ? 'Enabled' : 'Disabled'}</li>
|
||||
<li>• Authentication: {config.authMethod}</li>
|
||||
<li>• Access policy: {config.accessPolicy}</li>
|
||||
<li>• Firewall: {config.enableFirewall ? 'Enabled' : 'Disabled'}</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -52,7 +670,11 @@ export default function SecuritySetup({
|
||||
</button>
|
||||
)}
|
||||
</div>
|
||||
<button type="submit" className="btn-primary">
|
||||
<button
|
||||
type="submit"
|
||||
disabled={config.sshKeyType === 'generate' && !config.sshPublicKey}
|
||||
className="btn-primary"
|
||||
>
|
||||
{isCompleted ? 'Continue' : 'Next: AI Integration'}
|
||||
</button>
|
||||
</div>
|
||||
|
||||
@@ -1,6 +1,40 @@
|
||||
'use client'
|
||||
|
||||
import { useState } from 'react'
|
||||
import { useState, useEffect } from 'react'
|
||||
import {
|
||||
ServerIcon,
|
||||
ExclamationTriangleIcon,
|
||||
CheckCircleIcon,
|
||||
XCircleIcon,
|
||||
PlayIcon,
|
||||
StopIcon,
|
||||
TrashIcon,
|
||||
DocumentTextIcon,
|
||||
ArrowPathIcon,
|
||||
CloudArrowDownIcon,
|
||||
Cog6ToothIcon,
|
||||
XMarkIcon,
|
||||
ComputerDesktopIcon
|
||||
} from '@heroicons/react/24/outline'
|
||||
|
||||
interface Machine {
|
||||
id: string
|
||||
hostname: string
|
||||
ip: string
|
||||
os: string
|
||||
osVersion: string
|
||||
sshStatus: 'unknown' | 'connected' | 'failed' | 'testing'
|
||||
deployStatus: 'not_deployed' | 'installing' | 'running' | 'stopped' | 'error'
|
||||
selected: boolean
|
||||
lastSeen?: string
|
||||
deployProgress?: number
|
||||
deployStep?: string
|
||||
systemInfo?: {
|
||||
cpu: number
|
||||
memory: number
|
||||
disk: number
|
||||
}
|
||||
}
|
||||
|
||||
interface ServiceDeploymentProps {
|
||||
systemInfo: any
|
||||
@@ -17,32 +51,698 @@ export default function ServiceDeployment({
|
||||
onBack,
|
||||
isCompleted
|
||||
}: ServiceDeploymentProps) {
|
||||
const [machines, setMachines] = useState<Machine[]>([])
|
||||
const [isDiscovering, setIsDiscovering] = useState(false)
|
||||
const [discoveryProgress, setDiscoveryProgress] = useState(0)
|
||||
const [discoveryStatus, setDiscoveryStatus] = useState('')
|
||||
const [showLogs, setShowLogs] = useState<string | null>(null)
|
||||
const [deploymentLogs, setDeploymentLogs] = useState<{[key: string]: string[]}>({})
|
||||
const [showConsole, setShowConsole] = useState<string | null>(null)
|
||||
const [consoleLogs, setConsoleLogs] = useState<{[key: string]: string[]}>({})
|
||||
|
||||
const [config, setConfig] = useState({
|
||||
deploymentMethod: 'systemd',
|
||||
autoStart: true
|
||||
autoStart: true,
|
||||
healthCheckInterval: 30,
|
||||
selectedMachines: [] as string[]
|
||||
})
|
||||
|
||||
// Initialize with current machine
|
||||
useEffect(() => {
|
||||
const currentMachine: Machine = {
|
||||
id: 'localhost',
|
||||
hostname: systemInfo?.network?.hostname || 'localhost',
|
||||
ip: configData?.network?.primaryIP || '127.0.0.1',
|
||||
os: systemInfo?.os || 'linux',
|
||||
osVersion: 'Current Host',
|
||||
sshStatus: 'connected',
|
||||
deployStatus: 'running', // Already running since we're in setup
|
||||
selected: true,
|
||||
systemInfo: {
|
||||
cpu: systemInfo?.cpu_cores || 0,
|
||||
memory: Math.round((systemInfo?.memory_mb || 0) / 1024),
|
||||
disk: systemInfo?.storage?.free_space_gb || 0
|
||||
}
|
||||
}
|
||||
setMachines([currentMachine])
|
||||
setConfig(prev => ({ ...prev, selectedMachines: ['localhost'] }))
|
||||
}, [systemInfo, configData])
|
||||
|
||||
const discoverMachines = async () => {
|
||||
setIsDiscovering(true)
|
||||
setDiscoveryProgress(0)
|
||||
setDiscoveryStatus('Initializing network scan...')
|
||||
|
||||
try {
|
||||
// Simulate progress updates during discovery
|
||||
const progressInterval = setInterval(() => {
|
||||
setDiscoveryProgress(prev => {
|
||||
const newProgress = prev + 10
|
||||
if (newProgress <= 30) {
|
||||
setDiscoveryStatus('Scanning network subnet...')
|
||||
} else if (newProgress <= 60) {
|
||||
setDiscoveryStatus('Checking SSH accessibility...')
|
||||
} else if (newProgress <= 90) {
|
||||
setDiscoveryStatus('Gathering system information...')
|
||||
} else {
|
||||
setDiscoveryStatus('Finalizing discovery...')
|
||||
}
|
||||
return Math.min(newProgress, 95)
|
||||
})
|
||||
}, 200)
|
||||
|
||||
const response = await fetch('/api/setup/discover-machines', {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({
|
||||
subnet: configData?.network?.allowedIPs?.[0] || '192.168.1.0/24',
|
||||
sshKey: configData?.security?.sshPublicKey
|
||||
})
|
||||
})
|
||||
|
||||
clearInterval(progressInterval)
|
||||
setDiscoveryProgress(100)
|
||||
|
||||
if (response.ok) {
|
||||
const result = await response.json()
|
||||
setDiscoveryStatus(`Found ${result.machines?.length || 0} machines`)
|
||||
|
||||
const discoveredMachines: Machine[] = result.machines.map((m: any) => ({
|
||||
id: m.ip,
|
||||
hostname: m.hostname || 'Unknown',
|
||||
ip: m.ip,
|
||||
os: m.os || 'unknown',
|
||||
osVersion: m.os_version || 'Unknown',
|
||||
sshStatus: 'unknown',
|
||||
deployStatus: 'not_deployed',
|
||||
selected: false,
|
||||
lastSeen: new Date().toISOString(),
|
||||
systemInfo: m.system_info
|
||||
}))
|
||||
|
||||
// Merge with existing machines (keep localhost)
|
||||
setMachines(prev => {
|
||||
const localhost = prev.find(m => m.id === 'localhost')
|
||||
return localhost ? [localhost, ...discoveredMachines] : discoveredMachines
|
||||
})
|
||||
} else {
|
||||
setDiscoveryStatus('Discovery failed - check network configuration')
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('Discovery failed:', error)
|
||||
setDiscoveryStatus('Discovery error - network unreachable')
|
||||
} finally {
|
||||
setTimeout(() => {
|
||||
setIsDiscovering(false)
|
||||
setDiscoveryProgress(0)
|
||||
setDiscoveryStatus('')
|
||||
}, 2000)
|
||||
}
|
||||
}
|
||||
|
||||
const testSSHConnection = async (machineId: string) => {
|
||||
setMachines(prev => prev.map(m =>
|
||||
m.id === machineId ? { ...m, sshStatus: 'testing' } : m
|
||||
))
|
||||
|
||||
try {
|
||||
const machine = machines.find(m => m.id === machineId)
|
||||
const response = await fetch('/api/setup/test-ssh', {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({
|
||||
ip: machine?.ip,
|
||||
sshKey: configData?.security?.sshPrivateKey,
|
||||
sshUsername: configData?.security?.sshUsername || 'ubuntu',
|
||||
sshPassword: configData?.security?.sshPassword,
|
||||
sshPort: configData?.security?.sshPort || 22
|
||||
})
|
||||
})
|
||||
|
||||
const result = await response.json()
|
||||
setMachines(prev => prev.map(m =>
|
||||
m.id === machineId ? {
|
||||
...m,
|
||||
sshStatus: result.success ? 'connected' : 'failed',
|
||||
os: result.os || m.os,
|
||||
osVersion: result.os_version || m.osVersion,
|
||||
systemInfo: result.system_info || m.systemInfo
|
||||
} : m
|
||||
))
|
||||
} catch (error) {
|
||||
setMachines(prev => prev.map(m =>
|
||||
m.id === machineId ? { ...m, sshStatus: 'failed' } : m
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
const deployToMachine = async (machineId: string) => {
|
||||
setMachines(prev => prev.map(m =>
|
||||
m.id === machineId ? {
|
||||
...m,
|
||||
deployStatus: 'installing',
|
||||
deployProgress: 0,
|
||||
deployStep: 'Initializing deployment...'
|
||||
} : m
|
||||
))
|
||||
|
||||
const logs: string[] = []
|
||||
const consoleLogs: string[] = [`🚀 Starting deployment to ${machines.find(m => m.id === machineId)?.hostname} (${machines.find(m => m.id === machineId)?.ip})`]
|
||||
setDeploymentLogs(prev => ({ ...prev, [machineId]: logs }))
|
||||
setConsoleLogs(prev => ({ ...prev, [machineId]: consoleLogs }))
|
||||
|
||||
// Open console if not already showing
|
||||
if (!showConsole) {
|
||||
setShowConsole(machineId)
|
||||
}
|
||||
|
||||
// Real-time console logging helper
|
||||
const addConsoleLog = (message: string) => {
|
||||
const timestamp = new Date().toLocaleTimeString()
|
||||
const logMessage = `[${timestamp}] ${message}`
|
||||
setConsoleLogs(prev => ({
|
||||
...prev,
|
||||
[machineId]: [...(prev[machineId] || []), logMessage]
|
||||
}))
|
||||
}
|
||||
|
||||
// Simulate progress updates
|
||||
const progressSteps = [
|
||||
{ progress: 10, step: 'Establishing SSH connection...' },
|
||||
{ progress: 30, step: 'Copying BZZZ binary...' },
|
||||
{ progress: 60, step: 'Creating systemd service...' },
|
||||
{ progress: 80, step: 'Starting service...' },
|
||||
{ progress: 100, step: 'Deployment complete!' }
|
||||
]
|
||||
|
||||
const updateProgress = (stepIndex: number) => {
|
||||
if (stepIndex < progressSteps.length) {
|
||||
const { progress, step } = progressSteps[stepIndex]
|
||||
setMachines(prev => prev.map(m =>
|
||||
m.id === machineId ? {
|
||||
...m,
|
||||
deployProgress: progress,
|
||||
deployStep: step
|
||||
} : m
|
||||
))
|
||||
logs.push(`📦 ${step}`)
|
||||
addConsoleLog(`📦 ${step}`)
|
||||
setDeploymentLogs(prev => ({ ...prev, [machineId]: [...(prev[machineId] || []), `📦 ${step}`] }))
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
const machine = machines.find(m => m.id === machineId)
|
||||
addConsoleLog(`🚀 Starting deployment to ${machine?.hostname}...`)
|
||||
addConsoleLog(`📡 Sending deployment request to backend API...`)
|
||||
|
||||
// Set initial progress
|
||||
setMachines(prev => prev.map(m =>
|
||||
m.id === machineId ? {
|
||||
...m,
|
||||
deployProgress: 10,
|
||||
deployStep: 'Contacting backend API...'
|
||||
} : m
|
||||
))
|
||||
const response = await fetch('/api/setup/deploy-service', {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({
|
||||
ip: machine?.ip,
|
||||
sshKey: configData?.security?.sshPrivateKey,
|
||||
sshUsername: configData?.security?.sshUsername || 'ubuntu',
|
||||
sshPassword: configData?.security?.sshPassword,
|
||||
sshPort: configData?.security?.sshPort || 22,
|
||||
config: {
|
||||
ports: {
|
||||
api: configData?.network?.bzzzPort || 8080,
|
||||
mcp: configData?.network?.mcpPort || 3000,
|
||||
webui: configData?.network?.webUIPort || 8080,
|
||||
p2p: configData?.network?.p2pPort || 7000
|
||||
},
|
||||
security: configData?.security,
|
||||
autoStart: config.autoStart
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
const result = await response.json()
|
||||
addConsoleLog(`📨 Received response from backend API`)
|
||||
|
||||
if (result.success) {
|
||||
setMachines(prev => prev.map(m =>
|
||||
m.id === machineId ? {
|
||||
...m,
|
||||
deployStatus: 'running',
|
||||
deployProgress: 100,
|
||||
deployStep: 'Running'
|
||||
} : m
|
||||
))
|
||||
logs.push('✅ Deployment completed successfully')
|
||||
addConsoleLog('✅ Deployment completed successfully!')
|
||||
|
||||
// Show actual backend steps if provided
|
||||
if (result.steps) {
|
||||
result.steps.forEach((step: string) => {
|
||||
logs.push(step)
|
||||
addConsoleLog(`📋 ${step}`)
|
||||
})
|
||||
}
|
||||
addConsoleLog(`🎉 CHORUS:agents service is now running on ${machine?.hostname}`)
|
||||
} else {
|
||||
setMachines(prev => prev.map(m =>
|
||||
m.id === machineId ? {
|
||||
...m,
|
||||
deployStatus: 'error',
|
||||
deployProgress: 0,
|
||||
deployStep: 'Failed'
|
||||
} : m
|
||||
))
|
||||
logs.push(`❌ Deployment failed: ${result.error}`)
|
||||
addConsoleLog(`❌ Deployment failed: ${result.error}`)
|
||||
addConsoleLog(`💡 Note: This was a real backend error, not simulated progress`)
|
||||
}
|
||||
} catch (error) {
|
||||
setMachines(prev => prev.map(m =>
|
||||
m.id === machineId ? {
|
||||
...m,
|
||||
deployStatus: 'error',
|
||||
deployProgress: 0,
|
||||
deployStep: 'Error'
|
||||
} : m
|
||||
))
|
||||
logs.push(`❌ Deployment error: ${error}`)
|
||||
addConsoleLog(`❌ Deployment error: ${error}`)
|
||||
}
|
||||
|
||||
setDeploymentLogs(prev => ({ ...prev, [machineId]: logs }))
|
||||
}
|
||||
|
||||
const toggleMachineSelection = (machineId: string) => {
|
||||
setMachines(prev => prev.map(m =>
|
||||
m.id === machineId ? { ...m, selected: !m.selected } : m
|
||||
))
|
||||
|
||||
setConfig(prev => ({
|
||||
...prev,
|
||||
selectedMachines: machines
|
||||
.map(m => m.id === machineId ? { ...m, selected: !m.selected } : m)
|
||||
.filter(m => m.selected)
|
||||
.map(m => m.id)
|
||||
}))
|
||||
}
|
||||
|
||||
const deployToSelected = async () => {
|
||||
const selectedMachines = machines.filter(m => m.selected && m.sshStatus === 'connected')
|
||||
for (const machine of selectedMachines) {
|
||||
if (machine.deployStatus === 'not_deployed') {
|
||||
await deployToMachine(machine.id)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const removeMachine = (machineId: string) => {
|
||||
// Don't allow removing localhost
|
||||
if (machineId === 'localhost') return
|
||||
|
||||
setMachines(prev => prev.filter(m => m.id !== machineId))
|
||||
setConfig(prev => ({
|
||||
...prev,
|
||||
selectedMachines: prev.selectedMachines.filter(id => id !== machineId)
|
||||
}))
|
||||
|
||||
// Clean up logs for removed machine
|
||||
setDeploymentLogs(prev => {
|
||||
const { [machineId]: removed, ...rest } = prev
|
||||
return rest
|
||||
})
|
||||
}
|
||||
|
||||
const getStatusIcon = (status: string) => {
|
||||
switch (status) {
|
||||
case 'connected': return <CheckCircleIcon className="h-5 w-5 text-green-500" />
|
||||
case 'failed': return <XCircleIcon className="h-5 w-5 text-red-500" />
|
||||
case 'testing': return <ArrowPathIcon className="h-5 w-5 text-blue-500 animate-spin" />
|
||||
case 'running': return <CheckCircleIcon className="h-5 w-5 text-green-500" />
|
||||
case 'installing': return <ArrowPathIcon className="h-5 w-5 text-blue-500 animate-spin" />
|
||||
case 'error': return <XCircleIcon className="h-5 w-5 text-red-500" />
|
||||
case 'stopped': return <StopIcon className="h-5 w-5 text-yellow-500" />
|
||||
default: return <ServerIcon className="h-5 w-5 text-gray-400" />
|
||||
}
|
||||
}
|
||||
|
||||
const handleSubmit = (e: React.FormEvent) => {
|
||||
e.preventDefault()
|
||||
onComplete({ deployment: config })
|
||||
onComplete({
|
||||
deployment: {
|
||||
...config,
|
||||
machines: machines.filter(m => m.selected).map(m => ({
|
||||
id: m.id,
|
||||
ip: m.ip,
|
||||
hostname: m.hostname,
|
||||
deployStatus: m.deployStatus
|
||||
}))
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
return (
|
||||
<form onSubmit={handleSubmit} className="space-y-6">
|
||||
<div className="text-center py-12">
|
||||
<h3 className="text-lg font-medium text-gray-900 mb-2">
|
||||
Service Deployment
|
||||
</h3>
|
||||
<p className="text-gray-600">
|
||||
Deploy and configure BZZZ services with monitoring and health checks.
|
||||
</p>
|
||||
<div className="mt-8">
|
||||
<div className="bg-yellow-50 border border-yellow-200 rounded-lg p-4 text-yellow-800">
|
||||
This component is under development. Service deployment will be implemented here.
|
||||
|
||||
{/* OS Support Caution */}
|
||||
<div className="bg-yellow-50 border border-yellow-200 rounded-lg p-4">
|
||||
<div className="flex items-start">
|
||||
<ExclamationTriangleIcon className="h-5 w-5 text-yellow-600 mt-0.5 mr-3 flex-shrink-0" />
|
||||
<div>
|
||||
<h3 className="text-sm font-medium text-yellow-800">Operating System Support</h3>
|
||||
<p className="text-sm text-yellow-700 mt-1">
|
||||
CHORUS:agents automated deployment supports <strong>Linux distributions that use systemd by default</strong> (Ubuntu 16+, CentOS 7+, Debian 8+, RHEL 7+, etc.).
|
||||
For other operating systems or init systems, you'll need to manually deploy the CHORUS:agents binary and configure services on your cluster.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Network Discovery */}
|
||||
<div className="card">
|
||||
<div className="flex items-center justify-between mb-4">
|
||||
<h3 className="text-lg font-medium text-gray-900 flex items-center">
|
||||
<ServerIcon className="h-6 w-6 text-bzzz-primary mr-2" />
|
||||
Machine Discovery
|
||||
</h3>
|
||||
<button
|
||||
type="button"
|
||||
onClick={discoverMachines}
|
||||
disabled={isDiscovering}
|
||||
className="btn-outline flex items-center"
|
||||
>
|
||||
<ArrowPathIcon className={`h-4 w-4 mr-2 ${isDiscovering ? 'animate-spin' : ''}`} />
|
||||
{isDiscovering ? 'Discovering...' : 'Discover Machines'}
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<p className="text-sm text-gray-600 mb-4">
|
||||
Scan network subnet: {configData?.network?.allowedIPs?.[0] || '192.168.1.0/24'}
|
||||
</p>
|
||||
|
||||
{/* Discovery Progress */}
|
||||
{isDiscovering && (
|
||||
<div className="mb-4">
|
||||
<div className="flex items-center justify-between mb-2">
|
||||
<span className="text-sm font-medium text-gray-700">{discoveryStatus}</span>
|
||||
<span className="text-sm text-gray-500">{discoveryProgress}%</span>
|
||||
</div>
|
||||
<div className="w-full bg-gray-200 rounded-full h-2">
|
||||
<div
|
||||
className="bg-bzzz-primary h-2 rounded-full transition-all duration-300 ease-out"
|
||||
style={{ width: `${discoveryProgress}%` }}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
|
||||
{/* Machine Table */}
|
||||
<div className="card">
|
||||
<div className="flex items-center justify-between mb-4">
|
||||
<h3 className="text-lg font-medium text-gray-900">Cluster Machines</h3>
|
||||
<button
|
||||
type="button"
|
||||
onClick={deployToSelected}
|
||||
disabled={machines.filter(m => m.selected && m.sshStatus === 'connected').length === 0}
|
||||
className="btn-primary flex items-center"
|
||||
>
|
||||
<CloudArrowDownIcon className="h-4 w-4 mr-2" />
|
||||
Deploy to Selected
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div className="overflow-x-auto">
|
||||
<table className="min-w-full divide-y divide-gray-200">
|
||||
<thead className="bg-gray-50">
|
||||
<tr>
|
||||
<th className="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">
|
||||
Select
|
||||
</th>
|
||||
<th className="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">
|
||||
Machine
|
||||
</th>
|
||||
<th className="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">
|
||||
Operating System
|
||||
</th>
|
||||
<th className="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">
|
||||
IP Address
|
||||
</th>
|
||||
<th className="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">
|
||||
SSH Status
|
||||
</th>
|
||||
<th className="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">
|
||||
Deploy Status
|
||||
</th>
|
||||
<th className="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">
|
||||
Actions
|
||||
</th>
|
||||
<th className="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">
|
||||
Remove
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody className="bg-white divide-y divide-gray-200">
|
||||
{machines.map((machine) => (
|
||||
<tr key={machine.id} className={machine.selected ? 'bg-blue-50' : ''}>
|
||||
<td className="px-6 py-4 whitespace-nowrap">
|
||||
<input
|
||||
type="checkbox"
|
||||
checked={machine.selected}
|
||||
onChange={() => toggleMachineSelection(machine.id)}
|
||||
className="h-4 w-4 text-bzzz-primary focus:ring-bzzz-primary border-gray-300 rounded"
|
||||
/>
|
||||
</td>
|
||||
<td className="px-6 py-4 whitespace-nowrap">
|
||||
<div>
|
||||
<div className="text-sm font-medium text-gray-900">{machine.hostname}</div>
|
||||
{machine.systemInfo && (
|
||||
<div className="text-xs text-gray-500">
|
||||
{machine.systemInfo.cpu} cores • {machine.systemInfo.memory}GB RAM • {machine.systemInfo.disk}GB disk
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</td>
|
||||
<td className="px-6 py-4 whitespace-nowrap">
|
||||
<div className="text-sm text-gray-900">{machine.os}</div>
|
||||
<div className="text-xs text-gray-500">{machine.osVersion}</div>
|
||||
</td>
|
||||
<td className="px-6 py-4 whitespace-nowrap text-sm text-gray-900">
|
||||
{machine.ip}
|
||||
</td>
|
||||
<td className="px-6 py-4 whitespace-nowrap">
|
||||
<div className="flex items-center">
|
||||
{getStatusIcon(machine.sshStatus)}
|
||||
<span className="ml-2 text-sm text-gray-900 capitalize">
|
||||
{machine.sshStatus.replace('_', ' ')}
|
||||
</span>
|
||||
</div>
|
||||
</td>
|
||||
<td className="px-6 py-4 whitespace-nowrap">
|
||||
<div className="flex items-center">
|
||||
{getStatusIcon(machine.deployStatus)}
|
||||
<div className="ml-2 flex-1">
|
||||
<div className="text-sm text-gray-900 capitalize">
|
||||
{machine.deployStatus.replace('_', ' ')}
|
||||
</div>
|
||||
{machine.deployStatus === 'installing' && (
|
||||
<div className="mt-1">
|
||||
<div className="text-xs text-gray-500 mb-1">
|
||||
{machine.deployStep || 'Deploying...'}
|
||||
</div>
|
||||
<div className="w-full bg-gray-200 rounded-full h-2">
|
||||
<div
|
||||
className="bg-blue-500 h-2 rounded-full transition-all duration-300"
|
||||
style={{ width: `${machine.deployProgress || 0}%` }}
|
||||
/>
|
||||
</div>
|
||||
<div className="text-xs text-gray-500 mt-1">
|
||||
{machine.deployProgress || 0}%
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
<td className="px-6 py-4 whitespace-nowrap text-sm font-medium space-x-2">
|
||||
{machine.id !== 'localhost' && machine.sshStatus !== 'connected' && (
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => testSSHConnection(machine.id)}
|
||||
className="text-blue-600 hover:text-blue-900"
|
||||
disabled={machine.sshStatus === 'testing'}
|
||||
>
|
||||
Test SSH
|
||||
</button>
|
||||
)}
|
||||
|
||||
{machine.sshStatus === 'connected' && machine.deployStatus === 'not_deployed' && (
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => deployToMachine(machine.id)}
|
||||
className="text-green-600 hover:text-green-900"
|
||||
>
|
||||
Install
|
||||
</button>
|
||||
)}
|
||||
|
||||
{machine.deployStatus !== 'not_deployed' && (
|
||||
<>
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => setShowLogs(machine.id)}
|
||||
className="text-gray-600 hover:text-gray-900 mr-2"
|
||||
title="View deployment logs"
|
||||
>
|
||||
<DocumentTextIcon className="h-4 w-4 inline" />
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => setShowConsole(machine.id)}
|
||||
className="text-blue-600 hover:text-blue-900"
|
||||
title="Open deployment console"
|
||||
>
|
||||
<ComputerDesktopIcon className="h-4 w-4 inline" />
|
||||
</button>
|
||||
</>
|
||||
)}
|
||||
</td>
|
||||
<td className="px-6 py-4 whitespace-nowrap text-sm font-medium">
|
||||
{machine.id !== 'localhost' && (
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => removeMachine(machine.id)}
|
||||
className="text-red-600 hover:text-red-900 p-1 rounded hover:bg-red-50"
|
||||
title="Remove machine"
|
||||
>
|
||||
<XMarkIcon className="h-4 w-4" />
|
||||
</button>
|
||||
)}
|
||||
</td>
|
||||
</tr>
|
||||
))}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
{machines.length === 0 && (
|
||||
<div className="text-center py-8">
|
||||
<ServerIcon className="h-12 w-12 text-gray-400 mx-auto mb-4" />
|
||||
<p className="text-gray-500">No machines discovered yet. Click "Discover Machines" to scan your network.</p>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
|
||||
{/* Deployment Configuration */}
|
||||
<div className="card">
|
||||
<h3 className="text-lg font-medium text-gray-900 mb-4 flex items-center">
|
||||
<Cog6ToothIcon className="h-6 w-6 text-bzzz-primary mr-2" />
|
||||
Deployment Configuration
|
||||
</h3>
|
||||
|
||||
<div className="grid grid-cols-1 md:grid-cols-2 gap-4">
|
||||
<div>
|
||||
<label className="flex items-center">
|
||||
<input
|
||||
type="checkbox"
|
||||
checked={config.autoStart}
|
||||
onChange={(e) => setConfig(prev => ({ ...prev, autoStart: e.target.checked }))}
|
||||
className="mr-2"
|
||||
/>
|
||||
Auto-start services after deployment
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label className="block text-sm font-medium text-gray-700 mb-2">
|
||||
Health Check Interval (seconds)
|
||||
</label>
|
||||
<input
|
||||
type="number"
|
||||
value={config.healthCheckInterval}
|
||||
onChange={(e) => setConfig(prev => ({ ...prev, healthCheckInterval: parseInt(e.target.value) }))}
|
||||
min="10"
|
||||
max="300"
|
||||
className="input-field"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Logs Modal */}
|
||||
{showLogs && (
|
||||
<div className="fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50">
|
||||
<div className="bg-white rounded-lg p-6 max-w-2xl w-full max-h-96 overflow-auto">
|
||||
<div className="flex justify-between items-center mb-4">
|
||||
<h3 className="text-lg font-medium">Deployment Logs - {machines.find(m => m.id === showLogs)?.hostname}</h3>
|
||||
<button onClick={() => setShowLogs(null)} className="text-gray-400 hover:text-gray-600">
|
||||
✕
|
||||
</button>
|
||||
</div>
|
||||
<div className="bg-gray-900 text-green-400 p-4 rounded font-mono text-sm max-h-64 overflow-y-auto">
|
||||
{deploymentLogs[showLogs]?.map((log, index) => (
|
||||
<div key={index}>{log}</div>
|
||||
)) || <div>No logs available</div>}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* Virtual Console Modal */}
|
||||
{showConsole && (
|
||||
<div className="fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50">
|
||||
<div className="bg-gray-900 rounded-lg overflow-hidden max-w-4xl w-full max-h-[80vh] flex flex-col">
|
||||
<div className="bg-gray-800 px-4 py-3 flex justify-between items-center border-b border-gray-700">
|
||||
<div className="flex items-center">
|
||||
<ComputerDesktopIcon className="h-5 w-5 text-green-400 mr-2" />
|
||||
<h3 className="text-lg font-medium text-white">
|
||||
SSH Console - {machines.find(m => m.id === showConsole)?.hostname}
|
||||
</h3>
|
||||
<span className="ml-2 text-sm text-gray-400">
|
||||
({machines.find(m => m.id === showConsole)?.ip})
|
||||
</span>
|
||||
</div>
|
||||
<div className="flex items-center space-x-2">
|
||||
<div className="flex items-center space-x-1">
|
||||
<div className="w-2 h-2 bg-red-500 rounded-full"></div>
|
||||
<div className="w-2 h-2 bg-yellow-500 rounded-full"></div>
|
||||
<div className="w-2 h-2 bg-green-500 rounded-full"></div>
|
||||
</div>
|
||||
<button
|
||||
onClick={() => setShowConsole(null)}
|
||||
className="text-gray-400 hover:text-white ml-4"
|
||||
>
|
||||
✕
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div className="flex-1 p-4 font-mono text-sm overflow-y-auto bg-gray-900">
|
||||
<div className="text-green-400 space-y-1">
|
||||
{consoleLogs[showConsole]?.length > 0 ? (
|
||||
consoleLogs[showConsole].map((log, index) => (
|
||||
<div key={index} className="whitespace-pre-wrap">{log}</div>
|
||||
))
|
||||
) : (
|
||||
<div className="text-gray-500">Waiting for deployment to start...</div>
|
||||
)}
|
||||
{/* Blinking cursor */}
|
||||
<div className="inline-block w-2 h-4 bg-green-400 animate-pulse"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div className="bg-gray-800 px-4 py-2 border-t border-gray-700">
|
||||
<div className="text-xs text-gray-400">
|
||||
💡 This console shows real-time deployment progress and SSH operations
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
|
||||
<div className="flex justify-between pt-6 border-t border-gray-200">
|
||||
<div>
|
||||
{onBack && (
|
||||
|
||||
@@ -12,56 +12,33 @@ import {
|
||||
} from '@heroicons/react/24/outline'
|
||||
|
||||
interface SystemInfo {
|
||||
hostname: string
|
||||
os: {
|
||||
os: string
|
||||
architecture: string
|
||||
cpu_cores: number
|
||||
memory_mb: number
|
||||
gpus: Array<{
|
||||
name: string
|
||||
version: string
|
||||
arch: string
|
||||
}
|
||||
hardware: {
|
||||
cpu: {
|
||||
cores: number
|
||||
model: string
|
||||
}
|
||||
memory: {
|
||||
total: number
|
||||
available: number
|
||||
}
|
||||
storage: {
|
||||
total: number
|
||||
available: number
|
||||
}
|
||||
gpus: Array<{
|
||||
type: string
|
||||
name: string
|
||||
memory: number
|
||||
}>
|
||||
}
|
||||
memory: string
|
||||
driver: string
|
||||
type: string
|
||||
}>
|
||||
network: {
|
||||
interfaces: Array<{
|
||||
name: string
|
||||
ip: string
|
||||
mac: string
|
||||
speed: string
|
||||
status: string
|
||||
}>
|
||||
primary_interface: string
|
||||
primary_ip: string
|
||||
hostname: string
|
||||
interfaces: string[]
|
||||
public_ip?: string
|
||||
private_ips: string[]
|
||||
docker_bridge?: string
|
||||
}
|
||||
software: {
|
||||
docker: {
|
||||
installed: boolean
|
||||
version?: string
|
||||
}
|
||||
ollama: {
|
||||
installed: boolean
|
||||
type?: 'ollama' | 'parallama'
|
||||
version?: string
|
||||
}
|
||||
bzzz: {
|
||||
installed: boolean
|
||||
version?: string
|
||||
}
|
||||
storage: {
|
||||
total_space_gb: number
|
||||
free_space_gb: number
|
||||
mount_path: string
|
||||
}
|
||||
docker: {
|
||||
available: boolean
|
||||
version?: string
|
||||
compose_available: boolean
|
||||
swarm_mode: boolean
|
||||
}
|
||||
}
|
||||
|
||||
@@ -93,10 +70,10 @@ export default function SystemDetection({
|
||||
const refreshSystemInfo = async () => {
|
||||
setRefreshing(true)
|
||||
try {
|
||||
const response = await fetch('/api/system/detect')
|
||||
const response = await fetch('/api/setup/system')
|
||||
if (response.ok) {
|
||||
const info = await response.json()
|
||||
setDetectedInfo(info)
|
||||
const result = await response.json()
|
||||
setDetectedInfo(result.system_info)
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('Failed to detect system info:', error)
|
||||
@@ -115,13 +92,6 @@ export default function SystemDetection({
|
||||
}
|
||||
}
|
||||
|
||||
const formatMemory = (bytes: number) => {
|
||||
return `${Math.round(bytes / (1024 ** 3))} GB`
|
||||
}
|
||||
|
||||
const formatStorage = (bytes: number) => {
|
||||
return `${Math.round(bytes / (1024 ** 3))} GB`
|
||||
}
|
||||
|
||||
const getStatusColor = (condition: boolean) => {
|
||||
return condition ? 'text-green-600' : 'text-red-600'
|
||||
@@ -181,12 +151,12 @@ export default function SystemDetection({
|
||||
<div className="grid grid-cols-1 md:grid-cols-2 gap-4">
|
||||
<div>
|
||||
<div className="text-sm font-medium text-gray-700">Hostname</div>
|
||||
<div className="text-lg text-gray-900">{detectedInfo.hostname}</div>
|
||||
<div className="text-lg text-gray-900">{detectedInfo.network.hostname}</div>
|
||||
</div>
|
||||
<div>
|
||||
<div className="text-sm font-medium text-gray-700">Operating System</div>
|
||||
<div className="text-lg text-gray-900">
|
||||
{detectedInfo.os.name} {detectedInfo.os.version} ({detectedInfo.os.arch})
|
||||
{detectedInfo.os} ({detectedInfo.architecture})
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -205,14 +175,13 @@ export default function SystemDetection({
|
||||
<div>
|
||||
<div className="text-sm font-medium text-gray-700">CPU</div>
|
||||
<div className="text-gray-900">
|
||||
{detectedInfo.hardware.cpu.cores} cores - {detectedInfo.hardware.cpu.model}
|
||||
{detectedInfo.cpu_cores} cores
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<div className="text-sm font-medium text-gray-700">Memory</div>
|
||||
<div className="text-gray-900">
|
||||
{formatMemory(detectedInfo.hardware.memory.total)} total, {' '}
|
||||
{formatMemory(detectedInfo.hardware.memory.available)} available
|
||||
{Math.round(detectedInfo.memory_mb / 1024)} GB total
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -229,15 +198,15 @@ export default function SystemDetection({
|
||||
<div>
|
||||
<div className="text-sm font-medium text-gray-700">Disk Space</div>
|
||||
<div className="text-gray-900">
|
||||
{formatStorage(detectedInfo.hardware.storage.total)} total, {' '}
|
||||
{formatStorage(detectedInfo.hardware.storage.available)} available
|
||||
{detectedInfo.storage.total_space_gb} GB total, {' '}
|
||||
{detectedInfo.storage.free_space_gb} GB available
|
||||
</div>
|
||||
</div>
|
||||
<div className="w-full bg-gray-200 rounded-full h-2">
|
||||
<div
|
||||
className="bg-bzzz-primary h-2 rounded-full"
|
||||
style={{
|
||||
width: `${((detectedInfo.hardware.storage.total - detectedInfo.hardware.storage.available) / detectedInfo.hardware.storage.total) * 100}%`
|
||||
width: `${((detectedInfo.storage.total_space_gb - detectedInfo.storage.free_space_gb) / detectedInfo.storage.total_space_gb) * 100}%`
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
@@ -246,21 +215,21 @@ export default function SystemDetection({
|
||||
</div>
|
||||
|
||||
{/* GPU Information */}
|
||||
{detectedInfo.hardware.gpus.length > 0 && (
|
||||
{detectedInfo.gpus && detectedInfo.gpus.length > 0 && (
|
||||
<div className="bg-white border border-gray-200 rounded-lg p-6">
|
||||
<div className="flex items-center mb-4">
|
||||
<ServerIcon className="h-6 w-6 text-bzzz-primary mr-2" />
|
||||
<h3 className="text-lg font-medium text-gray-900">
|
||||
GPU Configuration ({detectedInfo.hardware.gpus.length} GPU{detectedInfo.hardware.gpus.length !== 1 ? 's' : ''})
|
||||
GPU Configuration ({detectedInfo.gpus.length} GPU{detectedInfo.gpus.length !== 1 ? 's' : ''})
|
||||
</h3>
|
||||
</div>
|
||||
|
||||
<div className="grid grid-cols-1 md:grid-cols-2 gap-4">
|
||||
{detectedInfo.hardware.gpus.map((gpu, index) => (
|
||||
{detectedInfo.gpus.map((gpu, index) => (
|
||||
<div key={index} className="bg-gray-50 rounded-lg p-4">
|
||||
<div className="font-medium text-gray-900">{gpu.name}</div>
|
||||
<div className="text-sm text-gray-600">
|
||||
{gpu.type.toUpperCase()} • {Math.round(gpu.memory / (1024 ** 3))} GB VRAM
|
||||
{gpu.type.toUpperCase()} • {gpu.memory} • {gpu.driver}
|
||||
</div>
|
||||
</div>
|
||||
))}
|
||||
@@ -277,30 +246,30 @@ export default function SystemDetection({
|
||||
|
||||
<div className="space-y-3">
|
||||
<div>
|
||||
<div className="text-sm font-medium text-gray-700">Primary Interface</div>
|
||||
<div className="text-gray-900">
|
||||
{detectedInfo.network.primary_interface} ({detectedInfo.network.primary_ip})
|
||||
</div>
|
||||
<div className="text-sm font-medium text-gray-700">Hostname</div>
|
||||
<div className="text-gray-900">{detectedInfo.network.hostname}</div>
|
||||
</div>
|
||||
|
||||
{detectedInfo.network.interfaces.length > 1 && (
|
||||
{detectedInfo.network.private_ips && detectedInfo.network.private_ips.length > 0 && (
|
||||
<div>
|
||||
<div className="text-sm font-medium text-gray-700 mb-2">All Interfaces</div>
|
||||
<div className="text-sm font-medium text-gray-700 mb-2">Private IP Addresses</div>
|
||||
<div className="space-y-2">
|
||||
{detectedInfo.network.interfaces.map((interface_, index) => (
|
||||
{detectedInfo.network.private_ips.map((ip, index) => (
|
||||
<div key={index} className="flex justify-between items-center text-sm">
|
||||
<span>{interface_.name}</span>
|
||||
<span className="text-gray-600">{interface_.ip}</span>
|
||||
<span className={`status-indicator ${
|
||||
interface_.status === 'up' ? 'status-online' : 'status-offline'
|
||||
}`}>
|
||||
{interface_.status}
|
||||
</span>
|
||||
<span>{ip}</span>
|
||||
<span className="status-indicator status-online">active</span>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{detectedInfo.network.public_ip && (
|
||||
<div>
|
||||
<div className="text-sm font-medium text-gray-700">Public IP</div>
|
||||
<div className="text-gray-900">{detectedInfo.network.public_ip}</div>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -312,21 +281,21 @@ export default function SystemDetection({
|
||||
{[
|
||||
{
|
||||
name: 'Docker',
|
||||
installed: detectedInfo.software.docker.installed,
|
||||
version: detectedInfo.software.docker.version,
|
||||
installed: detectedInfo.docker.available,
|
||||
version: detectedInfo.docker.version,
|
||||
required: true
|
||||
},
|
||||
{
|
||||
name: detectedInfo.software.ollama.type === 'parallama' ? 'Parallama' : 'Ollama',
|
||||
installed: detectedInfo.software.ollama.installed,
|
||||
version: detectedInfo.software.ollama.version,
|
||||
name: 'Docker Compose',
|
||||
installed: detectedInfo.docker.compose_available,
|
||||
version: undefined,
|
||||
required: false
|
||||
},
|
||||
{
|
||||
name: 'BZZZ',
|
||||
installed: detectedInfo.software.bzzz.installed,
|
||||
version: detectedInfo.software.bzzz.version,
|
||||
required: true
|
||||
name: 'Docker Swarm',
|
||||
installed: detectedInfo.docker.swarm_mode,
|
||||
version: undefined,
|
||||
required: false
|
||||
}
|
||||
].map((software, index) => {
|
||||
const StatusIcon = getStatusIcon(software.installed)
|
||||
@@ -365,20 +334,16 @@ export default function SystemDetection({
|
||||
{[
|
||||
{
|
||||
check: 'Minimum memory (2GB required)',
|
||||
passed: detectedInfo.hardware.memory.total >= 2 * 1024 ** 3,
|
||||
warning: detectedInfo.hardware.memory.total < 4 * 1024 ** 3
|
||||
passed: detectedInfo.memory_mb >= 2048,
|
||||
warning: detectedInfo.memory_mb < 4096
|
||||
},
|
||||
{
|
||||
check: 'Available disk space (10GB required)',
|
||||
passed: detectedInfo.hardware.storage.available >= 10 * 1024 ** 3
|
||||
passed: detectedInfo.storage.free_space_gb >= 10
|
||||
},
|
||||
{
|
||||
check: 'Docker installed and running',
|
||||
passed: detectedInfo.software.docker.installed
|
||||
},
|
||||
{
|
||||
check: 'BZZZ binaries installed',
|
||||
passed: detectedInfo.software.bzzz.installed
|
||||
passed: detectedInfo.docker.available
|
||||
}
|
||||
].map((validation, index) => {
|
||||
const StatusIcon = getStatusIcon(validation.passed)
|
||||
@@ -427,9 +392,9 @@ export default function SystemDetection({
|
||||
<button
|
||||
onClick={handleContinue}
|
||||
className="btn-primary"
|
||||
disabled={!detectedInfo.software.docker.installed || !detectedInfo.software.bzzz.installed}
|
||||
disabled={!detectedInfo.docker.available}
|
||||
>
|
||||
{isCompleted ? 'Continue' : 'Next: Network Configuration'}
|
||||
{isCompleted ? 'Continue' : 'Next: Repository Setup'}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
181
install/config-ui/app/setup/components/TermsAndConditions.tsx
Normal file
181
install/config-ui/app/setup/components/TermsAndConditions.tsx
Normal file
@@ -0,0 +1,181 @@
|
||||
'use client'
|
||||
|
||||
import { useState } from 'react'
|
||||
import {
|
||||
DocumentTextIcon,
|
||||
CheckCircleIcon,
|
||||
ExclamationTriangleIcon
|
||||
} from '@heroicons/react/24/outline'
|
||||
|
||||
interface TermsAndConditionsProps {
|
||||
systemInfo: any
|
||||
configData: any
|
||||
onComplete: (data: any) => void
|
||||
onBack?: () => void
|
||||
isCompleted: boolean
|
||||
}
|
||||
|
||||
export default function TermsAndConditions({
|
||||
systemInfo,
|
||||
configData,
|
||||
onComplete,
|
||||
onBack,
|
||||
isCompleted
|
||||
}: TermsAndConditionsProps) {
|
||||
const [agreed, setAgreed] = useState(configData?.terms?.agreed || false)
|
||||
const [error, setError] = useState('')
|
||||
|
||||
const handleSubmit = (e: React.FormEvent) => {
|
||||
e.preventDefault()
|
||||
|
||||
if (!agreed) {
|
||||
setError('You must agree to the Terms and Conditions to continue')
|
||||
return
|
||||
}
|
||||
|
||||
setError('')
|
||||
onComplete({
|
||||
terms: {
|
||||
agreed: true,
|
||||
timestamp: new Date().toISOString()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
return (
|
||||
<form onSubmit={handleSubmit} className="space-y-8">
|
||||
|
||||
{/* Terms and Conditions Content */}
|
||||
<div className="card">
|
||||
<div className="flex items-center mb-4">
|
||||
<DocumentTextIcon className="h-6 w-6 text-bzzz-primary mr-2" />
|
||||
<h3 className="text-lg font-medium text-gray-900">CHORUS:agents Software License Agreement</h3>
|
||||
</div>
|
||||
|
||||
<div className="bg-gray-50 border border-gray-200 rounded-lg p-6 max-h-96 overflow-y-auto">
|
||||
<div className="prose prose-sm max-w-none text-gray-700">
|
||||
<h4 className="text-base font-semibold text-gray-900 mb-3">1. License Grant</h4>
|
||||
<p className="mb-4">
|
||||
Subject to the terms and conditions of this Agreement, Chorus Services grants you a non-exclusive,
|
||||
non-transferable license to use CHORUS:agents (the "Software") for distributed AI coordination and task management.
|
||||
</p>
|
||||
|
||||
<h4 className="text-base font-semibold text-gray-900 mb-3">2. Permitted Uses</h4>
|
||||
<ul className="list-disc list-inside mb-4 space-y-1">
|
||||
<li>Install and operate CHORUS:agents on your infrastructure</li>
|
||||
<li>Configure cluster nodes for distributed processing</li>
|
||||
<li>Integrate with supported AI models and services</li>
|
||||
<li>Use for commercial and non-commercial purposes</li>
|
||||
</ul>
|
||||
|
||||
<h4 className="text-base font-semibold text-gray-900 mb-3">3. Restrictions</h4>
|
||||
<ul className="list-disc list-inside mb-4 space-y-1">
|
||||
<li>You may not redistribute, sublicense, or sell the Software</li>
|
||||
<li>You may not reverse engineer or decompile the Software</li>
|
||||
<li>You may not use the Software for illegal or harmful purposes</li>
|
||||
<li>You may not remove or modify proprietary notices</li>
|
||||
</ul>
|
||||
|
||||
<h4 className="text-base font-semibold text-gray-900 mb-3">4. Data Privacy</h4>
|
||||
<p className="mb-4">
|
||||
CHORUS:agents processes data locally on your infrastructure. Chorus Services does not collect or store
|
||||
your operational data. Telemetry data may be collected for software improvement purposes.
|
||||
</p>
|
||||
|
||||
<h4 className="text-base font-semibold text-gray-900 mb-3">5. Support and Updates</h4>
|
||||
<p className="mb-4">
|
||||
Licensed users receive access to software updates, security patches, and community support.
|
||||
Premium support tiers are available separately.
|
||||
</p>
|
||||
|
||||
<h4 className="text-base font-semibold text-gray-900 mb-3">6. Disclaimer of Warranty</h4>
|
||||
<p className="mb-4">
|
||||
THE SOFTWARE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. CHORUS SERVICES DISCLAIMS
|
||||
ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
FOR A PARTICULAR PURPOSE.
|
||||
</p>
|
||||
|
||||
<h4 className="text-base font-semibold text-gray-900 mb-3">7. Limitation of Liability</h4>
|
||||
<p className="mb-4">
|
||||
IN NO EVENT SHALL CHORUS SERVICES BE LIABLE FOR ANY INDIRECT, INCIDENTAL, SPECIAL,
|
||||
OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OF THE SOFTWARE.
|
||||
</p>
|
||||
|
||||
<h4 className="text-base font-semibold text-gray-900 mb-3">8. Termination</h4>
|
||||
<p className="mb-4">
|
||||
This license is effective until terminated. You may terminate it at any time by
|
||||
uninstalling the Software. Chorus Services may terminate this license if you
|
||||
violate any terms of this Agreement.
|
||||
</p>
|
||||
|
||||
<div className="bg-blue-50 border-l-4 border-blue-400 p-4 mt-6">
|
||||
<div className="flex">
|
||||
<ExclamationTriangleIcon className="h-5 w-5 text-blue-500 mt-0.5 mr-2" />
|
||||
<div className="text-sm text-blue-700">
|
||||
<p><strong>Contact Information:</strong></p>
|
||||
<p>Chorus Services<br />
|
||||
Email: legal@chorus.services<br />
|
||||
Website: https://chorus.services</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Agreement Checkbox */}
|
||||
<div className="card">
|
||||
<div className="space-y-4">
|
||||
<label className="flex items-start">
|
||||
<input
|
||||
type="checkbox"
|
||||
checked={agreed}
|
||||
onChange={(e) => setAgreed(e.target.checked)}
|
||||
className="mt-1 mr-3 h-4 w-4 text-bzzz-primary border-gray-300 rounded focus:ring-bzzz-primary"
|
||||
/>
|
||||
<div className="text-sm">
|
||||
<span className="font-medium text-gray-900">
|
||||
I have read and agree to the Terms and Conditions
|
||||
</span>
|
||||
<p className="text-gray-600 mt-1">
|
||||
By checking this box, you acknowledge that you have read, understood, and agree to be
|
||||
bound by the terms and conditions outlined above.
|
||||
</p>
|
||||
</div>
|
||||
</label>
|
||||
|
||||
{error && (
|
||||
<div className="flex items-center text-red-600 text-sm">
|
||||
<ExclamationTriangleIcon className="h-4 w-4 mr-1" />
|
||||
{error}
|
||||
</div>
|
||||
)}
|
||||
|
||||
{agreed && (
|
||||
<div className="flex items-center text-green-600 text-sm">
|
||||
<CheckCircleIcon className="h-4 w-4 mr-1" />
|
||||
Thank you for accepting the terms and conditions
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="flex justify-between pt-6 border-t border-gray-200">
|
||||
<div>
|
||||
{onBack && (
|
||||
<button type="button" onClick={onBack} className="btn-outline">
|
||||
Back
|
||||
</button>
|
||||
)}
|
||||
</div>
|
||||
<button
|
||||
type="submit"
|
||||
disabled={!agreed}
|
||||
className={`${agreed ? 'btn-primary' : 'btn-disabled'}`}
|
||||
>
|
||||
{isCompleted ? 'Continue' : 'Next: License Validation'}
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
)
|
||||
}
|
||||
@@ -32,6 +32,32 @@ export default function TestingValidation({
|
||||
})
|
||||
}
|
||||
|
||||
const getClusterDashboardUrl = () => {
|
||||
// Get the WebUI port from config, default to 9090
|
||||
const webuiPort = configData?.network?.ports?.webui || 9090
|
||||
return `http://localhost:${webuiPort}/dashboard`
|
||||
}
|
||||
|
||||
const handleGoToDashboard = () => {
|
||||
const dashboardUrl = getClusterDashboardUrl()
|
||||
|
||||
// Clear setup state since we're done
|
||||
localStorage.removeItem('bzzz-setup-state')
|
||||
|
||||
// Open cluster dashboard in new tab
|
||||
window.open(dashboardUrl, '_blank')
|
||||
|
||||
// Show completion message and suggest closing this tab
|
||||
const shouldClose = window.confirm(
|
||||
'Setup complete! The cluster dashboard has opened in a new tab.\n\n' +
|
||||
'You can now close this setup tab. Click OK to close automatically, or Cancel to keep it open.'
|
||||
)
|
||||
|
||||
if (shouldClose) {
|
||||
window.close()
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="space-y-6">
|
||||
<div className="text-center py-12">
|
||||
@@ -65,14 +91,22 @@ export default function TestingValidation({
|
||||
🎉 Setup Complete!
|
||||
</h4>
|
||||
<p className="text-green-700 mb-4">
|
||||
Your BZZZ cluster has been successfully configured and validated.
|
||||
Your CHORUS:agents cluster has been successfully configured and deployed.
|
||||
</p>
|
||||
<div className="space-y-2 text-sm text-green-600">
|
||||
<div className="space-y-2 text-sm text-green-600 mb-4">
|
||||
<div>✓ System configuration validated</div>
|
||||
<div>✓ Network connectivity tested</div>
|
||||
<div>✓ AI services configured</div>
|
||||
<div>✓ Services deployed to all nodes</div>
|
||||
<div>✓ Cluster formation completed</div>
|
||||
</div>
|
||||
<div className="bg-blue-50 border border-blue-200 rounded-lg p-4">
|
||||
<p className="text-sm text-blue-800">
|
||||
<strong>Cluster Dashboard:</strong> <code>{getClusterDashboardUrl()}</code>
|
||||
</p>
|
||||
<p className="text-xs text-blue-600 mt-1">
|
||||
The setup process will be terminated and you'll be redirected to your operational cluster.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
@@ -87,9 +121,9 @@ export default function TestingValidation({
|
||||
</div>
|
||||
|
||||
{isCompleted && (
|
||||
<a href="/dashboard" className="btn-primary">
|
||||
Go to Dashboard
|
||||
</a>
|
||||
<button onClick={handleGoToDashboard} className="btn-primary">
|
||||
Go to Cluster Dashboard
|
||||
</button>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -2,22 +2,42 @@
|
||||
|
||||
import { useState, useEffect } from 'react'
|
||||
import { ChevronRightIcon, CheckCircleIcon } from '@heroicons/react/24/outline'
|
||||
import TermsAndConditions from './components/TermsAndConditions'
|
||||
import LicenseValidation from './components/LicenseValidation'
|
||||
import SystemDetection from './components/SystemDetection'
|
||||
import RepositoryConfiguration from './components/RepositoryConfiguration'
|
||||
import NetworkConfiguration from './components/NetworkConfiguration'
|
||||
import SecuritySetup from './components/SecuritySetup'
|
||||
import AIConfiguration from './components/AIConfiguration'
|
||||
import ResourceAllocation from './components/ResourceAllocation'
|
||||
import ServiceDeployment from './components/ServiceDeployment'
|
||||
import ClusterFormation from './components/ClusterFormation'
|
||||
import TestingValidation from './components/TestingValidation'
|
||||
|
||||
const SETUP_STEPS = [
|
||||
{
|
||||
id: 'terms',
|
||||
title: 'Terms & Conditions',
|
||||
description: 'Review and accept the software license agreement',
|
||||
component: TermsAndConditions,
|
||||
},
|
||||
{
|
||||
id: 'license',
|
||||
title: 'License Validation',
|
||||
description: 'Validate your CHORUS license key and email',
|
||||
component: LicenseValidation,
|
||||
},
|
||||
{
|
||||
id: 'detection',
|
||||
title: 'System Detection',
|
||||
description: 'Detect hardware and validate installation',
|
||||
component: SystemDetection,
|
||||
},
|
||||
{
|
||||
id: 'repository',
|
||||
title: 'Repository Setup',
|
||||
description: 'Configure Git repository for task management',
|
||||
component: RepositoryConfiguration,
|
||||
},
|
||||
{
|
||||
id: 'network',
|
||||
title: 'Network Configuration',
|
||||
@@ -36,22 +56,16 @@ const SETUP_STEPS = [
|
||||
description: 'Configure OpenAI and Ollama/Parallama',
|
||||
component: AIConfiguration,
|
||||
},
|
||||
{
|
||||
id: 'resources',
|
||||
title: 'Resource Allocation',
|
||||
description: 'Allocate CPU, memory, and storage',
|
||||
component: ResourceAllocation,
|
||||
},
|
||||
{
|
||||
id: 'deployment',
|
||||
title: 'Service Deployment',
|
||||
description: 'Deploy and configure BZZZ services',
|
||||
description: 'Deploy and configure CHORUS agent services',
|
||||
component: ServiceDeployment,
|
||||
},
|
||||
{
|
||||
id: 'cluster',
|
||||
title: 'Cluster Formation',
|
||||
description: 'Join or create BZZZ cluster',
|
||||
description: 'Join or create CHORUS agent cluster',
|
||||
component: ClusterFormation,
|
||||
},
|
||||
{
|
||||
@@ -72,17 +86,63 @@ export default function SetupPage() {
|
||||
const [configData, setConfigData] = useState<ConfigData>({})
|
||||
const [systemInfo, setSystemInfo] = useState<any>(null)
|
||||
|
||||
// Load system information on mount
|
||||
// Load persisted data and system information on mount
|
||||
useEffect(() => {
|
||||
loadPersistedData()
|
||||
fetchSystemInfo()
|
||||
}, [])
|
||||
|
||||
// Save setup state to localStorage whenever it changes
|
||||
useEffect(() => {
|
||||
saveSetupState()
|
||||
}, [currentStep, completedSteps, configData])
|
||||
|
||||
const loadPersistedData = () => {
|
||||
try {
|
||||
const savedState = localStorage.getItem('chorus-setup-state')
|
||||
if (savedState) {
|
||||
const state = JSON.parse(savedState)
|
||||
setCurrentStep(state.currentStep || 0)
|
||||
setCompletedSteps(new Set(state.completedSteps || []))
|
||||
setConfigData(state.configData || {})
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('Failed to load persisted setup data:', error)
|
||||
}
|
||||
}
|
||||
|
||||
const saveSetupState = () => {
|
||||
try {
|
||||
const state = {
|
||||
currentStep,
|
||||
completedSteps: Array.from(completedSteps),
|
||||
configData,
|
||||
timestamp: new Date().toISOString()
|
||||
}
|
||||
localStorage.setItem('chorus-setup-state', JSON.stringify(state))
|
||||
} catch (error) {
|
||||
console.error('Failed to save setup state:', error)
|
||||
}
|
||||
}
|
||||
|
||||
const clearPersistedData = () => {
|
||||
try {
|
||||
localStorage.removeItem('chorus-setup-state')
|
||||
// Reset state to initial values
|
||||
setCurrentStep(0)
|
||||
setCompletedSteps(new Set<number>())
|
||||
setConfigData({})
|
||||
} catch (error) {
|
||||
console.error('Failed to clear persisted data:', error)
|
||||
}
|
||||
}
|
||||
|
||||
const fetchSystemInfo = async () => {
|
||||
try {
|
||||
const response = await fetch('/api/system/info')
|
||||
const response = await fetch('/api/setup/system')
|
||||
if (response.ok) {
|
||||
const info = await response.json()
|
||||
setSystemInfo(info)
|
||||
const result = await response.json()
|
||||
setSystemInfo(result.system_info)
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('Failed to fetch system info:', error)
|
||||
@@ -90,12 +150,22 @@ export default function SetupPage() {
|
||||
}
|
||||
|
||||
const handleStepComplete = (stepIndex: number, data: any) => {
|
||||
console.log('Setup Page: Step complete', { stepIndex, data, currentConfigData: configData })
|
||||
setCompletedSteps(prev => new Set([...prev, stepIndex]))
|
||||
setConfigData(prev => ({ ...prev, ...data }))
|
||||
setConfigData(prev => {
|
||||
const newConfigData = { ...prev, ...data }
|
||||
console.log('Setup Page: Updated configData', { prev, data, newConfigData })
|
||||
return newConfigData
|
||||
})
|
||||
|
||||
// Auto-advance to next step
|
||||
if (stepIndex < SETUP_STEPS.length - 1) {
|
||||
setCurrentStep(stepIndex + 1)
|
||||
} else {
|
||||
// Setup is complete, clear persisted data after a delay
|
||||
setTimeout(() => {
|
||||
clearPersistedData()
|
||||
}, 2000)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -107,22 +177,55 @@ export default function SetupPage() {
|
||||
|
||||
const CurrentStepComponent = SETUP_STEPS[currentStep].component
|
||||
|
||||
// Check if we're resuming from saved data
|
||||
const isResuming = currentStep > 0 || completedSteps.size > 0 || Object.keys(configData).length > 0
|
||||
|
||||
return (
|
||||
<div className="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-8">
|
||||
<div className="mb-8">
|
||||
<h1 className="text-3xl font-bold text-gray-900 mb-2">
|
||||
Welcome to BZZZ Setup
|
||||
<h1 className="heading-hero mb-3">
|
||||
CHORUS Agent Setup
|
||||
</h1>
|
||||
<p className="text-lg text-gray-600">
|
||||
Let's configure your distributed AI coordination cluster in {SETUP_STEPS.length} simple steps.
|
||||
<p className="text-body">
|
||||
Configure your distributed agent orchestration platform in {SETUP_STEPS.length} simple steps.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div className="grid grid-cols-1 lg:grid-cols-4 gap-8">
|
||||
{/* Resume Setup Notification */}
|
||||
{isResuming && (
|
||||
<div className="mb-8 bg-chorus-secondary bg-opacity-20 border border-chorus-secondary rounded-lg p-6">
|
||||
<div className="flex items-start justify-between">
|
||||
<div className="flex items-start">
|
||||
<div className="flex-shrink-0">
|
||||
<svg className="h-5 w-5 text-chorus-secondary mt-0.5" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
||||
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z" />
|
||||
</svg>
|
||||
</div>
|
||||
<div className="ml-3">
|
||||
<h3 className="text-sm font-medium text-chorus-secondary">
|
||||
Setup Progress Restored
|
||||
</h3>
|
||||
<p className="text-small text-gray-300 mt-1">
|
||||
Your previous setup progress has been restored. You're currently on step {currentStep + 1} of {SETUP_STEPS.length}.
|
||||
{completedSteps.size > 0 && ` You've completed ${completedSteps.size} step${completedSteps.size !== 1 ? 's' : ''}.`}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<button
|
||||
onClick={clearPersistedData}
|
||||
className="btn-text"
|
||||
>
|
||||
Start Over
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
|
||||
<div className="grid grid-cols-1 lg:grid-cols-4 gap-12">
|
||||
{/* Progress Sidebar */}
|
||||
<div className="lg:col-span-1">
|
||||
<div className="card sticky top-8">
|
||||
<h2 className="text-lg font-semibold text-gray-900 mb-4">
|
||||
<h2 className="heading-subsection mb-6">
|
||||
Setup Progress
|
||||
</h2>
|
||||
<nav className="space-y-2">
|
||||
@@ -136,25 +239,25 @@ export default function SetupPage() {
|
||||
key={step.id}
|
||||
onClick={() => isAccessible && setCurrentStep(index)}
|
||||
disabled={!isAccessible}
|
||||
className={`w-full text-left p-3 rounded-lg border transition-all duration-200 ${
|
||||
className={`w-full text-left progress-step ${
|
||||
isCurrent
|
||||
? 'border-bzzz-primary bg-bzzz-primary bg-opacity-10 text-bzzz-primary'
|
||||
? 'progress-step-current'
|
||||
: isCompleted
|
||||
? 'border-green-200 bg-green-50 text-green-700'
|
||||
? 'progress-step-completed'
|
||||
: isAccessible
|
||||
? 'border-gray-200 hover:border-gray-300 text-gray-700'
|
||||
: 'border-gray-100 text-gray-400 cursor-not-allowed'
|
||||
? 'progress-step-accessible'
|
||||
: 'progress-step-disabled'
|
||||
}`}
|
||||
>
|
||||
<div className="flex items-center">
|
||||
<div className="flex-shrink-0 mr-3">
|
||||
{isCompleted ? (
|
||||
<CheckCircleIcon className="h-5 w-5 text-green-500" />
|
||||
<CheckCircleIcon className="h-5 w-5 text-green-400" />
|
||||
) : (
|
||||
<div className={`w-5 h-5 rounded-full border-2 flex items-center justify-center text-xs font-medium ${
|
||||
isCurrent
|
||||
? 'border-bzzz-primary bg-bzzz-primary text-white'
|
||||
: 'border-gray-300 text-gray-500'
|
||||
? 'border-chorus-secondary bg-chorus-secondary text-white'
|
||||
: 'border-gray-600 text-gray-500'
|
||||
}`}>
|
||||
{index + 1}
|
||||
</div>
|
||||
@@ -177,13 +280,13 @@ export default function SetupPage() {
|
||||
})}
|
||||
</nav>
|
||||
|
||||
<div className="mt-6 pt-4 border-t border-gray-200">
|
||||
<div className="text-sm text-gray-600 mb-2">
|
||||
<div className="mt-8 pt-6 border-t border-gray-800">
|
||||
<div className="text-small mb-3">
|
||||
Progress: {completedSteps.size} of {SETUP_STEPS.length} steps
|
||||
</div>
|
||||
<div className="w-full bg-gray-200 rounded-full h-2">
|
||||
<div className="w-full bg-gray-800 rounded-sm h-2">
|
||||
<div
|
||||
className="bg-bzzz-primary h-2 rounded-full transition-all duration-500"
|
||||
className="bg-chorus-secondary h-2 rounded-sm transition-all duration-500"
|
||||
style={{ width: `${(completedSteps.size / SETUP_STEPS.length) * 100}%` }}
|
||||
/>
|
||||
</div>
|
||||
@@ -194,16 +297,16 @@ export default function SetupPage() {
|
||||
{/* Main Content */}
|
||||
<div className="lg:col-span-3">
|
||||
<div className="card">
|
||||
<div className="mb-6">
|
||||
<div className="flex items-center justify-between mb-2">
|
||||
<h2 className="text-2xl font-bold text-gray-900">
|
||||
<div className="mb-8">
|
||||
<div className="flex items-center justify-between mb-3">
|
||||
<h2 className="heading-section">
|
||||
{SETUP_STEPS[currentStep].title}
|
||||
</h2>
|
||||
<div className="text-sm text-gray-500">
|
||||
<div className="text-ghost">
|
||||
Step {currentStep + 1} of {SETUP_STEPS.length}
|
||||
</div>
|
||||
</div>
|
||||
<p className="text-gray-600">
|
||||
<p className="text-body">
|
||||
{SETUP_STEPS[currentStep].description}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
5
install/config-ui/next-env.d.ts
vendored
Normal file
5
install/config-ui/next-env.d.ts
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
/// <reference types="next" />
|
||||
/// <reference types="next/image-types/global" />
|
||||
|
||||
// NOTE: This file should not be edited
|
||||
// see https://nextjs.org/docs/basic-features/typescript for more information.
|
||||
@@ -1,17 +1,30 @@
|
||||
/** @type {import('next').NextConfig} */
|
||||
const nextConfig = {
|
||||
output: 'standalone',
|
||||
// Export as static site for embedding in Go binary
|
||||
output: 'export',
|
||||
trailingSlash: true,
|
||||
distDir: 'out',
|
||||
|
||||
// Disable image optimization for static export
|
||||
images: {
|
||||
unoptimized: true
|
||||
},
|
||||
|
||||
// Configure for embedded serving
|
||||
assetPrefix: process.env.NODE_ENV === 'production' ? '/setup' : '',
|
||||
basePath: process.env.NODE_ENV === 'production' ? '/setup' : '',
|
||||
|
||||
// API routes will be handled by Go server
|
||||
async rewrites() {
|
||||
return [
|
||||
{
|
||||
source: '/api/:path*',
|
||||
destination: 'http://localhost:8081/api/:path*'
|
||||
}
|
||||
]
|
||||
if (process.env.NODE_ENV === 'development') {
|
||||
return [
|
||||
{
|
||||
source: '/api/:path*',
|
||||
destination: 'http://localhost:8080/api/:path*'
|
||||
}
|
||||
]
|
||||
}
|
||||
return []
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
6013
install/config-ui/package-lock.json
generated
Normal file
6013
install/config-ui/package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
1
install/config-ui/pkg/web/static/404.html
Normal file
1
install/config-ui/pkg/web/static/404.html
Normal file
File diff suppressed because one or more lines are too long
1
install/config-ui/pkg/web/static/404/index.html
Normal file
1
install/config-ui/pkg/web/static/404/index.html
Normal file
File diff suppressed because one or more lines are too long
@@ -0,0 +1 @@
|
||||
self.__BUILD_MANIFEST={__rewrites:{afterFiles:[],beforeFiles:[],fallback:[]},"/_error":["static/chunks/pages/_error-e87e5963ec1b8011.js"],sortedPages:["/_app","/_error"]},self.__BUILD_MANIFEST_CB&&self.__BUILD_MANIFEST_CB();
|
||||
@@ -0,0 +1 @@
|
||||
self.__SSG_MANIFEST=new Set([]);self.__SSG_MANIFEST_CB&&self.__SSG_MANIFEST_CB()
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -0,0 +1 @@
|
||||
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[165],{3155:function(e,t,n){(window.__NEXT_P=window.__NEXT_P||[]).push(["/_not-found",function(){return n(4032)}])},4032:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"default",{enumerable:!0,get:function(){return o}});let l=n(1024)._(n(2265)),r={error:{fontFamily:'system-ui,"Segoe UI",Roboto,Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji"',height:"100vh",textAlign:"center",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center"},desc:{display:"inline-block"},h1:{display:"inline-block",margin:"0 20px 0 0",padding:"0 23px 0 0",fontSize:24,fontWeight:500,verticalAlign:"top",lineHeight:"49px"},h2:{fontSize:14,fontWeight:400,lineHeight:"49px",margin:0}};function o(){return l.default.createElement(l.default.Fragment,null,l.default.createElement("title",null,"404: This page could not be found."),l.default.createElement("div",{style:r.error},l.default.createElement("div",null,l.default.createElement("style",{dangerouslySetInnerHTML:{__html:"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}"}}),l.default.createElement("h1",{className:"next-error-h1",style:r.h1},"404"),l.default.createElement("div",{style:r.desc},l.default.createElement("h2",{style:r.h2},"This page could not be found.")))))}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)}},function(e){e.O(0,[971,938,744],function(){return e(e.s=3155)}),_N_E=e.O()}]);
|
||||
@@ -0,0 +1 @@
|
||||
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[185],{3489:function(n,e,u){Promise.resolve().then(u.t.bind(u,2445,23))},2445:function(){}},function(n){n.O(0,[971,938,744],function(){return n(n.s=3489)}),_N_E=n.O()}]);
|
||||
@@ -0,0 +1 @@
|
||||
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[931],{},function(n){n.O(0,[876,644,971,938,744],function(){return n(n.s=9644)}),_N_E=n.O()}]);
|
||||
@@ -0,0 +1 @@
|
||||
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[413],{},function(n){n.O(0,[876,644,971,938,744],function(){return n(n.s=9644)}),_N_E=n.O()}]);
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -0,0 +1 @@
|
||||
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[744],{8729:function(e,n,t){Promise.resolve().then(t.t.bind(t,7690,23)),Promise.resolve().then(t.t.bind(t,8955,23)),Promise.resolve().then(t.t.bind(t,5613,23)),Promise.resolve().then(t.t.bind(t,1902,23)),Promise.resolve().then(t.t.bind(t,1778,23)),Promise.resolve().then(t.t.bind(t,7831,23))}},function(e){var n=function(n){return e(e.s=n)};e.O(0,[971,938],function(){return n(5317),n(8729)}),_N_E=e.O()}]);
|
||||
@@ -0,0 +1 @@
|
||||
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[888],{1597:function(n,_,u){(window.__NEXT_P=window.__NEXT_P||[]).push(["/_app",function(){return u(5141)}])}},function(n){var _=function(_){return n(n.s=_)};n.O(0,[774,179],function(){return _(1597),_(3719)}),_N_E=n.O()}]);
|
||||
@@ -0,0 +1 @@
|
||||
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[820],{1981:function(n,_,u){(window.__NEXT_P=window.__NEXT_P||[]).push(["/_error",function(){return u(9049)}])}},function(n){n.O(0,[888,774,179],function(){return n(n.s=1981)}),_N_E=n.O()}]);
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1 @@
|
||||
!function(){"use strict";var e,t,r,n,o,u,i,c,f,a={},l={};function s(e){var t=l[e];if(void 0!==t)return t.exports;var r=l[e]={exports:{}},n=!0;try{a[e](r,r.exports,s),n=!1}finally{n&&delete l[e]}return r.exports}s.m=a,e=[],s.O=function(t,r,n,o){if(r){o=o||0;for(var u=e.length;u>0&&e[u-1][2]>o;u--)e[u]=e[u-1];e[u]=[r,n,o];return}for(var i=1/0,u=0;u<e.length;u++){for(var r=e[u][0],n=e[u][1],o=e[u][2],c=!0,f=0;f<r.length;f++)i>=o&&Object.keys(s.O).every(function(e){return s.O[e](r[f])})?r.splice(f--,1):(c=!1,o<i&&(i=o));if(c){e.splice(u--,1);var a=n();void 0!==a&&(t=a)}}return t},r=Object.getPrototypeOf?function(e){return Object.getPrototypeOf(e)}:function(e){return e.__proto__},s.t=function(e,n){if(1&n&&(e=this(e)),8&n||"object"==typeof e&&e&&(4&n&&e.__esModule||16&n&&"function"==typeof e.then))return e;var o=Object.create(null);s.r(o);var u={};t=t||[null,r({}),r([]),r(r)];for(var i=2&n&&e;"object"==typeof i&&!~t.indexOf(i);i=r(i))Object.getOwnPropertyNames(i).forEach(function(t){u[t]=function(){return e[t]}});return u.default=function(){return e},s.d(o,u),o},s.d=function(e,t){for(var r in t)s.o(t,r)&&!s.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},s.f={},s.e=function(e){return Promise.all(Object.keys(s.f).reduce(function(t,r){return s.f[r](e,t),t},[]))},s.u=function(e){},s.miniCssF=function(e){return"static/css/4362293ef85876c3.css"},s.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n={},o="_N_E:",s.l=function(e,t,r,u){if(n[e]){n[e].push(t);return}if(void 0!==r)for(var i,c,f=document.getElementsByTagName("script"),a=0;a<f.length;a++){var l=f[a];if(l.getAttribute("src")==e||l.getAttribute("data-webpack")==o+r){i=l;break}}i||(c=!0,(i=document.createElement("script")).charset="utf-8",i.timeout=120,s.nc&&i.setAttribute("nonce",s.nc),i.setAttribute("data-webpack",o+r),i.src=s.tu(e)),n[e]=[t];var d=function(t,r){i.onerror=i.onload=null,clearTimeout(p);var o=n[e];if(delete n[e],i.parentNode&&i.parentNode.removeChild(i),o&&o.forEach(function(e){return e(r)}),t)return t(r)},p=setTimeout(d.bind(null,void 0,{type:"timeout",target:i}),12e4);i.onerror=d.bind(null,i.onerror),i.onload=d.bind(null,i.onload),c&&document.head.appendChild(i)},s.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},s.tt=function(){return void 0===u&&(u={createScriptURL:function(e){return e}},"undefined"!=typeof trustedTypes&&trustedTypes.createPolicy&&(u=trustedTypes.createPolicy("nextjs#bundler",u))),u},s.tu=function(e){return s.tt().createScriptURL(e)},s.p="/setup/_next/",i={272:0},s.f.j=function(e,t){var r=s.o(i,e)?i[e]:void 0;if(0!==r){if(r)t.push(r[2]);else if(272!=e){var n=new Promise(function(t,n){r=i[e]=[t,n]});t.push(r[2]=n);var o=s.p+s.u(e),u=Error();s.l(o,function(t){if(s.o(i,e)&&(0!==(r=i[e])&&(i[e]=void 0),r)){var n=t&&("load"===t.type?"missing":t.type),o=t&&t.target&&t.target.src;u.message="Loading chunk "+e+" failed.\n("+n+": "+o+")",u.name="ChunkLoadError",u.type=n,u.request=o,r[1](u)}},"chunk-"+e,e)}else i[e]=0}},s.O.j=function(e){return 0===i[e]},c=function(e,t){var r,n,o=t[0],u=t[1],c=t[2],f=0;if(o.some(function(e){return 0!==i[e]})){for(r in u)s.o(u,r)&&(s.m[r]=u[r]);if(c)var a=c(s)}for(e&&e(t);f<o.length;f++)n=o[f],s.o(i,n)&&i[n]&&i[n][0](),i[n]=0;return s.O(a)},(f=self.webpackChunk_N_E=self.webpackChunk_N_E||[]).forEach(c.bind(null,0)),f.push=c.bind(null,f.push.bind(f))}();
|
||||
File diff suppressed because one or more lines are too long
1
install/config-ui/pkg/web/static/index.html
Normal file
1
install/config-ui/pkg/web/static/index.html
Normal file
File diff suppressed because one or more lines are too long
6
install/config-ui/pkg/web/static/index.txt
Normal file
6
install/config-ui/pkg/web/static/index.txt
Normal file
@@ -0,0 +1,6 @@
|
||||
2:I[7815,["876","static/chunks/876-b459a6d4f6d02f48.js","644","static/chunks/644-a7a36a2e4bcba860.js","931","static/chunks/app/page-4bdc4ae0c464207c.js"],""]
|
||||
3:I[5613,[],""]
|
||||
4:I[1778,[],""]
|
||||
0:["7BnuKiL4PldmLYwIqPYAK",[[["",{"children":["__PAGE__",{}]},"$undefined","$undefined",true],["",{"children":["__PAGE__",{},["$L1",["$","$L2",null,{}],null]]},[null,["$","html",null,{"lang":"en","children":["$","body",null,{"className":"bg-gray-50 min-h-screen","children":["$","div",null,{"className":"min-h-screen flex flex-col","children":[["$","header",null,{"className":"bg-white shadow-sm border-b border-gray-200","children":["$","div",null,{"className":"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8","children":["$","div",null,{"className":"flex justify-between items-center py-4","children":[["$","div",null,{"className":"flex items-center","children":[["$","div",null,{"className":"flex-shrink-0","children":["$","div",null,{"className":"w-8 h-8 bg-bzzz-primary rounded-lg flex items-center justify-center","children":["$","span",null,{"className":"text-white font-bold text-lg","children":"B"}]}]}],["$","div",null,{"className":"ml-3","children":[["$","h1",null,{"className":"text-xl font-semibold text-gray-900","children":"BZZZ Cluster Configuration"}],["$","p",null,{"className":"text-sm text-gray-500","children":"Distributed AI Coordination Platform"}]]}]]}],["$","div",null,{"className":"flex items-center space-x-4","children":["$","div",null,{"className":"status-online","children":"System Online"}]}]]}]}]}],["$","main",null,{"className":"flex-1","children":["$","$L3",null,{"parallelRouterKey":"children","segmentPath":["children"],"loading":"$undefined","loadingStyles":"$undefined","loadingScripts":"$undefined","hasLoading":false,"error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L4",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":[["$","title",null,{"children":"404: This page could not be found."}],["$","div",null,{"style":{"fontFamily":"system-ui,\"Segoe UI\",Roboto,Helvetica,Arial,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\"","height":"100vh","textAlign":"center","display":"flex","flexDirection":"column","alignItems":"center","justifyContent":"center"},"children":["$","div",null,{"children":[["$","style",null,{"dangerouslySetInnerHTML":{"__html":"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}"}}],["$","h1",null,{"className":"next-error-h1","style":{"display":"inline-block","margin":"0 20px 0 0","padding":"0 23px 0 0","fontSize":24,"fontWeight":500,"verticalAlign":"top","lineHeight":"49px"},"children":"404"}],["$","div",null,{"style":{"display":"inline-block"},"children":["$","h2",null,{"style":{"fontSize":14,"fontWeight":400,"lineHeight":"49px","margin":0},"children":"This page could not be found."}]}]]}]}]],"notFoundStyles":[],"styles":null}]}],["$","footer",null,{"className":"bg-white border-t border-gray-200","children":["$","div",null,{"className":"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-4","children":["$","div",null,{"className":"flex justify-between items-center text-sm text-gray-500","children":[["$","div",null,{"children":"© 2025 Chorus Services. All rights reserved."}],["$","div",null,{"className":"flex space-x-4","children":[["$","a",null,{"href":"https://docs.chorus.services/bzzz","target":"_blank","className":"hover:text-bzzz-primary transition-colors","children":"Documentation"}],["$","a",null,{"href":"https://discord.gg/chorus-services","target":"_blank","className":"hover:text-bzzz-primary transition-colors","children":"Support"}]]}]]}]}]}]]}]}]}],null]],[[["$","link","0",{"rel":"stylesheet","href":"/setup/_next/static/css/4362293ef85876c3.css","precedence":"next","crossOrigin":""}]],"$L5"]]]]
|
||||
5:[["$","meta","0",{"name":"viewport","content":"width=device-width, initial-scale=1"}],["$","meta","1",{"charSet":"utf-8"}],["$","title","2",{"children":"BZZZ Cluster Configuration"}],["$","meta","3",{"name":"description","content":"Configure your BZZZ distributed AI coordination cluster"}]]
|
||||
1:null
|
||||
1
install/config-ui/pkg/web/static/setup/index.html
Normal file
1
install/config-ui/pkg/web/static/setup/index.html
Normal file
File diff suppressed because one or more lines are too long
7
install/config-ui/pkg/web/static/setup/index.txt
Normal file
7
install/config-ui/pkg/web/static/setup/index.txt
Normal file
@@ -0,0 +1,7 @@
|
||||
2:I[7831,[],""]
|
||||
3:I[7815,["876","static/chunks/876-b459a6d4f6d02f48.js","644","static/chunks/644-a7a36a2e4bcba860.js","413","static/chunks/app/setup/page-dbda410340cb8823.js"],""]
|
||||
4:I[5613,[],""]
|
||||
5:I[1778,[],""]
|
||||
0:["7BnuKiL4PldmLYwIqPYAK",[[["",{"children":["setup",{"children":["__PAGE__",{}]}]},"$undefined","$undefined",true],["",{"children":["setup",{"children":["__PAGE__",{},["$L1",["$","$L2",null,{"propsForComponent":{"params":{}},"Component":"$3","isStaticGeneration":true}],null]]},["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children","setup","children"],"loading":"$undefined","loadingStyles":"$undefined","loadingScripts":"$undefined","hasLoading":false,"error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":"$undefined","notFoundStyles":"$undefined","styles":null}]]},[null,["$","html",null,{"lang":"en","children":["$","body",null,{"className":"bg-gray-50 min-h-screen","children":["$","div",null,{"className":"min-h-screen flex flex-col","children":[["$","header",null,{"className":"bg-white shadow-sm border-b border-gray-200","children":["$","div",null,{"className":"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8","children":["$","div",null,{"className":"flex justify-between items-center py-4","children":[["$","div",null,{"className":"flex items-center","children":[["$","div",null,{"className":"flex-shrink-0","children":["$","div",null,{"className":"w-8 h-8 bg-bzzz-primary rounded-lg flex items-center justify-center","children":["$","span",null,{"className":"text-white font-bold text-lg","children":"B"}]}]}],["$","div",null,{"className":"ml-3","children":[["$","h1",null,{"className":"text-xl font-semibold text-gray-900","children":"BZZZ Cluster Configuration"}],["$","p",null,{"className":"text-sm text-gray-500","children":"Distributed AI Coordination Platform"}]]}]]}],["$","div",null,{"className":"flex items-center space-x-4","children":["$","div",null,{"className":"status-online","children":"System Online"}]}]]}]}]}],["$","main",null,{"className":"flex-1","children":["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children"],"loading":"$undefined","loadingStyles":"$undefined","loadingScripts":"$undefined","hasLoading":false,"error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":[["$","title",null,{"children":"404: This page could not be found."}],["$","div",null,{"style":{"fontFamily":"system-ui,\"Segoe UI\",Roboto,Helvetica,Arial,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\"","height":"100vh","textAlign":"center","display":"flex","flexDirection":"column","alignItems":"center","justifyContent":"center"},"children":["$","div",null,{"children":[["$","style",null,{"dangerouslySetInnerHTML":{"__html":"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}"}}],["$","h1",null,{"className":"next-error-h1","style":{"display":"inline-block","margin":"0 20px 0 0","padding":"0 23px 0 0","fontSize":24,"fontWeight":500,"verticalAlign":"top","lineHeight":"49px"},"children":"404"}],["$","div",null,{"style":{"display":"inline-block"},"children":["$","h2",null,{"style":{"fontSize":14,"fontWeight":400,"lineHeight":"49px","margin":0},"children":"This page could not be found."}]}]]}]}]],"notFoundStyles":[],"styles":null}]}],["$","footer",null,{"className":"bg-white border-t border-gray-200","children":["$","div",null,{"className":"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-4","children":["$","div",null,{"className":"flex justify-between items-center text-sm text-gray-500","children":[["$","div",null,{"children":"© 2025 Chorus Services. All rights reserved."}],["$","div",null,{"className":"flex space-x-4","children":[["$","a",null,{"href":"https://docs.chorus.services/bzzz","target":"_blank","className":"hover:text-bzzz-primary transition-colors","children":"Documentation"}],["$","a",null,{"href":"https://discord.gg/chorus-services","target":"_blank","className":"hover:text-bzzz-primary transition-colors","children":"Support"}]]}]]}]}]}]]}]}]}],null]],[[["$","link","0",{"rel":"stylesheet","href":"/setup/_next/static/css/4362293ef85876c3.css","precedence":"next","crossOrigin":""}]],"$L6"]]]]
|
||||
6:[["$","meta","0",{"name":"viewport","content":"width=device-width, initial-scale=1"}],["$","meta","1",{"charSet":"utf-8"}],["$","title","2",{"children":"BZZZ Cluster Configuration"}],["$","meta","3",{"name":"description","content":"Configure your BZZZ distributed AI coordination cluster"}]]
|
||||
1:null
|
||||
BIN
install/config-ui/public/assets/chorus-landscape-on-white.png
Normal file
BIN
install/config-ui/public/assets/chorus-landscape-on-white.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 39 KiB |
BIN
install/config-ui/public/assets/chorus-mobius-on-white.png
Normal file
BIN
install/config-ui/public/assets/chorus-mobius-on-white.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 117 KiB |
@@ -5,16 +5,92 @@ module.exports = {
|
||||
'./components/**/*.{js,ts,jsx,tsx,mdx}',
|
||||
'./app/**/*.{js,ts,jsx,tsx,mdx}',
|
||||
],
|
||||
darkMode: 'class',
|
||||
theme: {
|
||||
extend: {
|
||||
colors: {
|
||||
'bzzz-primary': '#FF6B35',
|
||||
'bzzz-secondary': '#004E89',
|
||||
'bzzz-accent': '#1A659E',
|
||||
'bzzz-neutral': '#F7931E',
|
||||
// CHORUS Corporate Colors - Adaptive Theme
|
||||
'chorus-primary': {
|
||||
light: '#c1bfb1', // Brushed Nickel - light background
|
||||
DEFAULT: '#0b0213', // Dark Mulberry - dark background
|
||||
},
|
||||
'chorus-secondary': '#5a6c80', // Orchestration Blue - consistent
|
||||
'chorus-accent': '#c1bfb1', // Brushed Nickel - consistent
|
||||
'chorus-brown': '#403730', // Walnut Brown - consistent
|
||||
|
||||
// Adaptive Surfaces
|
||||
'chorus-paper': {
|
||||
light: '#f8f9fa', // Light paper background
|
||||
DEFAULT: '#0b0213', // Dark paper background
|
||||
},
|
||||
'chorus-white': {
|
||||
light: '#ffffff', // Light cards
|
||||
DEFAULT: '#111111', // Dark cards
|
||||
},
|
||||
'chorus-warm': {
|
||||
light: '#f5f5f5', // Light elevated surfaces
|
||||
DEFAULT: '#1a1a1a', // Dark elevated surfaces
|
||||
},
|
||||
|
||||
// Adaptive Text Hierarchy
|
||||
'chorus-text-primary': {
|
||||
light: '#1a1a1a', // Dark text on light
|
||||
DEFAULT: '#ffffff', // Light text on dark
|
||||
},
|
||||
'chorus-text-secondary': {
|
||||
light: '#4a5568', // Medium gray on light
|
||||
DEFAULT: '#e5e5e5', // Light gray on dark
|
||||
},
|
||||
'chorus-text-tertiary': {
|
||||
light: '#718096', // Light gray on light
|
||||
DEFAULT: '#cccccc', // Medium light on dark
|
||||
},
|
||||
'chorus-text-subtle': {
|
||||
light: '#a0aec0', // Very light on light
|
||||
DEFAULT: '#999999', // Medium on dark
|
||||
},
|
||||
'chorus-text-ghost': {
|
||||
light: '#cbd5e0', // Ghost light
|
||||
DEFAULT: '#666666', // Ghost dark
|
||||
},
|
||||
|
||||
// Adaptive Border System
|
||||
'chorus-border-invisible': {
|
||||
light: '#f7fafc', // Nearly invisible light
|
||||
DEFAULT: '#333333', // Nearly invisible dark
|
||||
},
|
||||
'chorus-border-subtle': {
|
||||
light: '#e2e8f0', // Subtle light borders
|
||||
DEFAULT: '#444444', // Subtle dark borders
|
||||
},
|
||||
'chorus-border-defined': {
|
||||
light: '#cbd5e0', // Defined light borders
|
||||
DEFAULT: '#555555', // Defined dark borders
|
||||
},
|
||||
'chorus-border-emphasis': {
|
||||
light: '#a0aec0', // Emphasized light
|
||||
DEFAULT: '#666666', // Emphasized dark
|
||||
},
|
||||
},
|
||||
borderRadius: {
|
||||
'none': '0',
|
||||
'sm': '3px', // Small elements (inputs, badges)
|
||||
'md': '4px', // Standard elements (buttons, nav)
|
||||
'lg': '5px', // Large elements (cards, modals)
|
||||
},
|
||||
spacing: {
|
||||
'18': '4.5rem', // 72px
|
||||
'88': '22rem', // 352px
|
||||
},
|
||||
animation: {
|
||||
'pulse-slow': 'pulse 3s cubic-bezier(0.4, 0, 0.6, 1) infinite',
|
||||
'fade-in': 'fadeIn 200ms ease-out',
|
||||
},
|
||||
keyframes: {
|
||||
fadeIn: {
|
||||
'0%': { opacity: '0', transform: 'translateY(4px)' },
|
||||
'100%': { opacity: '1', transform: 'translateY(0)' },
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"target": "es2015",
|
||||
"downlevelIteration": true,
|
||||
"lib": ["dom", "dom.iterable", "esnext"],
|
||||
"allowJs": true,
|
||||
"skipLibCheck": true,
|
||||
|
||||
@@ -6,8 +6,8 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/anthonyrawlins/bzzz/pkg/config"
|
||||
"github.com/anthonyrawlins/bzzz/pkg/election"
|
||||
"chorus.services/bzzz/pkg/config"
|
||||
"chorus.services/bzzz/pkg/election"
|
||||
)
|
||||
|
||||
func TestElectionIntegration_ElectionLogic(t *testing.T) {
|
||||
|
||||
139
issues/resource-allocation-component.md
Normal file
139
issues/resource-allocation-component.md
Normal file
@@ -0,0 +1,139 @@
|
||||
# Resource Allocation Component Implementation
|
||||
|
||||
## Overview
|
||||
Implement a Resource Allocation component for the BZZZ setup wizard to allow users to configure CPU, memory, and storage allocation for different BZZZ services.
|
||||
|
||||
## Current Status
|
||||
- **Step removed from setup wizard** (temporarily) - located between AI Integration and Service Deployment
|
||||
- **Placeholder component exists** at `install/config-ui/app/setup/components/ResourceAllocation.tsx`
|
||||
- **System detection available** - hardware information already captured in System Detection step
|
||||
|
||||
## Requirements
|
||||
|
||||
### 1. System Resource Display
|
||||
- [ ] Display detected system resources from SystemDetection step:
|
||||
- CPU cores available
|
||||
- Total memory (RAM)
|
||||
- Available storage space
|
||||
- GPU information (if applicable)
|
||||
- [ ] Show current system utilization/usage
|
||||
|
||||
### 2. Service Resource Configuration
|
||||
- [ ] Allow allocation for BZZZ services:
|
||||
- **BZZZ API Server** (CPU cores, memory)
|
||||
- **MCP Server** (CPU cores, memory)
|
||||
- **P2P Network** (bandwidth, connections)
|
||||
- **Web UI** (minimal resources)
|
||||
- **Storage Services** (disk space allocation)
|
||||
- [ ] Configurable resource limits and reservations
|
||||
- [ ] Docker container resource constraints integration
|
||||
|
||||
### 3. Resource Validation
|
||||
- [ ] Ensure total allocations don't exceed available resources
|
||||
- [ ] Minimum resource requirements validation
|
||||
- [ ] Warning for resource over-allocation
|
||||
- [ ] Real-time calculation of remaining resources
|
||||
|
||||
### 4. Performance Recommendations
|
||||
- [ ] Suggest optimal resource distributions based on:
|
||||
- Detected hardware capabilities
|
||||
- Intended cluster role (coordinator vs worker)
|
||||
- Expected workload patterns
|
||||
- [ ] Preset configurations:
|
||||
- **Development** (minimal resources)
|
||||
- **Production** (balanced allocation)
|
||||
- **High-Performance** (maximum allocation)
|
||||
|
||||
### 5. Integration Points
|
||||
- [ ] Receive system info from System Detection step
|
||||
- [ ] Pass resource config to Service Deployment step
|
||||
- [ ] Generate Docker Compose resource constraints
|
||||
- [ ] Integration with cluster formation for multi-node awareness
|
||||
|
||||
## Technical Implementation
|
||||
|
||||
### Component Structure
|
||||
```typescript
|
||||
interface ResourceConfig {
|
||||
cpu: {
|
||||
bzzzApi: number // CPU cores for API server
|
||||
mcpServer: number // CPU cores for MCP server
|
||||
p2pNetwork: number // CPU cores for P2P
|
||||
reserved: number // System reserved cores
|
||||
}
|
||||
memory: {
|
||||
bzzzApi: number // Memory MB for API server
|
||||
mcpServer: number // Memory MB for MCP server
|
||||
p2pNetwork: number // Memory MB for P2P
|
||||
webUI: number // Memory MB for Web UI
|
||||
system: number // System reserved memory
|
||||
}
|
||||
storage: {
|
||||
logs: number // Log storage GB
|
||||
data: number // Data storage GB
|
||||
temp: number // Temporary files GB
|
||||
available: number // Remaining space
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Validation Logic
|
||||
```typescript
|
||||
const validateResources = (config: ResourceConfig, systemInfo: SystemInfo) => {
|
||||
const totalCpu = config.cpu.bzzzApi + config.cpu.mcpServer + config.cpu.p2pNetwork + config.cpu.reserved
|
||||
const totalMemory = config.memory.bzzzApi + config.memory.mcpServer + config.memory.p2pNetwork + config.memory.webUI + config.memory.system
|
||||
const totalStorage = config.storage.logs + config.storage.data + config.storage.temp
|
||||
|
||||
return {
|
||||
cpuValid: totalCpu <= systemInfo.cpu_cores,
|
||||
memoryValid: totalMemory <= systemInfo.memory_mb,
|
||||
storageValid: totalStorage <= systemInfo.storage.free_space_gb
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## User Experience
|
||||
|
||||
### Visual Design
|
||||
- [ ] Resource allocation sliders/input fields
|
||||
- [ ] Real-time resource utilization charts
|
||||
- [ ] Color-coded validation (green/yellow/red)
|
||||
- [ ] Resource recommendation cards
|
||||
- [ ] "Auto-Configure" button for presets
|
||||
|
||||
### Workflow Integration
|
||||
- [ ] Progressive disclosure (advanced options collapsed by default)
|
||||
- [ ] Validation feedback before proceeding to next step
|
||||
- [ ] Ability to return and modify allocations
|
||||
- [ ] Save/restore configurations
|
||||
|
||||
## Dependencies
|
||||
- System Detection component (already implemented)
|
||||
- Service Deployment component integration
|
||||
- Docker Compose generation
|
||||
- Cluster Formation multi-node awareness
|
||||
|
||||
## Acceptance Criteria
|
||||
- [ ] Users can allocate CPU, memory, and storage to BZZZ services
|
||||
- [ ] Resource constraints are validated against available hardware
|
||||
- [ ] Configuration is passed to subsequent setup steps
|
||||
- [ ] Docker container limits are properly configured
|
||||
- [ ] Performance recommendations are provided
|
||||
- [ ] Multi-node cluster resource awareness
|
||||
|
||||
## Priority
|
||||
**Medium** - Important for production deployments but not blocking initial setup functionality
|
||||
|
||||
## Related Issues
|
||||
- Service Deployment component integration
|
||||
- Docker Compose resource constraints
|
||||
- Multi-node cluster resource coordination
|
||||
- Performance monitoring and alerting
|
||||
|
||||
---
|
||||
|
||||
**Implementation Notes:**
|
||||
- Reintegrate into setup wizard between AI Integration and Service Deployment
|
||||
- Use existing SystemInfo from setup context
|
||||
- Generate Docker Compose resource configurations
|
||||
- Consider future multi-node resource coordination requirements
|
||||
554
main.go
554
main.go
@@ -8,27 +8,26 @@ import (
|
||||
"log"
|
||||
"net/http"
|
||||
"os"
|
||||
"os/signal"
|
||||
"path/filepath"
|
||||
"reflect"
|
||||
"syscall"
|
||||
"time"
|
||||
|
||||
"github.com/anthonyrawlins/bzzz/api"
|
||||
"github.com/anthonyrawlins/bzzz/coordinator"
|
||||
"github.com/anthonyrawlins/bzzz/discovery"
|
||||
"github.com/anthonyrawlins/bzzz/logging"
|
||||
"github.com/anthonyrawlins/bzzz/p2p"
|
||||
"github.com/anthonyrawlins/bzzz/pkg/config"
|
||||
"github.com/anthonyrawlins/bzzz/pkg/crypto"
|
||||
"github.com/anthonyrawlins/bzzz/pkg/health"
|
||||
"github.com/anthonyrawlins/bzzz/pkg/shutdown"
|
||||
"github.com/anthonyrawlins/bzzz/pkg/ucxi"
|
||||
"github.com/anthonyrawlins/bzzz/pkg/ucxl"
|
||||
"github.com/anthonyrawlins/bzzz/pubsub"
|
||||
"github.com/anthonyrawlins/bzzz/reasoning"
|
||||
|
||||
"github.com/libp2p/go-libp2p-kad-dht"
|
||||
"chorus.services/bzzz/api"
|
||||
"chorus.services/bzzz/coordinator"
|
||||
"chorus.services/bzzz/discovery"
|
||||
"chorus.services/bzzz/logging"
|
||||
"chorus.services/bzzz/p2p"
|
||||
"chorus.services/bzzz/pkg/config"
|
||||
"chorus.services/bzzz/pkg/crypto"
|
||||
"chorus.services/bzzz/pkg/dht"
|
||||
"chorus.services/bzzz/pkg/election"
|
||||
"chorus.services/bzzz/pkg/health"
|
||||
"chorus.services/bzzz/pkg/shutdown"
|
||||
"chorus.services/bzzz/pkg/ucxi"
|
||||
"chorus.services/bzzz/pkg/ucxl"
|
||||
"chorus.services/bzzz/pkg/web"
|
||||
"chorus.services/bzzz/pubsub"
|
||||
"chorus.services/bzzz/reasoning"
|
||||
"github.com/libp2p/go-libp2p/core/peer"
|
||||
"github.com/multiformats/go-multiaddr"
|
||||
)
|
||||
@@ -103,11 +102,31 @@ func main() {
|
||||
|
||||
fmt.Println("🚀 Starting Bzzz + HMMM P2P Task Coordination System...")
|
||||
|
||||
// Determine config file path
|
||||
configPath := os.Getenv("BZZZ_CONFIG_PATH")
|
||||
if configPath == "" {
|
||||
configPath = ".bzzz/config.yaml"
|
||||
}
|
||||
|
||||
// Check if setup is required
|
||||
if config.IsSetupRequired(configPath) {
|
||||
fmt.Println("🔧 Setup required - starting web configuration interface...")
|
||||
startSetupMode(configPath)
|
||||
return
|
||||
}
|
||||
|
||||
// Load configuration
|
||||
cfg, err := config.LoadConfig("")
|
||||
cfg, err := config.LoadConfig(configPath)
|
||||
if err != nil {
|
||||
log.Fatalf("Failed to load configuration: %v", err)
|
||||
}
|
||||
|
||||
// Validate configuration
|
||||
if !config.IsValidConfiguration(cfg) {
|
||||
fmt.Println("⚠️ Configuration is invalid - starting setup mode...")
|
||||
startSetupMode(configPath)
|
||||
return
|
||||
}
|
||||
|
||||
// Initialize P2P node
|
||||
node, err := p2p.NewNode(ctx)
|
||||
@@ -164,7 +183,7 @@ func main() {
|
||||
}
|
||||
}
|
||||
|
||||
fmt.Printf("🐝 WHOOSH API: %s\n", cfg.HiveAPI.BaseURL)
|
||||
// Hive is deprecated - removed reference
|
||||
fmt.Printf("🔗 Listening addresses:\n")
|
||||
for _, addr := range node.Addresses() {
|
||||
fmt.Printf(" %s/p2p/%s\n", addr, node.ID())
|
||||
@@ -254,20 +273,20 @@ func main() {
|
||||
|
||||
// === DHT Storage and Decision Publishing ===
|
||||
// Initialize DHT for distributed storage
|
||||
var dhtNode *kadht.IpfsDHT
|
||||
var dhtNode *dht.LibP2PDHT
|
||||
var encryptedStorage *dht.EncryptedDHTStorage
|
||||
var decisionPublisher *ucxl.DecisionPublisher
|
||||
|
||||
if cfg.V2.DHT.Enabled {
|
||||
// Create DHT
|
||||
dhtNode, err = kadht.New(ctx, node.Host())
|
||||
dhtNode, err = dht.NewLibP2PDHT(ctx, node.Host())
|
||||
if err != nil {
|
||||
fmt.Printf("⚠️ Failed to create DHT: %v\n", err)
|
||||
} else {
|
||||
fmt.Printf("🕸️ DHT initialized\n")
|
||||
|
||||
// Bootstrap DHT
|
||||
if err := dhtNode.Bootstrap(ctx); err != nil {
|
||||
if err := dhtNode.Bootstrap(); err != nil {
|
||||
fmt.Printf("⚠️ DHT bootstrap failed: %v\n", err)
|
||||
}
|
||||
|
||||
@@ -350,7 +369,6 @@ func main() {
|
||||
// Initialize Task Coordinator
|
||||
taskCoordinator := coordinator.NewTaskCoordinator(
|
||||
ctx,
|
||||
nil, // No WHOOSH client
|
||||
ps,
|
||||
hlog,
|
||||
cfg,
|
||||
@@ -459,7 +477,7 @@ func main() {
|
||||
|
||||
// Register components for graceful shutdown
|
||||
setupGracefulShutdown(shutdownManager, healthManager, node, ps, mdnsDiscovery,
|
||||
electionManagers, httpServer, ucxiServer, taskCoordinator, dhtNode)
|
||||
electionManager, httpServer, ucxiServer, taskCoordinator, dhtNode)
|
||||
|
||||
// Start health monitoring
|
||||
if err := healthManager.Start(); err != nil {
|
||||
@@ -487,7 +505,7 @@ func main() {
|
||||
}
|
||||
|
||||
// setupHealthChecks configures comprehensive health monitoring
|
||||
func setupHealthChecks(healthManager *health.Manager, ps *pubsub.PubSub, node *p2p.Node, dhtNode *kadht.IpfsDHT) {
|
||||
func setupHealthChecks(healthManager *health.Manager, ps *pubsub.PubSub, node *p2p.Node, dhtNode *dht.LibP2PDHT) {
|
||||
// P2P connectivity check (critical)
|
||||
p2pCheck := &health.HealthCheck{
|
||||
Name: "p2p-connectivity",
|
||||
@@ -581,8 +599,8 @@ func setupHealthChecks(healthManager *health.Manager, ps *pubsub.PubSub, node *p
|
||||
|
||||
// setupGracefulShutdown registers all components for proper shutdown
|
||||
func setupGracefulShutdown(shutdownManager *shutdown.Manager, healthManager *health.Manager,
|
||||
node *p2p.Node, ps *pubsub.PubSub, mdnsDiscovery interface{}, electionManagers interface{},
|
||||
httpServer *api.HTTPServer, ucxiServer *ucxi.Server, taskCoordinator interface{}, dhtNode *kadht.IpfsDHT) {
|
||||
node *p2p.Node, ps *pubsub.PubSub, mdnsDiscovery interface{}, electionManager interface{},
|
||||
httpServer *api.HTTPServer, ucxiServer *ucxi.Server, taskCoordinator interface{}, dhtNode *dht.LibP2PDHT) {
|
||||
|
||||
// Health manager (stop health checks early)
|
||||
healthComponent := shutdown.NewGenericComponent("health-manager", 10, true).
|
||||
@@ -1129,4 +1147,486 @@ func testEndToEndDecisionFlow(publisher *ucxl.DecisionPublisher, storage *dht.En
|
||||
fmt.Printf("🔐 All decisions encrypted with role-based Age encryption\n")
|
||||
fmt.Printf("🕸️ Content stored in distributed DHT with local caching\n")
|
||||
fmt.Printf("🔍 Content discoverable and retrievable by authorized roles\n")
|
||||
}
|
||||
|
||||
// startSetupMode starts the web-based configuration interface
|
||||
func startSetupMode(configPath string) {
|
||||
fmt.Println("🌐 Starting web-based setup interface...")
|
||||
fmt.Printf("📂 Configuration will be saved to: %s\n", configPath)
|
||||
|
||||
// Create setup-only HTTP server
|
||||
setupServer := &http.Server{
|
||||
Addr: ":8090",
|
||||
ReadTimeout: 15 * time.Second,
|
||||
WriteTimeout: 15 * time.Second,
|
||||
IdleTimeout: 60 * time.Second,
|
||||
}
|
||||
|
||||
// Setup routes
|
||||
http.HandleFunc("/", handleSetupUI)
|
||||
http.HandleFunc("/setup/", handleSetupUI)
|
||||
|
||||
// API routes for setup
|
||||
setupManager := api.NewSetupManager(configPath)
|
||||
http.HandleFunc("/api/setup/required", corsHandler(handleSetupRequired(setupManager)))
|
||||
http.HandleFunc("/api/setup/system", corsHandler(handleSystemDetection(setupManager)))
|
||||
http.HandleFunc("/api/setup/repository/validate", corsHandler(handleRepositoryValidation(setupManager)))
|
||||
http.HandleFunc("/api/setup/repository/providers", corsHandler(handleRepositoryProviders(setupManager)))
|
||||
http.HandleFunc("/api/setup/license/validate", corsHandler(handleLicenseValidation(setupManager)))
|
||||
http.HandleFunc("/api/setup/validate", corsHandler(handleConfigValidation(setupManager)))
|
||||
http.HandleFunc("/api/setup/save", corsHandler(handleConfigSave(setupManager)))
|
||||
http.HandleFunc("/api/setup/discover-machines", corsHandler(handleDiscoverMachines(setupManager)))
|
||||
http.HandleFunc("/api/setup/test-ssh", corsHandler(handleTestSSH(setupManager)))
|
||||
http.HandleFunc("/api/setup/deploy-service", corsHandler(handleDeployService(setupManager)))
|
||||
http.HandleFunc("/api/health", corsHandler(handleSetupHealth))
|
||||
|
||||
fmt.Printf("🎯 Setup interface available at: http://localhost:8090\n")
|
||||
fmt.Printf("🔧 Complete the setup to start BZZZ in full mode\n")
|
||||
fmt.Printf("📄 Press Ctrl+C to exit setup\n")
|
||||
|
||||
if err := setupServer.ListenAndServe(); err != nil && err != http.ErrServerClosed {
|
||||
log.Fatalf("Setup server failed: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
// handleSetupUI serves the embedded web UI or fallback page
|
||||
func handleSetupUI(w http.ResponseWriter, r *http.Request) {
|
||||
// Enable CORS
|
||||
w.Header().Set("Access-Control-Allow-Origin", "*")
|
||||
w.Header().Set("Access-Control-Allow-Methods", "GET, POST, PUT, DELETE, OPTIONS")
|
||||
w.Header().Set("Access-Control-Allow-Headers", "Content-Type, Authorization")
|
||||
|
||||
if r.Method == "OPTIONS" {
|
||||
w.WriteHeader(http.StatusOK)
|
||||
return
|
||||
}
|
||||
|
||||
// Determine file path
|
||||
path := r.URL.Path
|
||||
if path == "/" || path == "/setup" || path == "/setup/" {
|
||||
path = "/index.html"
|
||||
}
|
||||
|
||||
// Remove /setup prefix if present
|
||||
if len(path) > 6 && path[:6] == "/setup" {
|
||||
path = path[6:]
|
||||
}
|
||||
|
||||
// Try to serve from embedded file system
|
||||
if web.IsEmbeddedFileAvailable(path) {
|
||||
web.ServeEmbeddedFile(w, r, path)
|
||||
} else if web.IsEmbeddedFileAvailable("index.html") {
|
||||
// Fallback to index.html for SPA routing
|
||||
web.ServeEmbeddedFile(w, r, "index.html")
|
||||
} else {
|
||||
// Serve placeholder page if web UI not built
|
||||
web.ServeEmbeddedFile(w, r, "index.html")
|
||||
}
|
||||
}
|
||||
|
||||
// corsHandler wraps handlers with CORS support
|
||||
func corsHandler(handler http.HandlerFunc) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
w.Header().Set("Access-Control-Allow-Origin", "*")
|
||||
w.Header().Set("Access-Control-Allow-Methods", "GET, POST, PUT, DELETE, OPTIONS")
|
||||
w.Header().Set("Access-Control-Allow-Headers", "Content-Type, Authorization")
|
||||
|
||||
if r.Method == "OPTIONS" {
|
||||
w.WriteHeader(http.StatusOK)
|
||||
return
|
||||
}
|
||||
|
||||
handler(w, r)
|
||||
}
|
||||
}
|
||||
|
||||
// Setup API handlers (simplified versions)
|
||||
func handleSetupRequired(sm *api.SetupManager) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
w.Header().Set("Content-Type", "application/json")
|
||||
response := map[string]interface{}{
|
||||
"setup_required": sm.IsSetupRequired(),
|
||||
"timestamp": time.Now().Unix(),
|
||||
}
|
||||
json.NewEncoder(w).Encode(response)
|
||||
}
|
||||
}
|
||||
|
||||
func handleSystemDetection(sm *api.SetupManager) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
w.Header().Set("Content-Type", "application/json")
|
||||
systemInfo, err := sm.DetectSystemInfo()
|
||||
if err != nil {
|
||||
http.Error(w, fmt.Sprintf("System detection failed: %v", err), http.StatusInternalServerError)
|
||||
return
|
||||
}
|
||||
response := map[string]interface{}{
|
||||
"system_info": systemInfo,
|
||||
"timestamp": time.Now().Unix(),
|
||||
}
|
||||
json.NewEncoder(w).Encode(response)
|
||||
}
|
||||
}
|
||||
|
||||
func handleRepositoryValidation(sm *api.SetupManager) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
w.Header().Set("Content-Type", "application/json")
|
||||
|
||||
if r.Method != "POST" {
|
||||
http.Error(w, "Method not allowed", http.StatusMethodNotAllowed)
|
||||
return
|
||||
}
|
||||
|
||||
var repoConfig api.RepositoryConfig
|
||||
if err := json.NewDecoder(r.Body).Decode(&repoConfig); err != nil {
|
||||
http.Error(w, "Invalid JSON payload", http.StatusBadRequest)
|
||||
return
|
||||
}
|
||||
|
||||
if err := sm.ValidateRepositoryConfig(&repoConfig); err != nil {
|
||||
response := map[string]interface{}{
|
||||
"valid": false,
|
||||
"error": err.Error(),
|
||||
"timestamp": time.Now().Unix(),
|
||||
}
|
||||
w.WriteHeader(http.StatusBadRequest)
|
||||
json.NewEncoder(w).Encode(response)
|
||||
return
|
||||
}
|
||||
|
||||
response := map[string]interface{}{
|
||||
"valid": true,
|
||||
"message": "Repository configuration is valid",
|
||||
"timestamp": time.Now().Unix(),
|
||||
}
|
||||
json.NewEncoder(w).Encode(response)
|
||||
}
|
||||
}
|
||||
|
||||
func handleRepositoryProviders(sm *api.SetupManager) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
w.Header().Set("Content-Type", "application/json")
|
||||
providers := sm.GetSupportedProviders()
|
||||
response := map[string]interface{}{
|
||||
"providers": providers,
|
||||
"timestamp": time.Now().Unix(),
|
||||
}
|
||||
json.NewEncoder(w).Encode(response)
|
||||
}
|
||||
}
|
||||
|
||||
func handleConfigValidation(sm *api.SetupManager) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
w.Header().Set("Content-Type", "application/json")
|
||||
|
||||
if r.Method != "POST" {
|
||||
http.Error(w, "Method not allowed", http.StatusMethodNotAllowed)
|
||||
return
|
||||
}
|
||||
|
||||
var setupConfig api.SetupConfig
|
||||
if err := json.NewDecoder(r.Body).Decode(&setupConfig); err != nil {
|
||||
http.Error(w, "Invalid JSON payload", http.StatusBadRequest)
|
||||
return
|
||||
}
|
||||
|
||||
errors := []string{}
|
||||
if setupConfig.AgentID == "" {
|
||||
errors = append(errors, "agent_id is required")
|
||||
}
|
||||
if len(setupConfig.Capabilities) == 0 {
|
||||
errors = append(errors, "at least one capability is required")
|
||||
}
|
||||
if len(setupConfig.Models) == 0 {
|
||||
errors = append(errors, "at least one model is required")
|
||||
}
|
||||
|
||||
if setupConfig.Repository != nil {
|
||||
if err := sm.ValidateRepositoryConfig(setupConfig.Repository); err != nil {
|
||||
errors = append(errors, fmt.Sprintf("repository configuration: %v", err))
|
||||
}
|
||||
}
|
||||
|
||||
if len(errors) > 0 {
|
||||
response := map[string]interface{}{
|
||||
"valid": false,
|
||||
"errors": errors,
|
||||
"timestamp": time.Now().Unix(),
|
||||
}
|
||||
w.WriteHeader(http.StatusBadRequest)
|
||||
json.NewEncoder(w).Encode(response)
|
||||
return
|
||||
}
|
||||
|
||||
response := map[string]interface{}{
|
||||
"valid": true,
|
||||
"message": "Configuration is valid",
|
||||
"timestamp": time.Now().Unix(),
|
||||
}
|
||||
json.NewEncoder(w).Encode(response)
|
||||
}
|
||||
}
|
||||
|
||||
func handleConfigSave(sm *api.SetupManager) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
w.Header().Set("Content-Type", "application/json")
|
||||
|
||||
if r.Method != "POST" {
|
||||
http.Error(w, "Method not allowed", http.StatusMethodNotAllowed)
|
||||
return
|
||||
}
|
||||
|
||||
var setupConfig api.SetupConfig
|
||||
if err := json.NewDecoder(r.Body).Decode(&setupConfig); err != nil {
|
||||
http.Error(w, "Invalid JSON payload", http.StatusBadRequest)
|
||||
return
|
||||
}
|
||||
|
||||
if setupConfig.AgentID == "" {
|
||||
http.Error(w, "agent_id is required", http.StatusBadRequest)
|
||||
return
|
||||
}
|
||||
|
||||
if setupConfig.Repository != nil {
|
||||
if err := sm.ValidateRepositoryConfig(setupConfig.Repository); err != nil {
|
||||
http.Error(w, fmt.Sprintf("Invalid repository configuration: %v", err), http.StatusBadRequest)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
if err := sm.SaveConfiguration(&setupConfig); err != nil {
|
||||
http.Error(w, fmt.Sprintf("Failed to save configuration: %v", err), http.StatusInternalServerError)
|
||||
return
|
||||
}
|
||||
|
||||
response := map[string]interface{}{
|
||||
"success": true,
|
||||
"message": "Configuration saved successfully",
|
||||
"timestamp": time.Now().Unix(),
|
||||
"restart_required": true,
|
||||
}
|
||||
json.NewEncoder(w).Encode(response)
|
||||
}
|
||||
}
|
||||
|
||||
func handleLicenseValidation(sm *api.SetupManager) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
w.Header().Set("Content-Type", "application/json")
|
||||
|
||||
if r.Method != "POST" {
|
||||
http.Error(w, "Method not allowed", http.StatusMethodNotAllowed)
|
||||
return
|
||||
}
|
||||
|
||||
var licenseRequest struct {
|
||||
Email string `json:"email"`
|
||||
LicenseKey string `json:"licenseKey"`
|
||||
OrganizationName string `json:"organizationName,omitempty"`
|
||||
}
|
||||
|
||||
if err := json.NewDecoder(r.Body).Decode(&licenseRequest); err != nil {
|
||||
http.Error(w, "Invalid JSON payload", http.StatusBadRequest)
|
||||
return
|
||||
}
|
||||
|
||||
// Validate input
|
||||
if licenseRequest.Email == "" {
|
||||
response := map[string]interface{}{
|
||||
"valid": false,
|
||||
"message": "Email is required",
|
||||
"timestamp": time.Now().Unix(),
|
||||
}
|
||||
w.WriteHeader(http.StatusBadRequest)
|
||||
json.NewEncoder(w).Encode(response)
|
||||
return
|
||||
}
|
||||
|
||||
if licenseRequest.LicenseKey == "" {
|
||||
response := map[string]interface{}{
|
||||
"valid": false,
|
||||
"message": "License key is required",
|
||||
"timestamp": time.Now().Unix(),
|
||||
}
|
||||
w.WriteHeader(http.StatusBadRequest)
|
||||
json.NewEncoder(w).Encode(response)
|
||||
return
|
||||
}
|
||||
|
||||
// Mock license validation logic
|
||||
// In production, this would call a license server API
|
||||
validLicenseKey := "BZZZ-2025-DEMO-EVAL-001"
|
||||
|
||||
if licenseRequest.LicenseKey != validLicenseKey {
|
||||
response := map[string]interface{}{
|
||||
"valid": false,
|
||||
"message": "Invalid license key. Please check your license key and try again.",
|
||||
"timestamp": time.Now().Unix(),
|
||||
}
|
||||
w.WriteHeader(http.StatusUnauthorized)
|
||||
json.NewEncoder(w).Encode(response)
|
||||
return
|
||||
}
|
||||
|
||||
// License is valid - return success with details
|
||||
response := map[string]interface{}{
|
||||
"valid": true,
|
||||
"message": "License validated successfully",
|
||||
"timestamp": time.Now().Unix(),
|
||||
"details": map[string]interface{}{
|
||||
"licenseType": "Evaluation",
|
||||
"maxNodes": "5",
|
||||
"expiresAt": "2025-12-31",
|
||||
"features": []string{
|
||||
"Distributed Task Coordination",
|
||||
"AI Model Integration",
|
||||
"Repository Management",
|
||||
"Cluster Formation",
|
||||
"Security Features",
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
json.NewEncoder(w).Encode(response)
|
||||
}
|
||||
}
|
||||
|
||||
func handleSetupHealth(w http.ResponseWriter, r *http.Request) {
|
||||
w.Header().Set("Content-Type", "application/json")
|
||||
health := map[string]interface{}{
|
||||
"status": "setup_mode",
|
||||
"timestamp": time.Now().Unix(),
|
||||
"web_ui": web.IsEmbeddedFileAvailable("index.html"),
|
||||
}
|
||||
json.NewEncoder(w).Encode(health)
|
||||
}
|
||||
|
||||
// handleDiscoverMachines discovers machines on the network subnet
|
||||
func handleDiscoverMachines(sm *api.SetupManager) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
if r.Method != "POST" {
|
||||
http.Error(w, "Method not allowed", http.StatusMethodNotAllowed)
|
||||
return
|
||||
}
|
||||
|
||||
var request struct {
|
||||
Subnet string `json:"subnet"`
|
||||
SSHKey string `json:"sshKey"`
|
||||
}
|
||||
|
||||
if err := json.NewDecoder(r.Body).Decode(&request); err != nil {
|
||||
http.Error(w, "Invalid request body", http.StatusBadRequest)
|
||||
return
|
||||
}
|
||||
|
||||
machines, err := sm.DiscoverNetworkMachines(request.Subnet, request.SSHKey)
|
||||
if err != nil {
|
||||
w.Header().Set("Content-Type", "application/json")
|
||||
json.NewEncoder(w).Encode(map[string]interface{}{
|
||||
"success": false,
|
||||
"error": err.Error(),
|
||||
"machines": []interface{}{},
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
w.Header().Set("Content-Type", "application/json")
|
||||
json.NewEncoder(w).Encode(map[string]interface{}{
|
||||
"success": true,
|
||||
"machines": machines,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// handleTestSSH tests SSH connection to a machine
|
||||
func handleTestSSH(sm *api.SetupManager) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
if r.Method != "POST" {
|
||||
http.Error(w, "Method not allowed", http.StatusMethodNotAllowed)
|
||||
return
|
||||
}
|
||||
|
||||
var request struct {
|
||||
IP string `json:"ip"`
|
||||
SSHKey string `json:"sshKey"`
|
||||
SSHUsername string `json:"sshUsername"`
|
||||
SSHPassword string `json:"sshPassword"`
|
||||
SSHPort int `json:"sshPort"`
|
||||
}
|
||||
|
||||
if err := json.NewDecoder(r.Body).Decode(&request); err != nil {
|
||||
http.Error(w, "Invalid request body", http.StatusBadRequest)
|
||||
return
|
||||
}
|
||||
|
||||
result, err := sm.TestSSHConnection(request.IP, request.SSHKey, request.SSHUsername, request.SSHPassword, request.SSHPort)
|
||||
if err != nil {
|
||||
w.Header().Set("Content-Type", "application/json")
|
||||
json.NewEncoder(w).Encode(map[string]interface{}{
|
||||
"success": false,
|
||||
"error": err.Error(),
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
w.Header().Set("Content-Type", "application/json")
|
||||
json.NewEncoder(w).Encode(result)
|
||||
}
|
||||
}
|
||||
|
||||
// handleDeployService deploys BZZZ service to a machine
|
||||
func handleDeployService(sm *api.SetupManager) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
if r.Method != "POST" {
|
||||
http.Error(w, "Method not allowed", http.StatusMethodNotAllowed)
|
||||
return
|
||||
}
|
||||
|
||||
var request struct {
|
||||
IP string `json:"ip"`
|
||||
SSHKey string `json:"sshKey"`
|
||||
SSHUsername string `json:"sshUsername"`
|
||||
SSHPassword string `json:"sshPassword"`
|
||||
SSHPort int `json:"sshPort"`
|
||||
Config struct {
|
||||
Ports struct {
|
||||
API int `json:"api"`
|
||||
MCP int `json:"mcp"`
|
||||
WebUI int `json:"webui"`
|
||||
P2P int `json:"p2p"`
|
||||
} `json:"ports"`
|
||||
Security interface{} `json:"security"`
|
||||
AutoStart bool `json:"autoStart"`
|
||||
} `json:"config"`
|
||||
}
|
||||
|
||||
if err := json.NewDecoder(r.Body).Decode(&request); err != nil {
|
||||
http.Error(w, "Invalid request body", http.StatusBadRequest)
|
||||
return
|
||||
}
|
||||
|
||||
// Convert the struct config to a map[string]interface{} format that the backend expects
|
||||
configMap := map[string]interface{}{
|
||||
"ports": map[string]interface{}{
|
||||
"api": request.Config.Ports.API,
|
||||
"mcp": request.Config.Ports.MCP,
|
||||
"webui": request.Config.Ports.WebUI,
|
||||
"p2p": request.Config.Ports.P2P,
|
||||
},
|
||||
"security": request.Config.Security,
|
||||
"autoStart": request.Config.AutoStart,
|
||||
}
|
||||
|
||||
result, err := sm.DeployServiceToMachine(request.IP, request.SSHKey, request.SSHUsername, request.SSHPassword, request.SSHPort, configMap)
|
||||
if err != nil {
|
||||
w.Header().Set("Content-Type", "application/json")
|
||||
json.NewEncoder(w).Encode(map[string]interface{}{
|
||||
"success": false,
|
||||
"error": err.Error(),
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
w.Header().Set("Content-Type", "application/json")
|
||||
json.NewEncoder(w).Encode(result)
|
||||
}
|
||||
}
|
||||
1
mcp-server/node_modules/.bin/acorn
generated
vendored
1
mcp-server/node_modules/.bin/acorn
generated
vendored
@@ -1 +0,0 @@
|
||||
../acorn/bin/acorn
|
||||
1
mcp-server/node_modules/.bin/browserslist
generated
vendored
1
mcp-server/node_modules/.bin/browserslist
generated
vendored
@@ -1 +0,0 @@
|
||||
../browserslist/cli.js
|
||||
1
mcp-server/node_modules/.bin/create-jest
generated
vendored
1
mcp-server/node_modules/.bin/create-jest
generated
vendored
@@ -1 +0,0 @@
|
||||
../create-jest/bin/create-jest.js
|
||||
1
mcp-server/node_modules/.bin/eslint
generated
vendored
1
mcp-server/node_modules/.bin/eslint
generated
vendored
@@ -1 +0,0 @@
|
||||
../eslint/bin/eslint.js
|
||||
1
mcp-server/node_modules/.bin/esparse
generated
vendored
1
mcp-server/node_modules/.bin/esparse
generated
vendored
@@ -1 +0,0 @@
|
||||
../esprima/bin/esparse.js
|
||||
1
mcp-server/node_modules/.bin/esvalidate
generated
vendored
1
mcp-server/node_modules/.bin/esvalidate
generated
vendored
@@ -1 +0,0 @@
|
||||
../esprima/bin/esvalidate.js
|
||||
1
mcp-server/node_modules/.bin/handlebars
generated
vendored
1
mcp-server/node_modules/.bin/handlebars
generated
vendored
@@ -1 +0,0 @@
|
||||
../handlebars/bin/handlebars
|
||||
1
mcp-server/node_modules/.bin/import-local-fixture
generated
vendored
1
mcp-server/node_modules/.bin/import-local-fixture
generated
vendored
@@ -1 +0,0 @@
|
||||
../import-local/fixtures/cli.js
|
||||
1
mcp-server/node_modules/.bin/jest
generated
vendored
1
mcp-server/node_modules/.bin/jest
generated
vendored
@@ -1 +0,0 @@
|
||||
../jest/bin/jest.js
|
||||
1
mcp-server/node_modules/.bin/js-yaml
generated
vendored
1
mcp-server/node_modules/.bin/js-yaml
generated
vendored
@@ -1 +0,0 @@
|
||||
../js-yaml/bin/js-yaml.js
|
||||
1
mcp-server/node_modules/.bin/jsesc
generated
vendored
1
mcp-server/node_modules/.bin/jsesc
generated
vendored
@@ -1 +0,0 @@
|
||||
../jsesc/bin/jsesc
|
||||
1
mcp-server/node_modules/.bin/json5
generated
vendored
1
mcp-server/node_modules/.bin/json5
generated
vendored
@@ -1 +0,0 @@
|
||||
../json5/lib/cli.js
|
||||
1
mcp-server/node_modules/.bin/node-which
generated
vendored
1
mcp-server/node_modules/.bin/node-which
generated
vendored
@@ -1 +0,0 @@
|
||||
../which/bin/node-which
|
||||
1
mcp-server/node_modules/.bin/openai
generated
vendored
1
mcp-server/node_modules/.bin/openai
generated
vendored
@@ -1 +0,0 @@
|
||||
../openai/bin/cli
|
||||
1
mcp-server/node_modules/.bin/parser
generated
vendored
1
mcp-server/node_modules/.bin/parser
generated
vendored
@@ -1 +0,0 @@
|
||||
../@babel/parser/bin/babel-parser.js
|
||||
1
mcp-server/node_modules/.bin/prettier
generated
vendored
1
mcp-server/node_modules/.bin/prettier
generated
vendored
@@ -1 +0,0 @@
|
||||
../prettier/bin/prettier.cjs
|
||||
1
mcp-server/node_modules/.bin/resolve
generated
vendored
1
mcp-server/node_modules/.bin/resolve
generated
vendored
@@ -1 +0,0 @@
|
||||
../resolve/bin/resolve
|
||||
1
mcp-server/node_modules/.bin/rimraf
generated
vendored
1
mcp-server/node_modules/.bin/rimraf
generated
vendored
@@ -1 +0,0 @@
|
||||
../rimraf/bin.js
|
||||
1
mcp-server/node_modules/.bin/semver
generated
vendored
1
mcp-server/node_modules/.bin/semver
generated
vendored
@@ -1 +0,0 @@
|
||||
../semver/bin/semver.js
|
||||
1
mcp-server/node_modules/.bin/ts-jest
generated
vendored
1
mcp-server/node_modules/.bin/ts-jest
generated
vendored
@@ -1 +0,0 @@
|
||||
../ts-jest/cli.js
|
||||
1
mcp-server/node_modules/.bin/ts-node
generated
vendored
1
mcp-server/node_modules/.bin/ts-node
generated
vendored
@@ -1 +0,0 @@
|
||||
../ts-node/dist/bin.js
|
||||
1
mcp-server/node_modules/.bin/ts-node-cwd
generated
vendored
1
mcp-server/node_modules/.bin/ts-node-cwd
generated
vendored
@@ -1 +0,0 @@
|
||||
../ts-node/dist/bin-cwd.js
|
||||
1
mcp-server/node_modules/.bin/ts-node-esm
generated
vendored
1
mcp-server/node_modules/.bin/ts-node-esm
generated
vendored
@@ -1 +0,0 @@
|
||||
../ts-node/dist/bin-esm.js
|
||||
1
mcp-server/node_modules/.bin/ts-node-script
generated
vendored
1
mcp-server/node_modules/.bin/ts-node-script
generated
vendored
@@ -1 +0,0 @@
|
||||
../ts-node/dist/bin-script.js
|
||||
1
mcp-server/node_modules/.bin/ts-node-transpile-only
generated
vendored
1
mcp-server/node_modules/.bin/ts-node-transpile-only
generated
vendored
@@ -1 +0,0 @@
|
||||
../ts-node/dist/bin-transpile.js
|
||||
1
mcp-server/node_modules/.bin/ts-script
generated
vendored
1
mcp-server/node_modules/.bin/ts-script
generated
vendored
@@ -1 +0,0 @@
|
||||
../ts-node/dist/bin-script-deprecated.js
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user