[supervisord]
nodaemon=true
user=root
logfile=/dev/null
logfile_maxbytes=0
pidfile=/run/supervisord.pid

[program:php-fpm]
command=php-fpm -F
autorestart=true
startretries=5
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0

[program:nginx]
command=nginx -g 'daemon off;'
autorestart=true
startretries=5
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0

; Vite dev server (HMR) — runs inside the app container, started by Laravel's
; stack, not as a separate compose service. Reachable on :5173.
[program:vite]
command=sh -c "npm install --no-audit --no-fund && exec npm run dev -- --host 0.0.0.0"
directory=/var/www/html
user=app
; supervisord switches uid but does NOT update $HOME — set it explicitly so npm
; can write its cache/logs (otherwise it tries /root/.npm and fails).
environment=HOME="/home/app",USER="app",NPM_CONFIG_CACHE="/home/app/.npm"
autorestart=true
startretries=3
startsecs=10

; Live metrics poller — reads REAL CPU/MEM over SSH for credentialed servers and
; broadcasts over Reverb. No-ops gracefully when a box is unreachable.
[program:metrics]
command=php artisan clusev:poll-metrics --interval=15
directory=/var/www/html
user=app
environment=HOME="/home/app",USER="app"
autostart=true
autorestart=true
startsecs=5
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0
