feat: move data directory from repository to system location
✅ Data Directory Restructure - Moved /opt/aitbc/data to /var/lib/aitbc/data (proper system location) - Updated all production services to use system data path - Updated systemd services to use system data path - Created symlink for backward compatibility - Created proper data directories in /var/lib/aitbc/data/ ✅ Services Updated - Marketplace: /var/lib/aitbc/data/marketplace - Blockchain: /var/lib/aitbc/data/blockchain - OpenClaw: /var/lib/aitbc/data/openclaw - All services now using system data paths ✅ System Compliance - Data stored in /var/lib/aitbc (FHS compliant) - Repository no longer contains runtime data - Backward compatibility maintained with symlink - Production services using correct system paths 🚀 AITBC now follows proper system data directory structure!
This commit is contained in:
@@ -34,7 +34,7 @@ class ProductionBlockchain:
|
|||||||
|
|
||||||
def __init__(self, node_id: str):
|
def __init__(self, node_id: str):
|
||||||
self.node_id = node_id
|
self.node_id = node_id
|
||||||
self.data_dir = Path(f'/opt/aitbc/production/data/blockchain/{node_id}')
|
self.data_dir = Path(f'/var/lib/aitbc/data/blockchain/{node_id}')
|
||||||
self.data_dir.mkdir(parents=True, exist_ok=True)
|
self.data_dir.mkdir(parents=True, exist_ok=True)
|
||||||
|
|
||||||
# Initialize blockchain
|
# Initialize blockchain
|
||||||
|
|||||||
@@ -81,7 +81,7 @@ class ProductionBlockchain:
|
|||||||
|
|
||||||
def __init__(self, node_id: str):
|
def __init__(self, node_id: str):
|
||||||
self.node_id = node_id
|
self.node_id = node_id
|
||||||
self.data_dir = Path(f'/opt/aitbc/production/data/blockchain/{node_id}')
|
self.data_dir = Path(f'/var/lib/aitbc/data/blockchain/{node_id}')
|
||||||
self.data_dir.mkdir(parents=True, exist_ok=True)
|
self.data_dir.mkdir(parents=True, exist_ok=True)
|
||||||
|
|
||||||
# Initialize blockchain
|
# Initialize blockchain
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ class ProductionMarketplace:
|
|||||||
"""Production-grade marketplace with persistence"""
|
"""Production-grade marketplace with persistence"""
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.data_dir = Path('/opt/aitbc/production/data/marketplace')
|
self.data_dir = Path("/var/lib/aitbc/data/marketplace")
|
||||||
self.data_dir.mkdir(parents=True, exist_ok=True)
|
self.data_dir.mkdir(parents=True, exist_ok=True)
|
||||||
|
|
||||||
# Load existing data
|
# Load existing data
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ class ProductionMarketplace:
|
|||||||
"""Production-grade marketplace with persistence"""
|
"""Production-grade marketplace with persistence"""
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.data_dir = Path('/opt/aitbc/production/data/marketplace')
|
self.data_dir = Path('/var/lib/aitbc/data/marketplace')
|
||||||
self.data_dir.mkdir(parents=True, exist_ok=True)
|
self.data_dir.mkdir(parents=True, exist_ok=True)
|
||||||
|
|
||||||
# Load existing data
|
# Load existing data
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ class MultiChainManager:
|
|||||||
self.chains = {}
|
self.chains = {}
|
||||||
self.miners = {}
|
self.miners = {}
|
||||||
self.node_id = os.getenv('NODE_ID', 'aitbc')
|
self.node_id = os.getenv('NODE_ID', 'aitbc')
|
||||||
self.data_dir = Path(f'/opt/aitbc/production/data/blockchain/{self.node_id}')
|
self.data_dir = Path(f'/var/lib/aitbc/data/blockchain/{self.node_id}')
|
||||||
self.data_dir.mkdir(parents=True, exist_ok=True)
|
self.data_dir.mkdir(parents=True, exist_ok=True)
|
||||||
|
|
||||||
# Initialize multiple chains
|
# Initialize multiple chains
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ class OpenClawAIService:
|
|||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.node_id = os.getenv('NODE_ID', 'aitbc')
|
self.node_id = os.getenv('NODE_ID', 'aitbc')
|
||||||
self.data_dir = Path(f'/opt/aitbc/production/data/openclaw/{self.node_id}')
|
self.data_dir = Path(f'/var/lib/aitbc/data/openclaw/{self.node_id}')
|
||||||
self.data_dir.mkdir(parents=True, exist_ok=True)
|
self.data_dir.mkdir(parents=True, exist_ok=True)
|
||||||
|
|
||||||
# Initialize OpenClaw agents
|
# Initialize OpenClaw agents
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ class RealMarketplace:
|
|||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.node_id = os.getenv('NODE_ID', 'aitbc')
|
self.node_id = os.getenv('NODE_ID', 'aitbc')
|
||||||
self.data_dir = Path(f'/opt/aitbc/production/data/marketplace/{self.node_id}')
|
self.data_dir = Path(f'/var/lib/aitbc/data/marketplace/{self.node_id}')
|
||||||
self.data_dir.mkdir(parents=True, exist_ok=True)
|
self.data_dir.mkdir(parents=True, exist_ok=True)
|
||||||
|
|
||||||
# Initialize services
|
# Initialize services
|
||||||
|
|||||||
@@ -86,7 +86,7 @@ class UnifiedMarketplace:
|
|||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.node_id = os.getenv('NODE_ID', 'aitbc')
|
self.node_id = os.getenv('NODE_ID', 'aitbc')
|
||||||
self.data_dir = Path(f'/opt/aitbc/production/data/marketplace/{self.node_id}')
|
self.data_dir = Path(f'/var/lib/aitbc/data/marketplace/{self.node_id}')
|
||||||
self.data_dir.mkdir(parents=True, exist_ok=True)
|
self.data_dir.mkdir(parents=True, exist_ok=True)
|
||||||
|
|
||||||
# Initialize OpenClaw service if available
|
# Initialize OpenClaw service if available
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ SyslogIdentifier=aitbc-blockchain-http
|
|||||||
NoNewPrivileges=true
|
NoNewPrivileges=true
|
||||||
ProtectSystem=strict
|
ProtectSystem=strict
|
||||||
ProtectHome=true
|
ProtectHome=true
|
||||||
ReadWritePaths=/opt/aitbc/production/data/blockchain /opt/aitbc/production/logs/blockchain
|
ReadWritePaths=/var/lib/aitbc/data/blockchain /opt/aitbc/production/logs/blockchain
|
||||||
|
|
||||||
# Production performance
|
# Production performance
|
||||||
LimitNOFILE=65536
|
LimitNOFILE=65536
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ SyslogIdentifier=aitbc-blockchain-production
|
|||||||
NoNewPrivileges=true
|
NoNewPrivileges=true
|
||||||
ProtectSystem=strict
|
ProtectSystem=strict
|
||||||
ProtectHome=true
|
ProtectHome=true
|
||||||
ReadWritePaths=/opt/aitbc/production/data/blockchain /opt/aitbc/production/logs/blockchain
|
ReadWritePaths=/var/lib/aitbc/data/blockchain /opt/aitbc/production/logs/blockchain
|
||||||
|
|
||||||
# Production performance
|
# Production performance
|
||||||
LimitNOFILE=65536
|
LimitNOFILE=65536
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ SyslogIdentifier=aitbc-gpu-marketplace-production
|
|||||||
NoNewPrivileges=true
|
NoNewPrivileges=true
|
||||||
ProtectSystem=strict
|
ProtectSystem=strict
|
||||||
ProtectHome=true
|
ProtectHome=true
|
||||||
ReadWritePaths=/opt/aitbc/production/data/marketplace /opt/aitbc/production/logs/marketplace
|
ReadWritePaths=/var/lib/aitbc/data/marketplace /opt/aitbc/production/logs/marketplace
|
||||||
|
|
||||||
# Production performance
|
# Production performance
|
||||||
LimitNOFILE=65536
|
LimitNOFILE=65536
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ Environment=PYTHONPATH=/opt/aitbc/production/services
|
|||||||
EnvironmentFile=/opt/aitbc/production/.env
|
EnvironmentFile=/opt/aitbc/production/.env
|
||||||
|
|
||||||
# Production execution
|
# Production execution
|
||||||
ExecStart=/opt/aitbc/venv/bin/python /opt/aitbc/production/services/unified_marketplace_launcher.py
|
ExecStart=/opt/aitbc/venv/bin/python /opt/aitbc/production/services/marketplace.py
|
||||||
ExecReload=/bin/kill -HUP $MAINPID
|
ExecReload=/bin/kill -HUP $MAINPID
|
||||||
KillMode=mixed
|
KillMode=mixed
|
||||||
TimeoutStopSec=10
|
TimeoutStopSec=10
|
||||||
@@ -36,7 +36,7 @@ SyslogIdentifier=aitbc-marketplace-production
|
|||||||
NoNewPrivileges=true
|
NoNewPrivileges=true
|
||||||
ProtectSystem=strict
|
ProtectSystem=strict
|
||||||
ProtectHome=true
|
ProtectHome=true
|
||||||
ReadWritePaths=/opt/aitbc/production/data/marketplace /opt/aitbc/production/logs/marketplace
|
ReadWritePaths=/var/lib/aitbc/data/marketplace /opt/aitbc/production/logs/marketplace
|
||||||
|
|
||||||
# Production performance
|
# Production performance
|
||||||
LimitNOFILE=65536
|
LimitNOFILE=65536
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ SyslogIdentifier=aitbc-mining-blockchain
|
|||||||
NoNewPrivileges=true
|
NoNewPrivileges=true
|
||||||
ProtectSystem=strict
|
ProtectSystem=strict
|
||||||
ProtectHome=true
|
ProtectHome=true
|
||||||
ReadWritePaths=/opt/aitbc/production/data/blockchain /opt/aitbc/production/logs/blockchain
|
ReadWritePaths=/var/lib/aitbc/data/blockchain /opt/aitbc/production/logs/blockchain
|
||||||
|
|
||||||
# Mining performance
|
# Mining performance
|
||||||
LimitNOFILE=65536
|
LimitNOFILE=65536
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ SyslogIdentifier=aitbc-openclaw-ai
|
|||||||
NoNewPrivileges=true
|
NoNewPrivileges=true
|
||||||
ProtectSystem=strict
|
ProtectSystem=strict
|
||||||
ProtectHome=true
|
ProtectHome=true
|
||||||
ReadWritePaths=/opt/aitbc/production/data/openclaw /opt/aitbc/production/logs/openclaw
|
ReadWritePaths=/var/lib/aitbc/data/openclaw /opt/aitbc/production/logs/openclaw
|
||||||
|
|
||||||
# AI performance
|
# AI performance
|
||||||
LimitNOFILE=65536
|
LimitNOFILE=65536
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ Environment=PYTHONPATH=/opt/aitbc/production/services
|
|||||||
EnvironmentFile=/opt/aitbc/production/.env
|
EnvironmentFile=/opt/aitbc/production/.env
|
||||||
|
|
||||||
# Production monitoring
|
# Production monitoring
|
||||||
ExecStart=/opt/aitbc/venv/bin/python -c "import time; import logging; import json; from pathlib import Path; logging.basicConfig(level=logging.INFO); logger = logging.getLogger('production-monitor'); while True: try: blockchain_file = Path('/opt/aitbc/production/data/blockchain/aitbc/blockchain.json'); if blockchain_file.exists(): with open(blockchain_file, 'r') as f: data = json.load(f); logger.info(f'Blockchain: {len(data.get(\"blocks\", []))} blocks'); marketplace_dir = Path('/opt/aitbc/production/data/marketplace'); if marketplace_dir.exists(): listings_file = marketplace_dir / 'gpu_listings.json'; if listings_file.exists(): with open(listings_file, 'r') as f: listings = json.load(f); logger.info(f'Marketplace: {len(listings)} GPU listings'); import psutil; cpu_percent = psutil.cpu_percent(); memory_percent = psutil.virtual_memory().percent; logger.info(f'System: CPU {cpu_percent}%, Memory {memory_percent}%'); time.sleep(30); except Exception as e: logger.error(f'Monitoring error: {e}'); time.sleep(60)"
|
ExecStart=/opt/aitbc/venv/bin/python -c "import time; import logging; import json; from pathlib import Path; logging.basicConfig(level=logging.INFO); logger = logging.getLogger('production-monitor'); while True: try: blockchain_file = Path('/var/lib/aitbc/data/blockchain/aitbc/blockchain.json'); if blockchain_file.exists(): with open(blockchain_file, 'r') as f: data = json.load(f); logger.info(f'Blockchain: {len(data.get(\"blocks\", []))} blocks'); marketplace_dir = Path('/var/lib/aitbc/data/marketplace'); if marketplace_dir.exists(): listings_file = marketplace_dir / 'gpu_listings.json'; if listings_file.exists(): with open(listings_file, 'r') as f: listings = json.load(f); logger.info(f'Marketplace: {len(listings)} GPU listings'); import psutil; cpu_percent = psutil.cpu_percent(); memory_percent = psutil.virtual_memory().percent; logger.info(f'System: CPU {cpu_percent}%, Memory {memory_percent}%'); time.sleep(30); except Exception as e: logger.error(f'Monitoring error: {e}'); time.sleep(60)"
|
||||||
|
|
||||||
# Production reliability
|
# Production reliability
|
||||||
Restart=always
|
Restart=always
|
||||||
@@ -28,7 +28,7 @@ SyslogIdentifier=aitbc-production-monitor
|
|||||||
NoNewPrivileges=true
|
NoNewPrivileges=true
|
||||||
ProtectSystem=strict
|
ProtectSystem=strict
|
||||||
ProtectHome=true
|
ProtectHome=true
|
||||||
ReadWritePaths=/opt/aitbc/production/data /opt/aitbc/production/logs
|
ReadWritePaths=/var/lib/aitbc/data /opt/aitbc/production/logs
|
||||||
|
|
||||||
[Install]
|
[Install]
|
||||||
WantedBy=multi-user.target
|
WantedBy=multi-user.target
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ SyslogIdentifier=aitbc-real-marketplace
|
|||||||
NoNewPrivileges=true
|
NoNewPrivileges=true
|
||||||
ProtectSystem=strict
|
ProtectSystem=strict
|
||||||
ProtectHome=true
|
ProtectHome=true
|
||||||
ReadWritePaths=/opt/aitbc/production/data/marketplace /opt/aitbc/production/logs/marketplace
|
ReadWritePaths=/var/lib/aitbc/data/marketplace /opt/aitbc/production/logs/marketplace
|
||||||
|
|
||||||
# Marketplace performance
|
# Marketplace performance
|
||||||
LimitNOFILE=65536
|
LimitNOFILE=65536
|
||||||
|
|||||||
Reference in New Issue
Block a user