[supervisord]
nodaemon=true
logfile=/dev/stdout
logfile_maxbytes=0
pidfile=/tmp/supervisord.pid

[unix_http_server]
file=/tmp/supervisor.sock

[supervisorctl]
serverurl=unix:///tmp/supervisor.sock

; Required for supervisorctl (RPC). Without this, `supervisorctl status` fails with
; "did not recognize the supervisor namespace commands".
[rpcinterface:supervisor]
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface

; ----------------------------
; Infra
; ----------------------------

[program:redis]
command=/usr/bin/redis-server --bind 0.0.0.0 --port 6379
autorestart=true
startretries=10
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0

[program:rabbitmq]
command=/usr/sbin/rabbitmq-server
autorestart=true
startretries=10
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0

; ----------------------------
; Django backend (8000)
; ----------------------------

[program:django]
directory=/app/backend
command=/usr/local/bin/gunicorn config.wsgi:application --bind 0.0.0.0:8000 --workers 2 --timeout 120
autorestart=true
startretries=10
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0

; ----------------------------
; MCube services (8002/9001/8088)
; ----------------------------

[program:mcube_webhook]
directory=/app/backend/agent_runtime
environment=PYTHONPATH="src",AGENT_RUNTIME_ENV_FILE="/app/backend/.env.docker",HTTP_AUTHORIZATION="eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJUSEVfQ0xBSU0iLCJhdWQiOiJUSEVfQVVESUVOQ0UiLCJpYXQiOjE3NjQyMjc0NzMsImV4cF9kYXRhIjoxNzk1Nzg1MDczLCJkYXRhIjp7ImJ1c2luZXNzX2lkIjo4MDI4LCJidXNpbmVzc19uYW1lIjoiVm9pY2VCb3QgUHJvZHVjdCBUZWFtIn19.azEqvESyuP1GJoLWrww3GTfgaYOfg1oBrqZTnWHdKhY",MCUBE_EXENUMBER="7004670614"
command=/bin/sh -c "sleep 10; exec /usr/local/bin/python -m mcube_integration.webhook_server"
autorestart=true
startretries=10
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0

[program:mcube_ws_bridge]
directory=/app/backend/agent_runtime
environment=PYTHONPATH="src",AGENT_RUNTIME_ENV_FILE="/app/backend/.env.docker"
command=/bin/sh -c "sleep 10; exec /usr/local/bin/python -m mcube_integration.ws_bridge"
autorestart=true
startretries=10
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0

[program:mcube_ai_worker]
directory=/app/backend/agent_runtime
environment=PYTHONPATH="src",AGENT_RUNTIME_ENV_FILE="/app/backend/.env.docker"
command=/bin/sh -c "sleep 10; exec /usr/local/bin/python -m mcube_integration.ai_worker"
autorestart=true
startretries=10
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0

[program:mcube_proxy]
directory=/app/backend/agent_runtime
environment=PYTHONPATH="src",AGENT_RUNTIME_ENV_FILE="/app/backend/.env.docker"
command=/bin/sh -c "sleep 10; exec /usr/local/bin/python -m mcube_integration.proxy_server"
autorestart=true
startretries=10
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0

; ----------------------------
; LiveKit worker (no public port)
; ----------------------------

[program:livekit_worker]
directory=/app/backend/agent_runtime
environment=AGENT_RUNTIME_ENV_FILE="/app/backend/.env.docker"
command=/usr/local/bin/python src/agent.py dev
autorestart=true
startretries=10
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0

; ----------------------------
; Next.js frontend (3000)
; ----------------------------

[program:frontend]
directory=/app/frontend
command=/usr/bin/npm run preview -- --host 0.0.0.0 --port 3000
autorestart=true
startretries=10
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0

; ----------------------------
; Master panel (4174)
; ----------------------------

[program:masterpanel]
directory=/app/masterpanel
command=/usr/bin/npm run preview -- --host 0.0.0.0 --port 4174
autorestart=true
startretries=10
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0

