SegVision / supervisord.conf
Indrajit Ari
fix: delay nginx start by 20s to wait for Next.js and FastAPI to boot
a6b2429
[unix_http_server]
file=/tmp/supervisor.sock
[supervisord]
nodaemon=true
logfile=/var/log/supervisor/supervisord.log
pidfile=/tmp/supervisord.pid
[rpcinterface:supervisor]
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
[supervisorctl]
serverurl=unix:///tmp/supervisor.sock
# ── FastAPI backend ──────────────────────────────────────────────────────────
[program:fastapi]
command=uvicorn app_hf:app --host 127.0.0.1 --port 8000 --workers 1 --timeout-keep-alive 120
directory=/app/backend
autostart=true
autorestart=true
stdout_logfile=/var/log/supervisor/fastapi.log
stderr_logfile=/var/log/supervisor/fastapi.log
# ── Next.js standalone server ────────────────────────────────────────────────
[program:nextjs]
command=node /app/frontend/server.js
directory=/app/frontend
environment=PORT="3000",NODE_ENV="production",NEXT_PUBLIC_API_URL=""
autostart=true
autorestart=true
startsecs=3
stdout_logfile=/var/log/supervisor/nextjs.log
stderr_logfile=/var/log/supervisor/nextjs.log
# ── nginx reverse proxy ──────────────────────────────────────────────────────
[program:nginx]
; Wait for FastAPI and Next.js to be up before nginx starts
command=bash -c "sleep 20 && nginx -g 'daemon off;'"
autostart=true
autorestart=true
startsecs=21
stdout_logfile=/var/log/supervisor/nginx.log
stderr_logfile=/var/log/supervisor/nginx.log