; ============================================ ; Supervisord Configuration for Hugging Face Spaces ; Manages both Go API Server and Streamlit Frontend ; ============================================ [supervisord] nodaemon=true user=root logfile=/var/log/supervisor/supervisord.log pidfile=/var/run/supervisord.pid loglevel=info logfile_maxbytes=10MB logfile_backups=3 ; ============================================ ; Go API Server - CLIProxyAPI Plus (Optional) ; Only starts if CLIProxyAPIPlus binary exists ; ============================================ [program:go-server] command=/app/go-server/CLIProxyAPIPlus directory=/app/go-server autostart=false autorestart=true startsecs=10 stopwaitsecs=30 startretries=3 stopasgroup=true killasgroup=true stdout_logfile=/var/log/supervisor/go-server.log stdout_logfile_maxbytes=10MB stdout_logfile_backups=3 stderr_logfile=/var/log/supervisor/go-server-error.log stderr_logfile_maxbytes=10MB stderr_logfile_backups=3 environment=HOME="/root",DEPLOY="true" ; ============================================ ; Streamlit Frontend (Always runs) ; ============================================ [program:streamlit] command=streamlit run /app/streamlit/app.py --server.port=7860 --server.address=0.0.0.0 directory=/app/streamlit autostart=true autorestart=true startsecs=5 stopwaitsecs=10 startretries=3 stopasgroup=true killasgroup=true stdout_logfile=/var/log/supervisor/streamlit.log stdout_logfile_maxbytes=10MB stdout_logfile_backups=3 stderr_logfile=/var/log/supervisor/streamlit-error.log stderr_logfile_maxbytes=10MB stderr_logfile_backups=3 environment=HOME="/root",STREAMLIT_SERVER_HEADLESS="true" ; ============================================ ; Event Listener for Go Server Auto-Start ; ============================================ [eventlistener:go_server_checker] command=bash -c "if [ -f /app/go-server/CLIProxyAPIPlus ]; then supervisorctl start go-server; fi" events=PROCESS_STATE_RUNNING buffer_size=100 stdout_logfile=/var/log/supervisor/go-server-checker.log stderr_logfile=/var/log/supervisor/go-server-checker-error.log