feat: configure blockchain services on correct ports
✅ Blockchain Services Port Configuration - Blockchain HTTP API: Port 8005 (new service) - Blockchain RPC API: Port 8006 (moved from 8007) - Real Marketplace: Port 8009 (moved from 8006) ✅ New Services Created - aitbc-blockchain-http.service: HTTP API on port 8005 - blockchain_http_launcher.py: FastAPI launcher for blockchain - Updated environment file: rpc_bind_port=8006 ✅ Port Reorganization - Port 8005: Blockchain HTTP API (NEW) - Port 8006: Blockchain RPC API (moved from 8007) - Port 8009: Real Marketplace (moved from 8006) - Port 8007: Now free for future use ✅ Verification - Blockchain HTTP API: Responding on port 8005 - Blockchain RPC API: Responding on port 8006 - Real Marketplace: Running on port 8009 - All services properly configured and operational 🚀 Blockchain services now running on requested ports!
This commit is contained in:
39
production/services/blockchain_http_launcher.py
Executable file
39
production/services/blockchain_http_launcher.py
Executable file
@@ -0,0 +1,39 @@
|
||||
#!/usr/bin/env python3
|
||||
"""
|
||||
Blockchain HTTP Service Launcher
|
||||
"""
|
||||
|
||||
import os
|
||||
import sys
|
||||
|
||||
# Add production services to path
|
||||
sys.path.insert(0, '/opt/aitbc/production/services')
|
||||
|
||||
# Import blockchain manager and create FastAPI app
|
||||
from mining_blockchain import MultiChainManager
|
||||
from fastapi import FastAPI
|
||||
|
||||
app = FastAPI(title='AITBC Blockchain HTTP API')
|
||||
|
||||
@app.get('/health')
|
||||
async def health():
|
||||
return {'status': 'ok', 'service': 'blockchain-http', 'port': 8005}
|
||||
|
||||
@app.get('/info')
|
||||
async def info():
|
||||
manager = MultiChainManager()
|
||||
return manager.get_all_chains_info()
|
||||
|
||||
@app.get('/blocks')
|
||||
async def blocks():
|
||||
manager = MultiChainManager()
|
||||
return {'blocks': manager.get_all_chains_info()}
|
||||
|
||||
if __name__ == '__main__':
|
||||
import uvicorn
|
||||
uvicorn.run(
|
||||
app,
|
||||
host='0.0.0.0',
|
||||
port=int(os.getenv('BLOCKCHAIN_HTTP_PORT', 8005)),
|
||||
log_level='info'
|
||||
)
|
||||
46
systemd/aitbc-blockchain-http.service
Normal file
46
systemd/aitbc-blockchain-http.service
Normal file
@@ -0,0 +1,46 @@
|
||||
[Unit]
|
||||
Description=AITBC Blockchain HTTP API (Port 8005)
|
||||
After=network.target aitbc-blockchain-node.service
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
User=root
|
||||
Group=root
|
||||
WorkingDirectory=/opt/aitbc
|
||||
Environment=PATH=/usr/bin:/usr/local/bin:/usr/bin:/bin
|
||||
Environment=NODE_ID=aitbc
|
||||
Environment=BLOCKCHAIN_HTTP_PORT=8005
|
||||
Environment=PYTHONPATH=/opt/aitbc/production/services
|
||||
EnvironmentFile=/opt/aitbc/production/.env
|
||||
|
||||
# Blockchain HTTP execution
|
||||
ExecStart=/opt/aitbc/venv/bin/python /opt/aitbc/production/services/blockchain_http_launcher.py
|
||||
ExecReload=/bin/kill -HUP $MAINPID
|
||||
KillMode=mixed
|
||||
TimeoutStopSec=10
|
||||
|
||||
# Production reliability
|
||||
Restart=always
|
||||
RestartSec=5
|
||||
StartLimitBurst=5
|
||||
StartLimitIntervalSec=60
|
||||
|
||||
# Production logging
|
||||
StandardOutput=journal
|
||||
StandardError=journal
|
||||
SyslogIdentifier=aitbc-blockchain-http
|
||||
|
||||
# Production security
|
||||
NoNewPrivileges=true
|
||||
ProtectSystem=strict
|
||||
ProtectHome=true
|
||||
ReadWritePaths=/opt/aitbc/production/data/blockchain /opt/aitbc/production/logs/blockchain
|
||||
|
||||
# Production performance
|
||||
LimitNOFILE=65536
|
||||
LimitNPROC=4096
|
||||
MemoryMax=1G
|
||||
CPUQuota=25%
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
@@ -9,7 +9,7 @@ Group=root
|
||||
WorkingDirectory=/opt/aitbc
|
||||
Environment=PATH=/usr/bin:/usr/local/bin:/usr/bin:/bin
|
||||
Environment=NODE_ID=aitbc
|
||||
Environment=REAL_MARKETPLACE_PORT=8006
|
||||
Environment=REAL_MARKETPLACE_PORT=8009
|
||||
Environment=PYTHONPATH=/opt/aitbc/production/services
|
||||
EnvironmentFile=/opt/aitbc/production/.env
|
||||
|
||||
|
||||
Reference in New Issue
Block a user