restructure: eliminate box-in-box production architecture
Some checks failed
Documentation Validation / validate-docs (push) Has been cancelled
Some checks failed
Documentation Validation / validate-docs (push) Has been cancelled
- Move production configs from /opt/aitbc/production/config to /etc/aitbc/production - Move production services from /opt/aitbc/production/services to /var/lib/aitbc/production - Centralize production logs in /var/log/aitbc/production - Remove redundant /opt/aitbc/production directory - Add production launcher script at /opt/aitbc/scripts/production_launcher.py - Update production services to use system configuration paths - Create comprehensive production architecture documentation - Achieve proper FHS compliance with clean separation of concerns
This commit is contained in:
51
scripts/production_launcher.py
Executable file
51
scripts/production_launcher.py
Executable file
@@ -0,0 +1,51 @@
|
||||
#!/usr/bin/env python3
|
||||
"""
|
||||
Production Services Launcher
|
||||
Launches AITBC production services from system locations
|
||||
"""
|
||||
|
||||
import os
|
||||
import sys
|
||||
import subprocess
|
||||
from pathlib import Path
|
||||
|
||||
def launch_service(service_name: str, script_path: str):
|
||||
"""Launch a production service"""
|
||||
print(f"Launching {service_name}...")
|
||||
|
||||
# Ensure log directory exists
|
||||
log_dir = Path(f"/var/log/aitbc/production/{service_name}")
|
||||
log_dir.mkdir(parents=True, exist_ok=True)
|
||||
|
||||
# Launch service
|
||||
try:
|
||||
subprocess.run([
|
||||
sys.executable,
|
||||
str(Path("/var/lib/aitbc/production") / script_path)
|
||||
], check=True)
|
||||
except subprocess.CalledProcessError as e:
|
||||
print(f"Failed to launch {service_name}: {e}")
|
||||
return False
|
||||
except FileNotFoundError:
|
||||
print(f"Service script not found: {script_path}")
|
||||
return False
|
||||
|
||||
return True
|
||||
|
||||
def main():
|
||||
"""Main launcher"""
|
||||
print("=== AITBC Production Services Launcher ===")
|
||||
|
||||
services = [
|
||||
("blockchain", "blockchain.py"),
|
||||
("marketplace", "marketplace.py"),
|
||||
("unified_marketplace", "unified_marketplace.py"),
|
||||
]
|
||||
|
||||
for service_name, script_path in services:
|
||||
if not launch_service(service_name, script_path):
|
||||
print(f"Skipping {service_name} due to error")
|
||||
continue
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Reference in New Issue
Block a user