#!/bin/bash
NAME=drjob-gunicorn
DIR=/var/www/html/drjob-dev/drjob-ai
USER=pm2
GROUP=www-data
WORKERS=1
WORKER_CLASS=uvicorn.workers.UvicornWorker
WORKER_CLASS2=gevent
VENV=$DIR/.venv/bin/activate
BIND=unix:$DIR/run/gunicorn.sock
LOG_LEVEL=info
TIMEOUT=120

cd $DIR
source $VENV

exec gunicorn main:app \
  --name $NAME \
  -b :5010 \
  --timeout $TIMEOUT \
  --workers $WORKERS \
  --worker-class $WORKER_CLASS \
  --user=$USER \
  --group=$GROUP \
  --bind=$BIND \
  --log-level=$LOG_LEVEL \
  --reload
