Some checks failed
API Endpoint Tests / test-api-endpoints (push) Successful in 16s
Blockchain Synchronization Verification / sync-verification (push) Successful in 3s
CLI Tests / test-cli (push) Successful in 13s
Cross-Chain Functionality Tests / test-cross-chain-sync (push) Failing after 2s
Cross-Chain Functionality Tests / test-cross-chain-transactions (push) Successful in 2s
Cross-Chain Functionality Tests / test-cross-chain-bridge (push) Has been skipped
Cross-Chain Functionality Tests / test-multi-chain-consensus (push) Failing after 2s
Cross-Chain Functionality Tests / aggregate-results (push) Has been skipped
Cross-Node Transaction Testing / transaction-test (push) Successful in 9s
Deploy to Testnet / deploy-testnet (push) Successful in 1m7s
Documentation Validation / validate-docs (push) Successful in 8s
Documentation Validation / validate-policies-strict (push) Successful in 14s
Integration Tests / test-service-integration (push) Successful in 2m42s
Multi-Node Blockchain Health Monitoring / health-check (push) Successful in 10s
Multi-Node Stress Testing / stress-test (push) Successful in 8s
Node Failover Simulation / failover-test (push) Failing after 6s
P2P Network Verification / p2p-verification (push) Successful in 7s
Deploy to Testnet / notify-deployment (push) Has been cancelled
Python Tests / test-python (push) Has been cancelled
Security Scanning / security-scan (push) Has been cancelled
Package Tests / Python package - aitbc-agent-sdk (push) Failing after 1m5s
Package Tests / Python package - aitbc-core (push) Successful in 58s
Package Tests / Python package - aitbc-crypto (push) Successful in 36s
Package Tests / Python package - aitbc-sdk (push) Successful in 30s
Package Tests / JavaScript package - aitbc-sdk-js (push) Successful in 28s
Package Tests / JavaScript package - aitbc-token (push) Successful in 23s
Production Tests / Production Integration Tests (push) Failing after 1m7s
Staking Tests / test-staking-service (push) Failing after 3s
Staking Tests / test-staking-integration (push) Has been skipped
Staking Tests / test-staking-contract (push) Has been skipped
Staking Tests / run-staking-test-runner (push) Has been skipped
- Replace hardcoded IPs in deploy-to-server.sh with AITBC_DEPLOY_SERVER - Replace hardcoded IPs in deploy-to-container.sh with AITBC_CONTAINER_IP - Replace hardcoded IPs in deploy-explorer.sh with AITBC_DEPLOY_SERVER - Replace hardcoded IPs in deploy-exchange.sh with AITBC_DEPLOY_SERVER - Replace hardcoded IPs in container-deploy.py with AITBC_CONTAINER_IP - Replace hardcoded IPs in deploy_gpu_to_container.py with AITBC_CONTAINER_IP - Replace hardcoded IPs in deploy_container_with_miner.py with AITBC_CONTAINER_IP - Default to localhost if env vars not set - Addresses report item #4 (hardcoded IPs in deployment scripts)
133 lines
4.2 KiB
Python
133 lines
4.2 KiB
Python
#!/usr/bin/env python3
|
|
"""
|
|
Deploy GPU Miner Integration to AITBC Container
|
|
"""
|
|
|
|
import os
|
|
import subprocess
|
|
import sys
|
|
|
|
def run_in_container(cmd):
|
|
"""Run command in aitbc container"""
|
|
full_cmd = f"incus exec aitbc -- {cmd}"
|
|
print(f"Running: {full_cmd}")
|
|
result = subprocess.run(full_cmd, shell=True, capture_output=True, text=True)
|
|
if result.returncode != 0:
|
|
print(f"Error: {result.stderr}")
|
|
return False, result.stderr
|
|
return True, result.stdout
|
|
|
|
def deploy_gpu_miner_to_container():
|
|
print("🚀 Deploying GPU Miner Integration to AITBC Container...")
|
|
|
|
# Check container access
|
|
print("\n1. 🔍 Checking container access...")
|
|
success, output = run_in_container("whoami")
|
|
if success:
|
|
print(f" Container user: {output.strip()}")
|
|
else:
|
|
print(" ❌ Cannot access container")
|
|
return
|
|
|
|
# Copy GPU miner files to container
|
|
print("\n2. 📁 Copying GPU miner files...")
|
|
files_to_copy = [
|
|
"gpu_miner_with_wait.py",
|
|
"gpu_registry_demo.py"
|
|
]
|
|
|
|
for file in files_to_copy:
|
|
cmd = f"incus file push /home/oib/windsurf/aitbc/{file} aitbc/home/oib/"
|
|
print(f" Copying {file}...")
|
|
result = subprocess.run(cmd, shell=True)
|
|
if result.returncode == 0:
|
|
print(f" ✅ {file} copied")
|
|
else:
|
|
print(f" ❌ Failed to copy {file}")
|
|
|
|
# Install dependencies in container
|
|
print("\n3. 📦 Installing dependencies...")
|
|
run_in_container("pip install httpx fastapi uvicorn psutil")
|
|
|
|
# Create GPU miner service in container
|
|
print("\n4. ⚙️ Creating GPU miner service...")
|
|
service_content = """[Unit]
|
|
Description=AITBC GPU Miner Client
|
|
After=network.target
|
|
|
|
[Service]
|
|
Type=simple
|
|
User=oib
|
|
WorkingDirectory=/home/oib
|
|
ExecStart=/usr/bin/python3 gpu_miner_with_wait.py
|
|
Restart=always
|
|
RestartSec=30
|
|
StandardOutput=journal
|
|
StandardError=journal
|
|
|
|
[Install]
|
|
WantedBy=multi-user.target
|
|
"""
|
|
|
|
# Write service file to container
|
|
with open('/tmp/gpu-miner.service', 'w') as f:
|
|
f.write(service_content)
|
|
subprocess.run("incus file push /tmp/gpu-miner.service aitbc/tmp/", shell=True)
|
|
run_in_container("sudo mv /tmp/gpu-miner.service /etc/systemd/system/")
|
|
run_in_container("sudo systemctl daemon-reload")
|
|
run_in_container("sudo systemctl enable gpu-miner.service")
|
|
run_in_container("sudo systemctl start gpu-miner.service")
|
|
|
|
# Create GPU registry service in container
|
|
print("\n5. 🎮 Creating GPU registry service...")
|
|
registry_service = """[Unit]
|
|
Description=AITBC GPU Registry
|
|
After=network.target
|
|
|
|
[Service]
|
|
Type=simple
|
|
User=oib
|
|
WorkingDirectory=/home/oib
|
|
ExecStart=/usr/bin/python3 gpu_registry_demo.py
|
|
Restart=always
|
|
RestartSec=10
|
|
StandardOutput=journal
|
|
StandardError=journal
|
|
|
|
[Install]
|
|
WantedBy=multi-user.target
|
|
"""
|
|
|
|
with open('/tmp/gpu-registry.service', 'w') as f:
|
|
f.write(registry_service)
|
|
subprocess.run("incus file push /tmp/gpu-registry.service aitbc/tmp/", shell=True)
|
|
run_in_container("sudo mv /tmp/gpu-registry.service /etc/systemd/system/")
|
|
run_in_container("sudo systemctl daemon-reload")
|
|
run_in_container("sudo systemctl enable gpu-registry.service")
|
|
run_in_container("sudo systemctl start gpu-registry.service")
|
|
|
|
# Check services
|
|
print("\n6. 📊 Checking services...")
|
|
success, output = run_in_container("sudo systemctl status gpu-miner.service --no-pager")
|
|
print(output)
|
|
|
|
success, output = run_in_container("sudo systemctl status gpu-registry.service --no-pager")
|
|
print(output)
|
|
|
|
# Update coordinator to include miner endpoints
|
|
print("\n7. 🔗 Updating coordinator API...")
|
|
|
|
print("\n✅ GPU Miner deployed to container!")
|
|
print("\n📊 Access URLs:")
|
|
container_ip = os.getenv("AITBC_CONTAINER_IP", "127.0.0.1")
|
|
print(f" - Container IP: {container_ip}")
|
|
print(f" - GPU Registry: http://{container_ip}:8091/miners/list")
|
|
print(f" - Coordinator API: http://{container_ip}:8000")
|
|
|
|
print("\n🔧 To manage services in container:")
|
|
print(" incus exec aitbc -- sudo systemctl status gpu-miner")
|
|
print(" incus exec aitbc -- sudo journalctl -u gpu-miner -f")
|
|
|
|
if __name__ == "__main__":
|
|
deploy_gpu_miner_to_container()
|