#!/usr/bin/env python3 """ Native Mac execution script for SamCloud Dashboard Runs directly on macOS without Docker virtualization to get real system info """ import os import sys import subprocess def setup_environment(): """Set up the environment for native execution""" os.environ['FLASK_ENV'] = 'development' os.environ['FLASK_DEBUG'] = '1' os.environ['FLASK_APP'] = 'samcloud_app.py' os.environ['PYTHONUNBUFFERED'] = '1' os.environ['FLASK_RUN_HOST'] = '0.0.0.0' os.environ['FLASK_RUN_PORT'] = '8383' # Port for home.samcloud.ca reverse proxy os.environ['NATIVE_EXECUTION'] = '1' os.environ['SKIP_AUTH'] = '1' # Skip auth in development def install_requirements(): """Install Python requirements if needed""" try: import flask import psutil except ImportError: print("Installing required packages...") subprocess.run([sys.executable, '-m', 'pip', 'install', '-r', 'homelab_requirements.txt'], check=True) def main(): """Run the Flask app natively on macOS""" print("Starting SamCloud Dashboard in native Mac mode...") print("This will access real Mac system information") print("Dashboard will be available at: http://localhost:8383") setup_environment() install_requirements() # Change to the script directory os.chdir(os.path.dirname(os.path.abspath(__file__))) # Run Flask app try: subprocess.run([ sys.executable, '-m', 'flask', 'run', '--debug', '--host=0.0.0.0', '--port=8383', '--extra-files=templates:static' ], check=True) except KeyboardInterrupt: print("\nShutting down SamCloud Dashboard...") except Exception as e: print(f"Error running dashboard: {e}") if __name__ == '__main__': main()