19 September 2014

Setting up searx with gunicorn and supervisor

What is searx?
searx is a privacy-respecting, hackable metasearch engine

I have been using my own instance of searx at https://searx.gliderswirley.org/ mostly because I can. :)

For some reason, my instance seems to go down at some random time, and I assumed it was uwsgi. :P And also because I wanted to try gunicorn and supervisor.

Most of the setup steps are already documented on the wiki at https://github.com/asciimoo/searx/wiki/Installation, but I'll recount the steps here anyways.

Install packages (extra package: supervisor):
sudo apt-get install git build-essential libxslt-dev python-dev python-virtualenv \
python-pybabel zlib1g-dev supervisor

Install searx:
cd /usr/local
sudo git clone https://github.com/asciimoo/searx.git
sudo useradd searx -d /usr/local/searx
sudo chown searx:searx -R /usr/local/searx

Install dependencies in a virtualenv (extra package: gunicorn):
sudo -u searx -i
cd /usr/local/searx
virtualenv searx-ve
. ./searx-ve/bin/activate
pip install -r requirements.txt
pip install gunicorn
python setup.py install

Configure secretkey:
sed -i -e "s/ultrasecretkey/`openssl rand -hex 16`/g" searx/settings.yml

Make a configuration file:
sudo touch /etc/supervisor/conf.d/searx.conf

Edit the above conf to include:
[program:searx]
command=/usr/local/searx/searx-ve/bin/gunicorn searx.webapp:app
directory=/usr/local/searx/
user=searx
group=searx
autostart=true
autorestart=true
stdout_logfile=/var/log/supervisor/%(program_name)s-access.log
stderr_logfile=/var/log/supervisor/%(program_name)s-error.log

Then start the supervisor service:
sudo service supervisor start

No comments:

Post a Comment