mirror of
https://github.com/YunoHost-Apps/searx_ynh.git
synced 2024-09-03 20:16:30 +02:00
parent
1257e1c570
commit
43ea3945cd
6 changed files with 161 additions and 119 deletions
|
@ -8,13 +8,7 @@ location PATHTOCHANGE {
|
||||||
location @searx {
|
location @searx {
|
||||||
uwsgi_pass unix:///run/uwsgi/app/searx/socket;
|
uwsgi_pass unix:///run/uwsgi/app/searx/socket;
|
||||||
include uwsgi_params;
|
include uwsgi_params;
|
||||||
<<<<<<< HEAD
|
|
||||||
# Include SSOWAT user panel.
|
# Include SSOWAT user panel.
|
||||||
#include conf.d/yunohost_panel.conf.inc;
|
#include conf.d/yunohost_panel.conf.inc;
|
||||||
=======
|
|
||||||
|
|
||||||
# Include SSOWAT user panel.
|
|
||||||
include conf.d/yunohost_panel.conf.inc;
|
|
||||||
>>>>>>> 90736b2cc32bd424c78355499e1bfb61062af8ca
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -8,14 +8,7 @@ location @searx {
|
||||||
uwsgi_param SCRIPT_NAME PATHTOCHANGE;
|
uwsgi_param SCRIPT_NAME PATHTOCHANGE;
|
||||||
include uwsgi_params;
|
include uwsgi_params;
|
||||||
uwsgi_modifier1 30;
|
uwsgi_modifier1 30;
|
||||||
<<<<<<< HEAD
|
|
||||||
uwsgi_pass unix:///run/uwsgi/app/searx/socket;
|
uwsgi_pass unix:///run/uwsgi/app/searx/socket;
|
||||||
# Include SSOWAT user panel.
|
# Include SSOWAT user panel.
|
||||||
#include conf.d/yunohost_panel.conf.inc;
|
#include conf.d/yunohost_panel.conf.inc;
|
||||||
=======
|
|
||||||
uwsgi_pass unix:/run/uwsgi/app/searx/socket;
|
|
||||||
|
|
||||||
# Include SSOWAT user panel.
|
|
||||||
include conf.d/yunohost_panel.conf.inc;
|
|
||||||
>>>>>>> 90736b2cc32bd424c78355499e1bfb61062af8ca
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,7 @@ server:
|
||||||
secret_key : "ultrasecretkey" # change this!
|
secret_key : "ultrasecretkey" # change this!
|
||||||
debug : True
|
debug : True
|
||||||
request_timeout : 2.0 # seconds
|
request_timeout : 2.0 # seconds
|
||||||
base_url : ynhbaseurl
|
base_url : False
|
||||||
|
|
||||||
engines:
|
engines:
|
||||||
- name : wikipedia
|
- name : wikipedia
|
||||||
|
|
156
conf/settings.yml-noroot
Normal file
156
conf/settings.yml-noroot
Normal file
|
@ -0,0 +1,156 @@
|
||||||
|
server:
|
||||||
|
port : 8888
|
||||||
|
secret_key : "ultrasecretkey" # change this!
|
||||||
|
debug : True
|
||||||
|
request_timeout : 2.0 # seconds
|
||||||
|
base_url : True
|
||||||
|
|
||||||
|
engines:
|
||||||
|
- name : wikipedia
|
||||||
|
engine : wikipedia
|
||||||
|
number_of_results : 1
|
||||||
|
paging : False
|
||||||
|
shortcut : wp
|
||||||
|
|
||||||
|
- name : bing
|
||||||
|
engine : bing
|
||||||
|
locale : en-US
|
||||||
|
shortcut : bi
|
||||||
|
|
||||||
|
- name : bing news
|
||||||
|
engine : bing_news
|
||||||
|
locale : en-US
|
||||||
|
shortcut : bin
|
||||||
|
|
||||||
|
- name : currency
|
||||||
|
engine : currency_convert
|
||||||
|
categories : general
|
||||||
|
shortcut : cc
|
||||||
|
|
||||||
|
- name : deviantart
|
||||||
|
engine : deviantart
|
||||||
|
categories : images
|
||||||
|
shortcut : da
|
||||||
|
timeout: 3.0
|
||||||
|
|
||||||
|
- name : ddg definitions
|
||||||
|
engine : duckduckgo_definitions
|
||||||
|
shortcut : ddd
|
||||||
|
|
||||||
|
- name : duckduckgo
|
||||||
|
engine : duckduckgo
|
||||||
|
locale : en-us
|
||||||
|
shortcut : ddg
|
||||||
|
|
||||||
|
- name : filecrop
|
||||||
|
engine : filecrop
|
||||||
|
categories : files
|
||||||
|
shortcut : fc
|
||||||
|
|
||||||
|
- name : flickr
|
||||||
|
engine : flickr
|
||||||
|
categories : images
|
||||||
|
shortcut : fl
|
||||||
|
timeout: 3.0
|
||||||
|
|
||||||
|
- name : github
|
||||||
|
engine : github
|
||||||
|
categories : it
|
||||||
|
shortcut : gh
|
||||||
|
|
||||||
|
- name : google
|
||||||
|
engine : google
|
||||||
|
shortcut : go
|
||||||
|
|
||||||
|
- name : google images
|
||||||
|
engine : google_images
|
||||||
|
shortcut : goi
|
||||||
|
|
||||||
|
- name : google news
|
||||||
|
engine : google_news
|
||||||
|
shortcut : gon
|
||||||
|
|
||||||
|
- name : piratebay
|
||||||
|
engine : piratebay
|
||||||
|
categories : videos, music, files
|
||||||
|
shortcut : tpb
|
||||||
|
|
||||||
|
- name : soundcloud
|
||||||
|
engine : soundcloud
|
||||||
|
categories : music
|
||||||
|
shortcut : sc
|
||||||
|
|
||||||
|
- name : stackoverflow
|
||||||
|
engine : stackoverflow
|
||||||
|
categories : it
|
||||||
|
shortcut : st
|
||||||
|
|
||||||
|
- name : startpage
|
||||||
|
engine : startpage
|
||||||
|
base_url : 'https://startpage.com/'
|
||||||
|
search_url : 'https://startpage.com/do/search'
|
||||||
|
shortcut : sp
|
||||||
|
|
||||||
|
# +30% page load time
|
||||||
|
# - name : ixquick
|
||||||
|
# engine : startpage
|
||||||
|
# base_url : 'https://www.ixquick.com/'
|
||||||
|
# search_url : 'https://www.ixquick.com/do/search'
|
||||||
|
|
||||||
|
- name : twitter
|
||||||
|
engine : twitter
|
||||||
|
categories : social media
|
||||||
|
shortcut : tw
|
||||||
|
|
||||||
|
# maybe in a fun category
|
||||||
|
# - name : uncyclopedia
|
||||||
|
# engine : mediawiki
|
||||||
|
# categories : general
|
||||||
|
# shortcut : unc
|
||||||
|
# url : https://uncyclopedia.wikia.com/
|
||||||
|
|
||||||
|
# tmp suspended - too slow, too many errors
|
||||||
|
# - name : urbandictionary
|
||||||
|
# engine : xpath
|
||||||
|
# search_url : http://www.urbandictionary.com/define.php?term={query}
|
||||||
|
# url_xpath : //div[@class="word"]//a/@href
|
||||||
|
# title_xpath : //div[@class="word"]//a
|
||||||
|
# content_xpath : //div[@class="definition"]
|
||||||
|
# shortcut : ud
|
||||||
|
|
||||||
|
- name : yahoo
|
||||||
|
engine : yahoo
|
||||||
|
shortcut : yh
|
||||||
|
|
||||||
|
- name : yahoo news
|
||||||
|
engine : yahoo_news
|
||||||
|
shortcut : yhn
|
||||||
|
|
||||||
|
- name : youtube
|
||||||
|
engine : youtube
|
||||||
|
categories : videos
|
||||||
|
shortcut : yt
|
||||||
|
|
||||||
|
- name : dailymotion
|
||||||
|
engine : dailymotion
|
||||||
|
locale : en_US
|
||||||
|
categories : videos
|
||||||
|
shortcut : dm
|
||||||
|
|
||||||
|
- name : vimeo
|
||||||
|
engine : vimeo
|
||||||
|
categories : videos
|
||||||
|
results_xpath : //div[@id="browse_content"]/ol/li
|
||||||
|
url_xpath : ./a/@href
|
||||||
|
title_xpath : ./a/div[@class="data"]/p[@class="title"]/text()
|
||||||
|
content_xpath : ./a/img/@src
|
||||||
|
shortcut : vm
|
||||||
|
|
||||||
|
locales:
|
||||||
|
en : English
|
||||||
|
de : Deutsch
|
||||||
|
hu : Magyar
|
||||||
|
fr : Français
|
||||||
|
es : Español
|
||||||
|
it : Italiano
|
||||||
|
nl : Nederlands
|
|
@ -8,16 +8,9 @@ is_public=$3
|
||||||
# Check domain/path availability
|
# Check domain/path availability
|
||||||
sudo yunohost app checkurl $domain$path -a searx
|
sudo yunohost app checkurl $domain$path -a searx
|
||||||
if [[ ! $? -eq 0 ]]; then
|
if [[ ! $? -eq 0 ]]; then
|
||||||
<<<<<<< HEAD
|
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
=======
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Save specific settings
|
|
||||||
>>>>>>> 90736b2cc32bd424c78355499e1bfb61062af8ca
|
|
||||||
sudo yunohost app setting searx is_public -v $is_public
|
sudo yunohost app setting searx is_public -v $is_public
|
||||||
|
|
||||||
# Check depends installation
|
# Check depends installation
|
||||||
|
@ -50,22 +43,13 @@ then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#Configuration Searx
|
#Configuration Searx
|
||||||
sudo cp ../conf/settings.yml /opt/searx/searx/
|
if [ $path != "/" ];
|
||||||
sudo sed -i -e "s/ultrasecretkey/`openssl rand -hex 16`/g" /opt/searx/searx/settings.yml
|
|
||||||
if [ "$path" != "/" ];
|
|
||||||
then
|
then
|
||||||
<<<<<<< HEAD
|
|
||||||
sudo cp ../conf/settings.yml-noroot /opt/yunohost/searx/searx/settings.yml
|
sudo cp ../conf/settings.yml-noroot /opt/yunohost/searx/searx/settings.yml
|
||||||
else
|
else
|
||||||
sudo cp ../conf/settings.yml /opt/yunohost/searx/searx/
|
sudo cp ../conf/settings.yml /opt/yunohost/searx/searx/
|
||||||
fi
|
fi
|
||||||
sudo sed -i -e "s/ultrasecretkey/`openssl rand -hex 16`/g" /opt/yunohost/searx/searx/settings.yml
|
sudo sed -i -e "s/ultrasecretkey/`openssl rand -hex 16`/g" /opt/yunohost/searx/searx/settings.yml
|
||||||
=======
|
|
||||||
sudo sed -i -e "s@ynhbaseurl@https://$domain$path/@g" /opt/searx/searx/settings.yml
|
|
||||||
else
|
|
||||||
sudo sed -i -e "s@ynhbaseurl@https://$domain$path@g" /opt/searx/searx/settings.yml
|
|
||||||
fi
|
|
||||||
>>>>>>> 90736b2cc32bd424c78355499e1bfb61062af8ca
|
|
||||||
|
|
||||||
# Set permissions to searx directory
|
# Set permissions to searx directory
|
||||||
sudo useradd searx -d /opt/yunohost/searx
|
sudo useradd searx -d /opt/yunohost/searx
|
||||||
|
@ -77,7 +61,7 @@ sudo ln -s /etc/uwsgi/apps-available/searx.ini /etc/uwsgi/apps-enabled/
|
||||||
|
|
||||||
# Modify Nginx configuration file and copy it to Nginx conf directory
|
# Modify Nginx configuration file and copy it to Nginx conf directory
|
||||||
sudo sed -i "s@PATHTOCHANGE@$path@g" ../conf/nginx.conf*
|
sudo sed -i "s@PATHTOCHANGE@$path@g" ../conf/nginx.conf*
|
||||||
if [ "$path" != "/" ];
|
if [ $path != "/" ];
|
||||||
then
|
then
|
||||||
sudo cp ../conf/nginx.conf-noroot /etc/nginx/conf.d/$domain.d/searx.conf
|
sudo cp ../conf/nginx.conf-noroot /etc/nginx/conf.d/$domain.d/searx.conf
|
||||||
else
|
else
|
||||||
|
@ -92,13 +76,10 @@ fi
|
||||||
sudo service nginx reload
|
sudo service nginx reload
|
||||||
sudo service uwsgi restart
|
sudo service uwsgi restart
|
||||||
|
|
||||||
if [ "$is_public" = "Yes" ];
|
if [ $is_public = "Yes" ];
|
||||||
then
|
then
|
||||||
sudo yunohost app setting searx skipped_uris -v "/"
|
sudo yunohost app setting searx skipped_uris -v "/"
|
||||||
<<<<<<< HEAD
|
|
||||||
else
|
else
|
||||||
sudo sed -i 's/#include conf/include conf/' /etc/nginx/conf.d/$domain.d/searx.conf
|
sudo sed -i 's/#include conf/include conf/' /etc/nginx/conf.d/$domain.d/searx.conf
|
||||||
=======
|
|
||||||
>>>>>>> 90736b2cc32bd424c78355499e1bfb61062af8ca
|
|
||||||
fi
|
fi
|
||||||
sudo yunohost app ssowatconf
|
sudo yunohost app ssowatconf
|
||||||
|
|
|
@ -1,29 +1,17 @@
|
||||||
<<<<<<< HEAD
|
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
=======
|
|
||||||
>>>>>>> 90736b2cc32bd424c78355499e1bfb61062af8ca
|
|
||||||
# Retrieve arguments
|
# Retrieve arguments
|
||||||
domain=$(sudo yunohost app setting searx domain)
|
domain=$(sudo yunohost app setting searx domain)
|
||||||
path=$(sudo yunohost app setting searx path)
|
path=$(sudo yunohost app setting searx path)
|
||||||
is_public=$(sudo yunohost app setting searx is_public)
|
is_public=$(sudo yunohost app setting searx is_public)
|
||||||
|
|
||||||
<<<<<<< HEAD
|
|
||||||
|
|
||||||
# Check depends installation
|
# Check depends installation
|
||||||
sudo apt-get install git build-essential libxslt-dev python-dev python-virtualenv python-pybabel zlib1g-dev uwsgi uwsgi-plugin-python -y
|
sudo apt-get install git build-essential libxslt-dev python-dev python-virtualenv python-pybabel zlib1g-dev uwsgi uwsgi-plugin-python -y
|
||||||
=======
|
|
||||||
# Remove trailing "/" for next commands
|
|
||||||
path=${path%/}
|
|
||||||
|
|
||||||
# Check depends installation
|
|
||||||
sudo apt-get install git build-essential libxslt-dev python-dev python-virtualenv python-pybabel zlib1g-dev -y
|
|
||||||
>>>>>>> 90736b2cc32bd424c78355499e1bfb61062af8ca
|
|
||||||
|
|
||||||
# Check Swap
|
# Check Swap
|
||||||
if [ $(sudo swapon -s | wc -l) = 1 ];
|
if [ $(sudo swapon -s | wc -l) = 1 ];
|
||||||
then
|
then
|
||||||
<<<<<<< HEAD
|
|
||||||
sudo dd if=/dev/zero of=/tmp/myswapfile bs=1M count=128
|
sudo dd if=/dev/zero of=/tmp/myswapfile bs=1M count=128
|
||||||
sudo chmod 600 /tmp/myswapfile
|
sudo chmod 600 /tmp/myswapfile
|
||||||
sudo mkswap /tmp/myswapfile
|
sudo mkswap /tmp/myswapfile
|
||||||
|
@ -46,28 +34,10 @@ sudo cp ../conf/searx.ini /etc/uwsgi/apps-available/
|
||||||
sudo cp -r ../sources/* /opt/yunohost/searx/
|
sudo cp -r ../sources/* /opt/yunohost/searx/
|
||||||
sudo virtualenv /opt/yunohost/searx
|
sudo virtualenv /opt/yunohost/searx
|
||||||
sudo bash -c "source /opt/yunohost/searx/bin/activate && pip install -r /opt/yunohost/searx/requirements.txt"
|
sudo bash -c "source /opt/yunohost/searx/bin/activate && pip install -r /opt/yunohost/searx/requirements.txt"
|
||||||
=======
|
|
||||||
sudo dd if=/dev/zero of=/tmp/myswapfile bs=1M count=1024
|
|
||||||
sudo chmod 600 /tmp/myswapfile
|
|
||||||
sudo mkswap /tmp/myswapfile
|
|
||||||
sudo swapon /tmp/myswapfile
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
|
||||||
# Init virtualenv
|
|
||||||
if [ ! -d /opt/searx ];
|
|
||||||
then
|
|
||||||
sudo mkdir /opt/searx
|
|
||||||
fi
|
|
||||||
sudo cp -r ../sources/* /opt/searx
|
|
||||||
sudo virtualenv /opt/searx
|
|
||||||
sudo bash -c "source /opt/searx/bin/activate && pip install -r /opt/searx/requirements.txt"
|
|
||||||
>>>>>>> 90736b2cc32bd424c78355499e1bfb61062af8ca
|
|
||||||
|
|
||||||
# Disable swapfile
|
# Disable swapfile
|
||||||
if [ -f /tmp/myswapfile ];
|
if [ -f /tmp/myswapfile ];
|
||||||
then
|
then
|
||||||
<<<<<<< HEAD
|
|
||||||
sudo swapoff /tmp/myswapfile
|
sudo swapoff /tmp/myswapfile
|
||||||
sudo rm -f /tmp/myswapfile
|
sudo rm -f /tmp/myswapfile
|
||||||
fi
|
fi
|
||||||
|
@ -89,55 +59,3 @@ fi
|
||||||
## Reload Nginx and regenerate SSOwat conf
|
## Reload Nginx and regenerate SSOwat conf
|
||||||
sudo service nginx reload
|
sudo service nginx reload
|
||||||
sudo service uwsgi restart
|
sudo service uwsgi restart
|
||||||
=======
|
|
||||||
sudo swapoff /tmp/myswapfile
|
|
||||||
sudo rm -f /tmp/myswapfile
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Remove trailing "/" for next commands if installing on a subpath
|
|
||||||
if [ "$path" != "/" ];
|
|
||||||
then
|
|
||||||
path=${path%/}
|
|
||||||
fi
|
|
||||||
|
|
||||||
#Configuration Searx
|
|
||||||
sudo cp ../conf/settings.yml /opt/searx/searx/
|
|
||||||
sudo sed -i -e "s/ultrasecretkey/`openssl rand -hex 16`/g" /opt/searx/searx/settings.yml
|
|
||||||
if [ "$path" != "/" ];
|
|
||||||
then
|
|
||||||
sudo sed -i -e "s@ynhbaseurl@https://$domain$path/@g" /opt/searx/searx/settings.yml
|
|
||||||
else
|
|
||||||
sudo sed -i -e "s@ynhbaseurl@https://$domain$path@g" /opt/searx/searx/settings.yml
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Set permissions to searx directory
|
|
||||||
sudo useradd searx -d /opt/searx
|
|
||||||
sudo chown searx:searx -R /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*
|
|
||||||
if [ "$path" != "/" ];
|
|
||||||
then
|
|
||||||
sudo cp ../conf/nginx.conf-noroot /etc/nginx/conf.d/$domain.d/searx.conf
|
|
||||||
else
|
|
||||||
sudo cp ../conf/nginx.conf /etc/nginx/conf.d/$domain.d/searx.conf
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Fix permission
|
|
||||||
#sudo find /opt/searx/ -type d -exec chmod 2755 {} \;
|
|
||||||
#sudo find /opt/searx/ -type f -exec chmod g+r,o+r {} \;
|
|
||||||
|
|
||||||
## Reload Nginx and regenerate SSOwat conf
|
|
||||||
sudo service nginx reload
|
|
||||||
sudo service uwsgi restart
|
|
||||||
|
|
||||||
if [ "$is_public" = "Yes" ];
|
|
||||||
then
|
|
||||||
sudo yunohost app setting searx skipped_uris -v "/"
|
|
||||||
fi
|
|
||||||
sudo yunohost app ssowatconf
|
|
||||||
>>>>>>> 90736b2cc32bd424c78355499e1bfb61062af8ca
|
|
||||||
|
|
Loading…
Reference in a new issue