🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
5.0 KiB
5.0 KiB
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
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
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