Files
aitbc/scripts/wrappers/aitbc-coordinator-api-wrapper.py
aitbc 35d23b2ef9 fix: add REPO_DIR to PYTHONPATH in service wrappers
The wrapper scripts were setting PYTHONPATH to only the app's src directory,
causing 'ModuleNotFoundError: No module named aitbc' when services tried
to import from the aitbc package. Added REPO_DIR to PYTHONPATH in
coordinator-api, agent-coordinator, and explorer wrappers to allow aitbc imports.
2026-04-25 08:08:23 +02:00

36 lines
878 B
Python
Executable File

#!/usr/bin/env python3
"""
Wrapper script for aitbc-coordinator-api service
Uses centralized aitbc utilities for path configuration
"""
import sys
import os
from pathlib import Path
# Add aitbc to path
sys.path.insert(0, str(Path("/opt/aitbc")))
sys.path.insert(0, str(Path("/opt/aitbc/aitbc")))
from aitbc import ENV_FILE, NODE_ENV_FILE, REPO_DIR, DATA_DIR, LOG_DIR
# Set up environment using aitbc constants
os.environ["AITBC_ENV_FILE"] = str(ENV_FILE)
os.environ["AITBC_NODE_ENV_FILE"] = str(NODE_ENV_FILE)
os.environ["PYTHONPATH"] = f"{REPO_DIR}:{REPO_DIR}/apps/coordinator-api/src"
os.environ["DATA_DIR"] = str(DATA_DIR)
os.environ["LOG_DIR"] = str(LOG_DIR)
# Execute the actual service
exec_cmd = [
"/opt/aitbc/venv/bin/python",
"-m",
"uvicorn",
"app.main:app",
"--host",
"0.0.0.0",
"--port",
"8000"
]
os.execvp(exec_cmd[0], exec_cmd)