refactor: migrate blockchain CLI commands to use centralized config and update port assignments

- Replace load_multichain_config() with ctx.obj['config'] in all blockchain commands
- Update blockchain RPC port from 8003 to 8006 throughout CLI
- Add blockchain_rpc_url and wallet_url fields to Config class with environment variable support
- Update node status command to use new port logic (8006 for primary, 8026 for dev)
- Update installation docs to reflect new blockchain RPC port (8006)
- Update
This commit is contained in:
oib
2026-03-06 10:25:57 +01:00
parent 1511e7e7f5
commit a302da73a9
14 changed files with 1754 additions and 110 deletions

View File

@@ -70,7 +70,7 @@ Create `apps/blockchain-node/.env`:
```env
CHAIN_ID=ait-devnet
RPC_BIND_HOST=0.0.0.0
RPC_BIND_PORT=8080
RPC_BIND_PORT=8006 # Updated to new blockchain RPC port
MEMPOOL_BACKEND=database
```

View File

@@ -2,7 +2,7 @@
## 🚀 Overview
This guide provides step-by-step instructions for implementing and deploying the AITBC Enhanced Services, including 7 new services running on ports 8002-8007 with systemd integration.
This guide provides step-by-step instructions for implementing and deploying the AITBC Enhanced Services, including 7 new services running on ports 8010-8017 with systemd integration.
## 📋 Prerequisites
@@ -128,22 +128,26 @@ cd /opt/aitbc/apps/coordinator-api
| Service | Port | Description | Resources | Status |
|---------|------|-------------|------------|--------|
| Multi-Modal Agent | 8002 | Text, image, audio, video processing | 2GB RAM, 200% CPU | ✅ |
| GPU Multi-Modal | 8003 | CUDA-optimized attention mechanisms | 4GB RAM, 300% CPU | ✅ |
| Modality Optimization | 8004 | Specialized optimization strategies | 1GB RAM, 150% CPU | ✅ |
| Adaptive Learning | 8005 | Reinforcement learning frameworks | 3GB RAM, 250% CPU | ✅ |
| Enhanced Marketplace | 8006 | Royalties, licensing, verification | 2GB RAM, 200% CPU | ✅ |
| OpenClaw Enhanced | 8007 | Agent orchestration, edge computing | 2GB RAM, 200% CPU | ✅ |
| Multi-Modal Agent | 8010 | Text, image, audio, video processing | 2GB RAM, 200% CPU | ✅ |
| GPU Multi-Modal | 8011 | CUDA-optimized attention mechanisms | 4GB RAM, 300% CPU | ✅ |
| Modality Optimization | 8012 | Specialized optimization strategies | 1GB RAM, 150% CPU | ✅ |
| Adaptive Learning | 8013 | Reinforcement learning frameworks | 3GB RAM, 250% CPU | ✅ |
| Enhanced Marketplace | 8014 | Royalties, licensing, verification | 2GB RAM, 200% CPU | ✅ |
| OpenClaw Enhanced | 8015 | Agent orchestration, edge computing | 2GB RAM, 200% CPU | ✅ |
| Web UI Service | 8016 | Web interface for all services | 1GB RAM, 100% CPU | ✅ |
| Geographic Load Balancer | 8017 | Geographic distribution | 1GB RAM, 100% CPU | ✅ |
### Health Check Endpoints
```bash
# Check all services
curl http://localhost:8002/health # Multi-Modal
curl http://localhost:8003/health # GPU Multi-Modal
curl http://localhost:8004/health # Modality Optimization
curl http://localhost:8005/health # Adaptive Learning
curl http://localhost:8006/health # Enhanced Marketplace
curl http://localhost:8007/health # OpenClaw Enhanced
curl http://localhost:8010/health # Multi-Modal
curl http://localhost:8011/health # GPU Multi-Modal
curl http://localhost:8012/health # Modality Optimization
curl http://localhost:8013/health # Adaptive Learning
curl http://localhost:8014/health # Enhanced Marketplace
curl http://localhost:8015/health # OpenClaw Enhanced
curl http://localhost:8016/health # Web UI Service
curl http://localhost:8017/health # Geographic Load Balancer
```
## 🧪 Testing
@@ -158,12 +162,12 @@ python demo_client_miner_workflow.py
### 2. Multi-Modal Processing Test
```bash
# Test text processing
curl -X POST http://localhost:8002/process \
curl -X POST http://localhost:8010/process \
-H "Content-Type: application/json" \
-d '{"modality": "text", "input": "Hello AITBC!"}'
# Test image processing
curl -X POST http://localhost:8002/process \
curl -X POST http://localhost:8010/process \
-H "Content-Type: application/json" \
-d '{"modality": "image", "input": "base64_encoded_image"}'
```
@@ -171,7 +175,7 @@ curl -X POST http://localhost:8002/process \
### 3. GPU Performance Test
```bash
# Test GPU multi-modal service
curl -X POST http://localhost:8003/process \
curl -X POST http://localhost:8011/process \
-H "Content-Type: application/json" \
-d '{"modality": "text", "input": "GPU accelerated test", "use_gpu": true}'
```
@@ -270,7 +274,7 @@ ls -la /dev/nvidia*
netstat -tuln | grep :800
# Kill conflicting processes
sudo fuser -k 8002/tcp
sudo fuser -k 8010/tcp
```
#### 4. Memory Issues
@@ -318,10 +322,10 @@ sudo systemctl edit aitbc-multimodal.service
### Monitoring Metrics
```bash
# Response time metrics
curl -w "@curl-format.txt" -o /dev/null -s http://localhost:8002/health
curl -w "@curl-format.txt" -o /dev/null -s http://localhost:8010/health
# Throughput testing
ab -n 1000 -c 10 http://localhost:8002/health
ab -n 1000 -c 10 http://localhost:8010/health
# GPU utilization
nvidia-smi dmon -s u

View File

@@ -47,15 +47,18 @@ Internet → aitbc.bubuit.net (HTTPS :443)
└──────────────────────────────────────────────┘
```
## Port Logic Implementation (March 4, 2026)
## Port Logic Implementation (Updated March 6, 2026)
### **Core Services (8000-8003)**
### **Core Services (8000-8002)**
- **Port 8000**: Coordinator API ✅ PRODUCTION READY
- **Port 8001**: Exchange API ✅ PRODUCTION READY
- **Port 8002**: Blockchain Node (internal) ✅ PRODUCTION READY
- **Port 8003**: Blockchain RPC ✅ PRODUCTION READY
- **Port 8002**: Wallet Service ✅ PRODUCTION READY (aitbc-wallet.service - localhost + containers)
### **Enhanced Services (8010-8017)**
### **Blockchain Services (8005-8006)**
- **Port 8005**: Primary Blockchain Node ✅ PRODUCTION READY (aitbc-blockchain-node.service - localhost + containers)
- **Port 8006**: Primary Blockchain RPC ✅ PRODUCTION READY (aitbc-blockchain-rpc.service - localhost + containers)
### **Level 2 Services (8010-8017) - NEW STANDARD**
- **Port 8010**: Multimodal GPU Service ✅ PRODUCTION READY (CPU-only mode)
- **Port 8011**: GPU Multimodal Service ✅ PRODUCTION READY (CPU-only mode)
- **Port 8012**: Modality Optimization Service ✅ PRODUCTION READY
@@ -65,8 +68,33 @@ Internet → aitbc.bubuit.net (HTTPS :443)
- **Port 8016**: Web UI Service ✅ PRODUCTION READY
- **Port 8017**: Geographic Load Balancer ✅ PRODUCTION READY
### **Mock & Test Services (8020-8029)**
- **Port 8020**: Mock Coordinator API ✅ TESTING READY
- **Port 8021**: Coordinator API (dev) ✅ TESTING READY
- **Port 8022**: Test Blockchain Node (localhost) ✅ TESTING READY
- **Port 8023**: Mock Exchange API ✅ TESTING READY
- **Port 8024**: Mock Blockchain RPC ✅ TESTING READY
- **Port 8025**: Development Blockchain Node ✅ TESTING READY (aitbc-blockchain-node-dev.service)
- **Port 8026**: Development Blockchain RPC ✅ TESTING READY (aitbc-blockchain-rpc-dev.service)
- **Port 8027**: Load Testing Endpoint ✅ TESTING READY
- **Port 8028**: Integration Test API ✅ TESTING READY
- **Port 8029**: Performance Monitor ✅ TESTING READY
### **Container Services (8080-8089) - LEGACY**
- **Port 8080**: Container Coordinator API (aitbc) ⚠️ LEGACY - Use port 8000-8003 range
- **Port 8081**: Container Blockchain Node 1 ⚠️ LEGACY - Use port 8010+ range
- **Port 8082**: Container Exchange API ⚠️ LEGACY - Use port 8010+ range
- **Port 8083**: Container Wallet Daemon ⚠️ LEGACY - Use port 8010+ range
- **Port 8084**: Container Blockchain Node 2 ⚠️ LEGACY - Use port 8010+ range
- **Port 8085**: Container Explorer UI ⚠️ LEGACY - Use port 8010+ range
- **Port 8086**: Container Marketplace ⚠️ LEGACY - Use port 8010+ range
- **Port 8087**: Container Miner Dashboard ⚠️ LEGACY - Use port 8010+ range
- **Port 8088**: Container Load Balancer ⚠️ LEGACY - Use port 8010+ range
- **Port 8089**: Container Debug API ⚠️ LEGACY - Use port 8010+ range
### **Legacy Ports (Decommissioned)**
- **Port 8080**: No longer used by AITBC
- **Port 8003**: Previously Primary Blockchain RPC - Decommissioned (moved to port 8006)
- **Port 8090**: No longer used by AITBC
- **Port 9080**: Successfully decommissioned
- **Port 8009**: No longer in use
@@ -644,3 +672,117 @@ WALLET_ENCRYPTION_KEY=<key>
HOST=0.0.0.0 # For container access
PORT=8010-8017 # Enhanced services port range
```
### Container Access & Port Logic (Updated March 6, 2026)
#### **SSH-Based Container Access**
```bash
# Access aitbc container
ssh aitbc-cascade
# Access aitbc1 container
ssh aitbc1-cascade
# Check services in containers
ssh aitbc-cascade 'systemctl list-units | grep aitbc-'
ssh aitbc1-cascade 'systemctl list-units | grep aitbc-'
# Debug specific services
ssh aitbc-cascade 'systemctl status aitbc-coordinator-api'
ssh aitbc1-cascade 'systemctl status aitbc-wallet'
```
#### **Port Distribution Strategy - NEW STANDARD**
```bash
# === NEW STANDARD PORT LOGIC ===
# Core Services (8000-8003) - NEW STANDARD
- Port 8000: Coordinator API (local) ✅ NEW STANDARD
- Port 8001: Exchange API (local) ✅ NEW STANDARD
- Port 8002: Blockchain Node (local) ✅ NEW STANDARD
- Port 8003: Blockchain RPC (local) ✅ NEW STANDARD
# Blockchain Services (8004-8005) - PRODUCTION READY
- Port 8004: Primary Blockchain Node ✅ PRODUCTION READY (aitbc-blockchain-node.service)
- Port 8005: Blockchain RPC 2 ✅ PRODUCTION READY
# Level 2 Services (8010-8017) - NEW STANDARD
- Port 8010: Multimodal GPU Service ✅ NEW STANDARD
- Port 8011: GPU Multimodal Service ✅ NEW STANDARD
- Port 8012: Modality Optimization Service ✅ NEW STANDARD
- Port 8013: Adaptive Learning Service ✅ NEW STANDARD
- Port 8014: Marketplace Enhanced Service ✅ NEW STANDARD
- Port 8015: OpenClaw Enhanced Service ✅ NEW STANDARD
- Port 8016: Web UI Service ✅ NEW STANDARD
- Port 8017: Geographic Load Balancer ✅ NEW STANDARD
# Mock & Test Services (8020-8029) - NEW STANDARD
- Port 8020: Mock Coordinator API ✅ NEW STANDARD
- Port 8021: Coordinator API (dev) ✅ NEW STANDARD
- Port 8022: Test Blockchain Node (localhost) ✅ NEW STANDARD
- Port 8025: Development Blockchain Node ✅ NEW STANDARD (aitbc-blockchain-node-dev.service)
- Port 8026-8029: Additional testing services ✅ NEW STANDARD
# === LEGACY PORTS (DEPRECATED) ===
# Legacy Container Services (8080-8089) - DEPRECATED
- Port 8080-8089: All container services ⚠️ DEPRECATED - Use 8000+ and 8010+ ranges
```
#### **Service Naming Convention**
```bash
# === STANDARDIZED SERVICE NAMES ===
# Primary Production Services:
✅ aitbc-blockchain-node.service (port 8005) - Primary blockchain node
✅ aitbc-blockchain-rpc.service (port 8006) - Primary blockchain RPC (localhost + containers)
✅ aitbc-coordinator-api.service (port 8000) - Main coordinator API
✅ aitbc-exchange-api.service (port 8001) - Exchange API
✅ aitbc-wallet.service (port 8002) - Wallet Service (localhost + containers)
# Development/Test Services:
✅ aitbc-blockchain-node-dev.service (port 8025) - Development blockchain node
✅ aitbc-blockchain-rpc-dev.service (port 8026) - Development blockchain RPC
✅ aitbc-coordinator-api-dev.service (port 8021) - Development coordinator API
# Container Locations:
✅ localhost (at1): Primary services + development services
✅ aitbc container: Primary services + development services
✅ aitbc1 container: Primary services + development services
```
#### **Port Conflict Resolution**
```bash
# Updated port assignments - NO CONFLICTS:
# Local services use 8000-8003 range (core services)
# Blockchain services use 8004-8005 range (primary blockchain nodes)
# Level 2 services use 8010-8017 range (enhanced services)
# Mock & test services use 8020-8029 range (development services)
# Check port usage
netstat -tlnp | grep -E ":(800[0-5]|801[0-7]|802[0-9])"
ssh aitbc-cascade 'netstat -tlnp | grep -E ":(800[0-5]|801[0-7]|802[0-9])"
ssh aitbc1-cascade 'netstat -tlnp | grep -E ":(800[0-5]|801[0-7]|802[0-9])"
# Service Management Commands:
# Primary services:
systemctl status aitbc-blockchain-node.service # localhost
systemctl status aitbc-blockchain-rpc.service # localhost (port 8006)
systemctl status aitbc-wallet.service # localhost (port 8002)
ssh aitbc-cascade 'systemctl status aitbc-blockchain-node.service' # aitbc container
ssh aitbc1-cascade 'systemctl status aitbc-blockchain-node.service' # aitbc1 container
# Wallet services:
ssh aitbc-cascade 'systemctl status aitbc-wallet.service' # port 8002
ssh aitbc1-cascade 'systemctl status aitbc-wallet.service' # port 8002
# RPC services:
ssh aitbc-cascade 'systemctl status aitbc-blockchain-rpc.service' # port 8006
ssh aitbc1-cascade 'systemctl status aitbc-blockchain-rpc.service' # port 8006
ssh aitbc-cascade 'systemctl status aitbc-blockchain-rpc-dev.service' # port 8026
ssh aitbc1-cascade 'systemctl status aitbc-blockchain-rpc-dev.service' # port 8026
# Development services:
ssh aitbc-cascade 'systemctl status aitbc-blockchain-node-dev.service'
ssh aitbc1-cascade 'systemctl status aitbc-blockchain-node-dev.service'
```

View File

@@ -1,8 +1,10 @@
# AITBC Platform Deployment Guide
# AITBC Server Deployment Guide
## Overview
This guide provides comprehensive deployment instructions for the AITBC (AI Trading Blockchain Compute) platform, including infrastructure requirements, service configurations, and troubleshooting procedures. **Updated for the new port logic implementation (8000-8003, 8010-8017) and production-ready codebase.**
This guide provides comprehensive deployment instructions for the **aitbc server** (primary container), including infrastructure requirements, service configurations, and troubleshooting procedures. **Updated for the new port logic implementation (8000-8002, 8005-8006) and production-ready codebase.**
**Note**: This documentation is specific to the aitbc server. For aitbc1 server documentation, see [aitbc1.md](./aitbc1.md).
## System Requirements
@@ -21,12 +23,14 @@ This guide provides comprehensive deployment instructions for the AITBC (AI Trad
- **Database**: SQLite (default) or PostgreSQL (production)
### **Network Requirements**
- **Core Services Ports**: 8000-8003 (must be available)
- **Core Services Ports**: 8000-8002 (must be available)
- Port 8000: Coordinator API
- Port 8001: Exchange API
- Port 8002: Blockchain Node (internal)
- Port 8003: Blockchain RPC
- **Enhanced Services Ports**: 8010-8017 (optional - not required for CPU-only deployment)
- Port 8002: Wallet Service
- **Blockchain Services Ports**: 8005-8006 (must be available)
- Port 8005: Primary Blockchain Node
- Port 8006: Primary Blockchain RPC
- **Level 2 Services Ports**: 8010-8017 (optional - not required for CPU-only deployment)
- Note: Enhanced services disabled for aitbc server (no GPU access)
- Port 8010: Multimodal GPU (CPU-only mode) - DISABLED
- Port 8011: GPU Multimodal (CPU-only mode) - DISABLED
@@ -36,9 +40,80 @@ This guide provides comprehensive deployment instructions for the AITBC (AI Trad
- Port 8015: OpenClaw Enhanced - DISABLED
- Port 8016: Web UI - DISABLED
- Port 8017: Geographic Load Balancer - DISABLED
- **Firewall**: Managed by firehol on at1 host (container networking handled by incus)
- **Mock & Test Services Ports**: 8020-8029 (development and testing)
- Port 8025: Development Blockchain Node
- Port 8026: Development Blockchain RPC
- **Legacy Container Ports**: 8080-8089 (deprecated - use new port ranges)
- **Firewall**: Managed by firehol on at1 host (container networking handled by incus)
- **SSL/TLS**: Recommended for production deployments
### **Container Access & SSH Management (Updated March 6, 2026)**
#### **SSH-Based Container Access**
```bash
# Access aitbc server (primary container)
ssh aitbc-cascade
# Check aitbc server status
ssh aitbc-cascade 'systemctl status'
# List AITBC services on aitbc server
ssh aitbc-cascade 'systemctl list-units | grep aitbc-'
```
#### **Service Management via SSH**
```bash
# Start/stop services on aitbc server
ssh aitbc-cascade 'sudo systemctl start aitbc-coordinator-api'
ssh aitbc-cascade 'sudo systemctl stop aitbc-wallet'
# Check service logs on aitbc server
ssh aitbc-cascade 'sudo journalctl -f -u aitbc-coordinator-api'
# Debug service issues on aitbc server
ssh aitbc-cascade 'sudo systemctl status aitbc-coordinator-api'
ssh aitbc-cascade 'sudo systemctl status aitbc-wallet'
# Check blockchain services on aitbc server
ssh aitbc-cascade 'sudo systemctl status aitbc-blockchain-node'
ssh aitbc-cascade 'sudo systemctl status aitbc-blockchain-rpc'
# Check development services on aitbc server
ssh aitbc-cascade 'sudo systemctl status aitbc-blockchain-node-dev'
ssh aitbc-cascade 'sudo systemctl status aitbc-blockchain-rpc-dev'
```
#### **Port Distribution Strategy (Updated March 6, 2026)**
```bash
# NEW SUSTAINABLE PORT LOGIC
# Core Services (8000-8002):
- Port 8000: Coordinator API (localhost + containers)
- Port 8001: Exchange API (localhost + containers)
- Port 8002: Wallet Service (localhost + containers)
# Blockchain Services (8005-8006):
- Port 8005: Primary Blockchain Node (localhost + containers)
- Port 8006: Primary Blockchain RPC (localhost + containers)
# Level 2 Services (8010-8017):
- Port 8010-8017: Enhanced services (DISABLED for CPU-only deployment)
# Mock & Test Services (8020-8029):
- Port 8025: Development Blockchain Node (localhost + containers)
- Port 8026: Development Blockchain RPC (containers)
# Legacy Ports (8080-8089):
- Port 8080-8089: DEPRECATED - use new port ranges above
# Service Naming Convention:
✅ aitbc-blockchain-node.service (port 8005)
✅ aitbc-blockchain-rpc.service (port 8006)
✅ aitbc-wallet.service (port 8002)
✅ aitbc-blockchain-node-dev.service (port 8025)
✅ aitbc-blockchain-rpc-dev.service (port 8026)
```
## Architecture Overview
```

View File

@@ -1,16 +1,18 @@
# AITBC1 Deployment Notes
# AITBC1 Server Deployment Guide
## Overview
This document contains specific deployment notes and considerations for deploying the AITBC platform on the **aitbc** server. These notes complement the general deployment guide with server-specific configurations and troubleshooting. **Updated for optimized CPU-only deployment with enhanced services disabled.**
This document contains specific deployment notes and considerations for deploying the AITBC platform on the **aitbc1 server** (secondary container). These notes complement the general deployment guide with server-specific configurations and troubleshooting. **Updated for optimized CPU-only deployment with enhanced services disabled.**
**Note**: This documentation is specific to the aitbc1 server. For aitbc server documentation, see [aitbc.md](./aitbc.md).
## Server Specifications
### **aitbc Server Details**
- **Hostname**: aitbc (container)
- **IP Address**: 10.1.223.1 (container IP)
- **Operating System**: Debian 13 Trixie (primary development environment)
- **Access Method**: SSH via aitbc-cascade proxy
### **aitbc1 Server Details**
- **Hostname**: aitbc1 (container)
- **IP Address**: 10.1.223.2 (container IP)
- **Operating System**: Debian 13 Trixie (secondary development environment)
- **Access Method**: SSH via aitbc1-cascade proxy
- **GPU Access**: None (CPU-only mode)
- **Miner Service**: Not needed
- **Enhanced Services**: Disabled (optimized deployment)
@@ -20,13 +22,107 @@ This document contains specific deployment notes and considerations for deployin
### **Network Architecture**
```
Internet → aitbc-cascade (Proxy) → aitbc (Container)
SSL Termination Application Server
Port 443/80 Port 8000-8003 (Core Services Only)
Internet → aitbc1-cascade (Proxy) → aitbc1 (Container)
SSH Access Application Server
Port 22/443 Port 8000-8002 (Core Services)
Port 8005-8006 Blockchain Services
Port 8025-8026 Development Services
```
**Note**: Enhanced services ports 8010-8017 are disabled for CPU-only deployment
### **SSH-Based Container Access (Updated March 6, 2026)**
#### **Primary Access Methods**
```bash
# Access aitbc1 server (secondary container)
ssh aitbc1-cascade
# Check aitbc1 server connectivity
ssh aitbc1-cascade 'echo "Container accessible"'
```
#### **Service Management via SSH**
```bash
# List all AITBC services on aitbc1 server
ssh aitbc1-cascade 'systemctl list-units | grep aitbc-'
# Check specific service status on aitbc1 server
ssh aitbc1-cascade 'systemctl status aitbc-coordinator-api'
ssh aitbc1-cascade 'systemctl status aitbc-wallet'
# Start/stop services on aitbc1 server
ssh aitbc1-cascade 'sudo systemctl start aitbc-coordinator-api'
ssh aitbc1-cascade 'sudo systemctl stop aitbc-wallet'
# View service logs on aitbc1 server
ssh aitbc1-cascade 'sudo journalctl -f -u aitbc-coordinator-api'
ssh aitbc1-cascade 'sudo journalctl -f -u aitbc-blockchain-node'
# Check blockchain services on aitbc1 server
ssh aitbc1-cascade 'sudo systemctl status aitbc-blockchain-node'
ssh aitbc1-cascade 'sudo systemctl status aitbc-blockchain-rpc'
# Check development services on aitbc1 server
ssh aitbc1-cascade 'sudo systemctl status aitbc-blockchain-node-dev'
ssh aitbc1-cascade 'sudo systemctl status aitbc-blockchain-rpc-dev'
```
#### **Port Distribution & Conflict Resolution (Updated March 6, 2026)**
```bash
# NEW SUSTAINABLE PORT LOGIC - NO CONFLICTS
# Core Services (8000-8002):
- Port 8000: Coordinator API (localhost + containers)
- Port 8001: Exchange API (localhost + containers)
- Port 8002: Wallet Service (localhost + containers)
# Blockchain Services (8005-8006):
- Port 8005: Primary Blockchain Node (localhost + containers)
- Port 8006: Primary Blockchain RPC (localhost + containers)
# Level 2 Services (8010-8017):
- Port 8010-8017: Enhanced services (DISABLED for CPU-only deployment)
# Mock & Test Services (8020-8029):
- Port 8025: Development Blockchain Node (localhost + containers)
- Port 8026: Development Blockchain RPC (containers)
# Legacy Ports (8080-8089):
- Port 8080-8089: DEPRECATED - use new port ranges above
# Service Naming Convention:
✅ aitbc-blockchain-node.service (port 8005)
✅ aitbc-blockchain-rpc.service (port 8006)
✅ aitbc-wallet.service (port 8002)
✅ aitbc-blockchain-node-dev.service (port 8025)
✅ aitbc-blockchain-rpc-dev.service (port 8026)
# Resolution Strategy:
# 1. New port logic eliminates all conflicts
# 2. Sequential port assignment for related services
# 3. Clear separation between production and development services
```
#### **Debug Container Service Issues**
```bash
# Debug coordinator API port conflict
ssh aitbc-cascade 'sudo systemctl status aitbc-coordinator-api'
ssh aitbc-cascade 'sudo journalctl -u aitbc-coordinator-api -n 20'
# Debug wallet service issues
ssh aitbc-cascade 'sudo systemctl status aitbc-wallet'
ssh aitbc-cascade 'sudo journalctl -u aitbc-wallet -n 20'
# Check port usage in containers
ssh aitbc-cascade 'sudo netstat -tlnp | grep :800'
ssh aitbc1-cascade 'sudo netstat -tlnp | grep :800'
# Test service endpoints
ssh aitbc-cascade 'curl -s http://localhost:8001/health'
ssh aitbc1-cascade 'curl -s http://localhost:8002/health'
```
## Pre-Deployment Checklist
### **✅ Server Preparation**
@@ -334,19 +430,19 @@ else
echo "Database: ❌ (Missing)"
fi
# Container access test
# Container access test for aitbc1 server
echo -e "\nContainer Access Test:"
curl -s -o /dev/null -w "%{http_code}" "http://10.1.223.1:8017/health" | grep -q "200" && echo "Container Access: ✅" || echo "Container Access: ❌"
curl -s -o /dev/null -w "%{http_code}" "http://10.1.223.2:8017/health" | grep -q "200" && echo "Container Access: ✅" || echo "Container Access: ❌"
EOF
chmod +x /opt/aitbc/scripts/monitor-aitbc.sh
```
## Backup Strategy for aitbc
## Backup Strategy for aitbc1
### **Automated Backup Script**
```bash
# /opt/aitbc/scripts/backup-aitbc.sh
# /opt/aitbc/scripts/backup-aitbc1.sh
#!/bin/bash
BACKUP_DIR="/opt/aitbc/backups"
DATE=$(date +%Y%m%d_%H%M%S)

View File

@@ -8,7 +8,7 @@ This document illustrates the complete flow of a job submission through the CLI
┌─────────────┐ ┌──────────────┐ ┌─────────────┐ ┌─────────────┐ ┌─────────────┐ ┌─────────────┐
│ CLI │ │ Client │ │Coordinator │ │ Blockchain │ │ Miner │ │ Ollama │
│ Wrapper │────▶│ Python │────▶│ Service │────▶│ Node │────▶│ Daemon │────▶│ Server │
│(aitbc-cli.sh)│ │ (client.py) │ │ (port 18000)│ │ (RPC:26657) │ │ (port 18001)│ │ (port 11434)│
│(aitbc-cli.sh)│ │ (client.py) │ │ (port 8000) │ │ (RPC:8006) │ │ (port 8005) │ │ (port 11434)│
└─────────────┘ └──────────────┘ └─────────────┘ └─────────────┘ └─────────────┘ └─────────────┘
```
@@ -24,7 +24,7 @@ This document illustrates the complete flow of a job submission through the CLI
**Internal Process:**
1. Bash script (`aitbc-cli.sh`) parses arguments
2. Sets environment variables:
- `AITBC_URL=http://127.0.0.1:18000`
- `AITBC_URL=http://127.0.0.1:8000`
- `CLIENT_KEY=${CLIENT_API_KEY}`
3. Calls Python client: `python3 cli/client.py --url $AITBC_URL --api-key $CLIENT_KEY submit inference --prompt "..."`
@@ -50,7 +50,7 @@ This document illustrates the complete flow of a job submission through the CLI
**HTTP Request:**
```http
POST /v1/jobs
Host: 127.0.0.1:18000
Host: 127.0.0.1:8000
Content-Type: application/json
X-Api-Key: ${CLIENT_API_KEY}
@@ -61,7 +61,7 @@ X-Api-Key: ${CLIENT_API_KEY}
}
```
**Coordinator Service (Port 18000):**
**Coordinator Service (Port 8000):**
1. Receives HTTP request
2. Validates API key and job parameters
3. Generates unique job ID: `job_123456`
@@ -112,10 +112,10 @@ X-Api-Key: ${CLIENT_API_KEY}
- Select based on stake, reputation, capacity
3. Selected miner: `${MINER_API_KEY}`
**Coordinator → Miner Daemon (Port 18001):**
**Coordinator → Miner Daemon (Port 8005):**
```http
POST /v1/jobs/assign
Host: 127.0.0.1:18001
Host: 127.0.0.1:8005
Content-Type: application/json
X-Api-Key: ${ADMIN_API_KEY}
@@ -132,7 +132,7 @@ X-Api-Key: ${ADMIN_API_KEY}
### 6. Miner Processing
**Miner Daemon (Port 18001):**
**Miner Daemon (Port 8005):**
1. Receives job assignment
2. Updates job status to `running`
3. Notifies coordinator:
@@ -178,10 +178,10 @@ Content-Type: application/json
### 8. Result Submission to Coordinator
**Miner → Coordinator (Port 18000):**
**Miner → Coordinator (Port 8000):**
```http
POST /v1/jobs/job_123456/complete
Host: 127.0.0.1:18000
Host: 127.0.0.1:8000
Content-Type: application/json
X-Miner-Key: ${MINER_API_KEY}
@@ -243,7 +243,7 @@ X-Miner-Key: ${MINER_API_KEY}
**HTTP Request:**
```http
GET /v1/jobs/job_123456
Host: 127.0.0.1:18000
Host: 127.0.0.1:8000
X-Api-Key: ${CLIENT_API_KEY}
```
@@ -276,9 +276,9 @@ Cost: 0.25 AITBC
|-----------|------|----------|----------------|
| CLI Wrapper | N/A | Bash | User interface, argument parsing |
| Client Python | N/A | Python | HTTP client, job formatting |
| Coordinator | 18000 | HTTP/REST | Job management, API gateway |
| Blockchain Node | 26657 | JSON-RPC | Transaction processing, consensus |
| Miner Daemon | 18001 | HTTP/REST | Job execution, GPU management |
| Coordinator | 8000 | HTTP/REST | Job management, API gateway |
| Blockchain Node | 8006 | JSON-RPC | Transaction processing, consensus |
| Miner Daemon | 8005 | HTTP/REST | Job execution, GPU management |
| Ollama Server | 11434 | HTTP/REST | AI model inference |
## Message Flow Timeline
@@ -286,12 +286,12 @@ Cost: 0.25 AITBC
```
0s: User submits CLI command
└─> 0.1s: Python client called
└─> 0.2s: HTTP POST to Coordinator (port 18000)
└─> 0.2s: HTTP POST to Coordinator (port 8000)
└─> 0.3s: Coordinator validates and creates job
└─> 0.4s: RPC to Blockchain (port 26657)
└─> 0.4s: RPC to Blockchain (port 8006)
└─> 0.5s: Transaction in mempool
└─> 1.0s: Job queued for miner
└─> 2.0s: Miner assigned (port 18001)
└─> 2.0s: Miner assigned (port 8005)
└─> 2.1s: Miner accepts job
└─> 2.2s: Ollama request (port 11434)
└─> 14.7s: Inference complete (12.5s processing)