Fixed CLI blockchain connection timeout errors by updating default RPC URL from port 8006 to port 8005 across all CLI modules. Root cause: - Port 8006 is for blockchain P2P protocol (not HTTP RPC) - Port 8005 is the HTTP RPC API port - CLI was trying to use HTTP on port 8006, causing timeouts Updated files: - cli/advanced_wallet.py: DEFAULT_RPC_URL - cli/enterprise_cli.py: DEFAULT_RPC_URL - cli/commands/blockchain.py: _get_node_endpoint() - cli/core/main.py: default_rpc_url - cli/commands/sync.py: source and import-url defaults - cli/commands/marketplace.py: rpc_url config default - cli/commands/blockchain_event_bridge.py: test mode config - cli/handlers/bridge.py: test mode config - cli/commands/deployment.py: service endpoints This fixes the training script errors where CLI commands were timing out when trying to connect to the blockchain node.
91 lines
3.2 KiB
Python
91 lines
3.2 KiB
Python
"""Production deployment guidance for AITBC CLI"""
|
|
|
|
import click
|
|
from utils import output, error, success
|
|
|
|
@click.group()
|
|
def deploy():
|
|
"""Production deployment guidance and setup"""
|
|
pass
|
|
|
|
@deploy.command()
|
|
@click.option('--service', default='all', help='Service to deploy (all, coordinator, blockchain, marketplace)')
|
|
@click.option('--environment', default='production', help='Deployment environment')
|
|
def setup(service, environment):
|
|
"""Get deployment setup instructions"""
|
|
output(f"🚀 {environment.title()} Deployment Setup for {service.title()}", None)
|
|
|
|
instructions = {
|
|
'coordinator': [
|
|
"1. Install dependencies: pip install -r requirements.txt",
|
|
"2. Set environment variables in .env file",
|
|
"3. Run: python -m coordinator.main",
|
|
"4. Configure nginx reverse proxy",
|
|
"5. Set up SSL certificates"
|
|
],
|
|
'blockchain': [
|
|
"1. Install blockchain node dependencies",
|
|
"2. Initialize genesis block: aitbc genesis init",
|
|
"3. Start node: python -m blockchain.node",
|
|
"4. Configure peer connections",
|
|
"5. Enable mining if needed"
|
|
],
|
|
'marketplace': [
|
|
"1. Install marketplace dependencies",
|
|
"2. Set up database: postgresql-setup.sh",
|
|
"3. Run migrations: python -m marketplace.migrate",
|
|
"4. Start service: python -m marketplace.main",
|
|
"5. Configure GPU mining nodes"
|
|
],
|
|
'all': [
|
|
"📋 Complete AITBC Platform Deployment:",
|
|
"",
|
|
"1. Prerequisites:",
|
|
" - Python 3.13+",
|
|
" - PostgreSQL 14+",
|
|
" - Redis 6+",
|
|
"",
|
|
"2. Environment Setup:",
|
|
" - Copy .env.example to .env",
|
|
" - Configure database URLs",
|
|
" - Set API keys and secrets",
|
|
"",
|
|
"3. Database Setup:",
|
|
" - createdb aitbc",
|
|
" - Run migrations: python manage.py migrate",
|
|
"",
|
|
"4. Service Deployment:",
|
|
" - Coordinator: python -m coordinator.main",
|
|
" - Blockchain: python -m blockchain.node",
|
|
" - Marketplace: python -m marketplace.main",
|
|
"",
|
|
"5. Frontend Setup:",
|
|
" - npm install",
|
|
" - npm run build",
|
|
" - Configure web server"
|
|
]
|
|
}
|
|
|
|
for step in instructions.get(service, instructions['all']):
|
|
output(step, None)
|
|
|
|
output(f"\n💡 For detailed deployment guides, see: docs/deployment/{environment}.md", None)
|
|
|
|
@deploy.command()
|
|
@click.option('--service', help='Service to check')
|
|
def status(service):
|
|
"""Check deployment status"""
|
|
output(f"📊 Deployment Status Check for {service or 'All Services'}", None)
|
|
|
|
checks = [
|
|
"Coordinator API: http://localhost:8011/health",
|
|
"Blockchain Node RPC: http://localhost:8005/health",
|
|
"Marketplace: http://localhost:8001/health",
|
|
"Wallet Service: http://localhost:8003/status"
|
|
]
|
|
|
|
for check in checks:
|
|
output(f" • {check}", None)
|
|
|
|
output("\n💡 Use curl or browser to check each endpoint", None)
|