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:
aitbc
2026-04-02 13:45:14 +02:00
parent bc7aba23a0
commit 7de29c55fc
17 changed files with 19 additions and 18 deletions

View File

@@ -13,7 +13,7 @@ Environment=PYTHONPATH=/opt/aitbc/production/services
EnvironmentFile=/opt/aitbc/production/.env
# 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
Restart=always
@@ -28,7 +28,7 @@ SyslogIdentifier=aitbc-production-monitor
NoNewPrivileges=true
ProtectSystem=strict
ProtectHome=true
ReadWritePaths=/opt/aitbc/production/data /opt/aitbc/production/logs
ReadWritePaths=/var/lib/aitbc/data /opt/aitbc/production/logs
[Install]
WantedBy=multi-user.target