commit 7eb4b9aca8a4e2e127d4aa0f33d700c44512459c Author: root Date: Sat May 10 09:54:15 2014 +0000 first commit diff --git a/conf/nginx.conf b/conf/nginx.conf new file mode 100644 index 0000000..3aa47a7 --- /dev/null +++ b/conf/nginx.conf @@ -0,0 +1,11 @@ +location PATHTOCHANGE { + if ($scheme = http) { + rewrite ^ https://$server_name$request_uri? permanent; + } + try_files $uri @searx; +} + +location @searx { + uwsgi_pass unix:///tmp/searx.sock; + include uwsgi_params; +} diff --git a/conf/searx.ini b/conf/searx.ini new file mode 100644 index 0000000..3833674 --- /dev/null +++ b/conf/searx.ini @@ -0,0 +1,29 @@ +[uwsgi] +# Who will run the code +uid = www-data +gid = www-data + +# Number of workers +workers = 4 + +# The right granted on the created socket +chmod-socket = 666 + +# Plugin to use and interpretor config +single-interpreter = true +master = true +plugin = python + +# Application base folder +base = /opt/searx + +# Module to import +module = searx.webapp + +# Virtualenv and python path +virtualenv = /opt/searx/searx-ve/ +pythonpath = /opt/searx/ +chdir = /opt/searx/searx/ + +# The variable holding flask application +callable = app diff --git a/manifest.json b/manifest.json new file mode 100644 index 0000000..3cda35c --- /dev/null +++ b/manifest.json @@ -0,0 +1,32 @@ +{ + "name": "Searx", + "id": "searx", + "description": { + "en": "A privacy-respecting, hackable metasearch engine" + }, + "developer": { + "name": "beudbeud" + "email": "beudbeud@beudibox.fr", + "url": "https://github.com/asciimoo/searx/" + }, + "multi_instance": "true", + "arguments": { + "install" : [ + { + "name": "domain", + "ask": { + "en": "Choose a domain for searx" + }, + "example": "domain.org" + }, + { + "name": "path", + "ask": { + "en": "Choose a path for searx" + }, + "example": "/searx", + "default": "/searx" + } + ] + } +} diff --git a/scripts/install b/scripts/install new file mode 100644 index 0000000..8dfac25 --- /dev/null +++ b/scripts/install @@ -0,0 +1,46 @@ +#!/bin/bash + +# Retrieve arguments +domain=$1 +path=$2 + +# Check domain/path availability +sudo yunohost app checkurl $domain$path -a searx +sudo yunohost app setting searx skipped_uris -v "$path" +if [[ ! $? -eq 0 ]]; then +exit 1 +fi + +# Check depends installation +sudo apt-get install git build-essential libxslt-dev python-dev python-virtualenv python-pybabel zlib1g-dev + +# Init virtualenv +sudo virtualenv /searx +sudo bash -c "source /opt/searx/bin/activate && pip install -r requirements.txt" + +#Configuration Searx +sudo cp ../conf/settings.yml /opt/searx/ +sudo sed -i "s@CHANGEPATH@$path@g" /opt/searx/settings.yml + +# Set permissions to searx directory +#sudo chown -R www-data. /opt/searx/ + +# Copy uwsgi config +sudo cp ../conf/searx.ini /etc/uwsgi/apps-available/ +sudo ln -s /etc/uwsgi/apps-available/searx.ini /etc/uwsgi/apps-enabled/ + +# Modify Nginx configuration file and copy it to Nginx conf directory +sudo sed -i "s@PATHTOCHANGE@$path@g" ../conf/nginx.conf +sudo cp ../conf/nginx.conf /etc/nginx/conf.d/$domain.d/searx.conf + +# Fix permission +#sudo chmod 755 /etc/searx/ +#sudo find /opt/yunohost/searx/ -type d -exec chmod 2755 {} \; +#sudo find /opt/yunohost/searx/ -type f -exec chmod g+r,o+r {} \; +#sudo chmod 644 /etc/searx/* + +## Reload Nginx and regenerate SSOwat conf +sudo service nginx reload +sudo service uwsgi restart +#sudo yunohost app setting searx skipped_uris -v "/" +sudo yunohost app ssowatconf diff --git a/scripts/remove b/scripts/remove new file mode 100644 index 0000000..25b7ac8 --- /dev/null +++ b/scripts/remove @@ -0,0 +1,13 @@ +#!/bin/bash + +domain=$(sudo yunohost app setting searx domain) + +sudo rm -Rf /opt/searx +sudo rm -f /etc/uwsgi/apps-enabled/searx.ini +sudo rm -f /etc/uwsgi/apps-available/searx.ini +sudo rm -f /etc/nginx/conf.d/$domain.d/searx.conf +sudo service uwsgi stop +sudo killall uwsgi +sudo service uwsgi start +sudo service nginx reload +sudo yunohost app ssowatconf