Chisskarzz
Chisskarzz

Reputation: 171

How to integrate a --worker-class of gunicorn in supervisor config setting?

I have configured a supervisor on the server like this:

[program:myproject]
command = /home/mydir/myproj/venv/bin/python /home/mydir/myproj/venv/bin/gunicorn manage:app -b <ip_address>:8000
directory = /home/mydir

I have installed gevent on my virtual environment but I don't know how can I implement it on the supervisor command variable, I can run it manually through terminal like this:

gunicorn manage:app -b <ip_address>:8000 --worker-class gevent

I tried to include a path when I call gevent in supervisor command just like python and gunicorn, but it's not working, honestly, I don't know what's the correct directory/file to execute gevent and I am also not sure if this is the correct way to execute a worker class in supervisor. I am running on Ubuntu v14.04

Anyone?Thanks

Upvotes: 0

Views: 1097

Answers (1)

Chisskarzz
Chisskarzz

Reputation: 171

Already made a solution for this. But I am not 100% sure if it is correct, after searching a hundred times, I finally came up with a working solution :)

Got this from here, I've created a gunicorn.conf.py file on my project directory containing:

worker_class = 'gevent'

And integrated this file on supervisor config setting:

[program:myproject]
command = /home/mydir/myproj/venv/bin/python /home/mydir/myproj/venv/bin/gunicorn -c /home/mydir/myproj/gunicorn.conf.py manage:app -b <ip_address>:8000
directory = /home/mydir

And start running the supervisor:

sudo supervisorctl start <my_project>

And poof! It's already working!

Upvotes: 1

Related Questions