| import subprocess |
| import sys |
| import os |
| import time |
| import signal |
|
|
| def cleanup(signum, frame): |
| print("Stopping services...") |
| |
| sys.exit(0) |
|
|
| signal.signal(signal.SIGINT, cleanup) |
| signal.signal(signal.SIGTERM, cleanup) |
|
|
| def main(): |
| print("π Starting Sentinel Monolith...") |
| |
| |
| |
| gateway_cmd = [sys.executable, "mcp_gateway.py"] |
| gateway_process = subprocess.Popen(gateway_cmd, cwd=os.getcwd()) |
| print(f"β
Gateway started (PID: {gateway_process.pid})") |
| |
| |
| |
| monitor_cmd = [sys.executable, "monitor.py"] |
| monitor_process = subprocess.Popen(monitor_cmd, cwd=os.getcwd()) |
| print(f"β
Monitor started (PID: {monitor_process.pid})") |
|
|
| |
| time.sleep(5) |
| |
| |
| |
| print("β
Starting Streamlit on port 7860...") |
| streamlit_cmd = [ |
| "streamlit", "run", "app.py", |
| "--server.port", "7860", |
| "--server.address", "0.0.0.0", |
| "--server.headless", "true", |
| "--browser.serverAddress", "0.0.0.0", |
| "--server.enableCORS", "false", |
| "--server.enableXsrfProtection", "false" |
| ] |
| |
| |
| subprocess.run(streamlit_cmd, check=False) |
| |
| |
| gateway_process.terminate() |
| monitor_process.terminate() |
|
|
| if __name__ == "__main__": |
| main() |
|
|