diff options
| -rw-r--r-- | .gitignore | 1 | ||||
| -rw-r--r-- | Makefile | 10 | ||||
| -rw-r--r-- | README.md | 31 | ||||
| -rw-r--r-- | engines.cfg_sample | 6 | ||||
| -rw-r--r-- | minimal.cfg | 17 | ||||
| -rw-r--r-- | production.cfg | 19 | ||||
| -rw-r--r-- | searx/engines/piratebay.py | 1 | ||||
| -rw-r--r-- | searx/templates/about.html | 53 | ||||
| -rw-r--r-- | searx/templates/engines.html | 26 | ||||
| -rw-r--r-- | searx/webapp.py | 10 |
10 files changed, 140 insertions, 34 deletions
diff --git a/.gitignore b/.gitignore index 262be427c..7e6560890 100644 --- a/.gitignore +++ b/.gitignore @@ -15,3 +15,4 @@ eggs/ local/ searx.egg-info/ parts/ +var/ @@ -37,14 +37,18 @@ coverage: .installed.cfg @bin/coverage report --show-missing @bin/coverage html --directory ./coverage -minimal: bin/buildout production.cfg setup.py enginescfg +production: bin/buildout production.cfg setup.py enginescfg bin/buildout -c production.cfg $(options) @echo "* Please modify `readlink --canonicalize-missing ./searx/settings.py`" @echo "* Hint 1: on production, disable debug mode and change secret_key" - @echo "* Hint 2: to run server execute 'bin/searx-run'" + @echo "* Hint 2: searx will be executed at server startup by crontab" + @echo "* Hint 3: to run immediatley, execute 'bin/supervisord'" + +minimal: bin/buildout minimal.cfg setup.py enginescfg + bin/buildout -c minimal.cfg $(options) clean: @rm -rf .installed.cfg .mr.developer.cfg bin parts develop-eggs \ searx.egg-info lib include .coverage coverage -.PHONY: all tests enginescfg robot flake8 coverage minimal clean +.PHONY: all tests enginescfg robot flake8 coverage production minimal clean @@ -7,6 +7,7 @@ List of [running instances](https://github.com/asciimoo/searx/wiki/Searx-instanc [](https://flattr.com/submit/auto?user_id=asciimoo&url=https://github.com/asciimoo/searx&title=searx&language=&tags=github&category=software) + ### Features * Tracking free @@ -19,6 +20,7 @@ List of [running instances](https://github.com/asciimoo/searx/wiki/Searx-instanc * Opensearch support (you can set as default search engine) * Configurable search engines/categories + ### Installation * clone source: `git clone git@github.com:asciimoo/searx.git && cd searx` @@ -29,6 +31,7 @@ List of [running instances](https://github.com/asciimoo/searx/wiki/Searx-instanc For all the details, follow this [step by step installation](https://github.com/asciimoo/searx/wiki/Installation) + ### Alternative (Recommended) Installation * clone source: `git clone git@github.com:asciimoo/searx.git && cd searx` @@ -38,9 +41,26 @@ For all the details, follow this [step by step installation](https://github.com/ ### Development -Just run `make`. Versions of dependencies are pinned down inside `versions.cfg` to produce most stable build. +Just run `make`. Versions of dependencies are pinned down inside `versions.cfg` to produce most stable build. Also remember, NO make command should be run as root, not even `make production` + + +### Deployment + +* clone source: `git clone git@github.com:asciimoo/searx.git && cd searx` +* build in current folder: `make production` +* run `bin/supervisord` to start the application -#### Command make + +### Upgrading + +* inside previously cloned searx directory run: `git stash` to temporarily save any changes you have made +* pull source: `git pull origin master` +* re-build in current folder: `make production` +* run `bin/supervisorctl stop searx` to stop searx, if it does not, then run `fuser -k 8888/tcp` +* run `bin/supervisorctl reload` to re-read supervisor config and start searx + + +### Command make ##### `make` @@ -62,9 +82,13 @@ Runs robot (Selenium) tests, you must have `firefox` installed because this func Checks coverage of tests, after running this, execute this: `firefox ./coverage/index.html` +##### `make production` + +Used to make co-called production environment - without tests (you should ran tests before deploying searx on the server). This installs supervisord, so if searx crashes, it will try to pick itself up again. And crontab entry is added to start supervisord at server boot. + ##### `make minimal` -Used to make co-called production environment - without tests (you should ran tests before deploying searx on the server). +Minimal build - without test frameworks, the quickest build option. ##### `make clean` @@ -95,4 +119,5 @@ Bugs or suggestions? Visit the [issue tracker](https://github.com/asciimoo/searx * [ohloh](https://www.ohloh.net/p/searx/) * [twitter](https://twitter.com/Searx_engine) +* IRC: #searx @ freenode diff --git a/engines.cfg_sample b/engines.cfg_sample index f4f398051..ef9a32f34 100644 --- a/engines.cfg_sample +++ b/engines.cfg_sample @@ -22,6 +22,10 @@ engine = duckduckgo_definitions engine = duckduckgo locale = en-us +[filecrop] +engine = filecrop +categories = files + [flickr] engine = flickr categories = images @@ -44,7 +48,7 @@ categories = images [piratebay] engine = piratebay -categories = videos, music +categories = videos, music, files [soundcloud] engine = soundcloud diff --git a/minimal.cfg b/minimal.cfg new file mode 100644 index 000000000..c2a4f5a8d --- /dev/null +++ b/minimal.cfg @@ -0,0 +1,17 @@ +[buildout] +extends = base.cfg +develop = . + +eggs = + searx + +parts += + pyscripts + + +[pyscripts] +recipe = zc.recipe.egg:script +eggs = ${buildout:eggs} +interpreter = py +entry-points = + searx-run=searx.webapp:run diff --git a/production.cfg b/production.cfg index c2a4f5a8d..b290c1a62 100644 --- a/production.cfg +++ b/production.cfg @@ -7,6 +7,8 @@ eggs = parts += pyscripts + supervisor + crontab_reboot [pyscripts] @@ -15,3 +17,20 @@ eggs = ${buildout:eggs} interpreter = py entry-points = searx-run=searx.webapp:run + + +[supervisor] +recipe = collective.recipe.supervisor +http-socket = unix +user = searxer +password = ohpleasedochangeme +file = /tmp/supervisor.sock +chmod = 0700 +programs = + 50 searx ${buildout:bin-directory}/searx-run + + +[crontab_reboot] +recipe = z3c.recipe.usercrontab +times = @reboot +command = ${buildout:bin-directory}/supervisord diff --git a/searx/engines/piratebay.py b/searx/engines/piratebay.py index 11538dd6b..9cf410106 100644 --- a/searx/engines/piratebay.py +++ b/searx/engines/piratebay.py @@ -9,6 +9,7 @@ url = 'https://thepiratebay.se/' search_url = url + 'search/{search_term}/0/99/{search_type}' search_types = {'videos': '200' ,'music' : '100' + ,'files' : '0' } def request(query, params): diff --git a/searx/templates/about.html b/searx/templates/about.html index 977422c5d..a609a3270 100644 --- a/searx/templates/about.html +++ b/searx/templates/about.html @@ -4,49 +4,52 @@ <div class="row"> <h1>About <a href="/">searx</a></h1> - <p>Searx is a <a href="https://en.wikipedia.org/wiki/Metasearch_engine">metasearch engine</a> inspired by the <a href="http://seeks-project.info/">seeks-project</a>. - <br />It tries to provide basic privacy by mixing your queries with those from others while avoiding storing search data. For all browsers (except chrom*) queries are made using a POST request. Thus they don't show up in our logs, nor in your url history. For Chrom* users there is an exception, searx is used from the search bar, it issues GET requests. - <br />You can add it to your browsers search bar and even make it your default search engine. + <p>Searx is a <a href="https://en.wikipedia.org/wiki/Metasearch_engine">metasearch engine</a>, aggregating the results of other <a href="/engines">search engines</a> while not storing information about its users. </p> - <h2>What makes searx different</h2> + <h2>Why use Searx?</h2> <ul> - <li>No ads - searx is Free Software (free-as-in-freedom), funded by your donations</li> - <li>Privacy - tries to minimalize the digital footprint of the searches</li> - <li>Optionally self hosted - see the <a href="#faq">FAQ</a></li> - <li>Easy to add new engines/categories</li> + <li>Maybe Searx won’t offer you as personalised results as Google, but it doesn't make a profile about you</li> + <li>Searx doesn't care about what you search, never shares anything with a third party, and it can't be used to compromise you</li> + <li>Searx doesn't make money on ads and it isn't customised based on your interests. You get the pure search results</li> + <li>Searx is a free software, the code is 100% open and you can help to make it better. See more on <a href="https://gmail.com/asciimoo/searx">github</a></li> </ul> + <p>If you do care about privacy, want to be a conscious user, moreover believe + in digital freedom, make Searx your default search engine or run it on your own server</p> -<h2>Engines</h2> +<h2>Technical details - How does it work?</h2> -{% for (categ,search_engines) in categs %} - <h3>{{ categ.capitalize() }}</h3> - <ul> - {% for search_engine in search_engines %} - {% if not search_engine.private %} - <li>{{ search_engine.name }}</li> - {% endif %} - {% endfor %} - </ul> -{% endfor %} -<p>Please add more engines to this list, pull requests are welcome!</p> +<p>Searx is a <a href="https://en.wikipedia.org/wiki/Metasearch_engine">metasearch engine</a>, +inspired by the <a href="http://seeks-project.info/">seeks project</a>.<br /> +It provides basic privacy by mixing your queries with searches on other platforms without storing search data. Queries are made using a POST request on every browser (except chrome*). Therefore they don't show up in our logs, neither in your url history. In case of Chrome* users there is an exception, Searx uses the search bar to issue GET requests.<br /> +Searx can be added to your browser's search bar, moreover it can be set as the default search engine. +</p> + +<h2>How can I have my own?</h2> -<h2><a href="https://github.com/asciimoo/searx/wiki/Searx-instances">Running public instances</a></h2> +<p>Searx appreciates your suspicion regarding logs, so take the <a href="https://github.com/asciimoo/searx">code</a> and run it yourself! <br />Add your Searx to this <a href="https://github.com/asciimoo/searx/wiki/Searx-instances">list</a> to help other people to have privacy and make the Internet freer! +<br />The more decentralized the Internet is, the more freedom we have!</p> + +<hr /> <h2 id="faq">FAQ</h2> -<h3>Trust</h3> -<p>It's ok if you don't trust us regarding the logs, <a href="https://github.com/asciimoo/searx">take the code</a> and run it yourself! decentralize!</p> + <h3>How to add to firefox?</h3> <p><a href="#" onclick="window.external.AddSearchProvider(window.location.protocol + '//' + window.location.host + '/opensearch.xml')">Install</a> searx as a search engine on any version of Firefox! (javascript required)</p> + <h2 id="dev_faq">Developer FAQ</h2> + <h3>New engines?</h3> <ul> <li>Edit your engines.cfg, see <a href="https://raw.github.com/asciimoo/searx/master/engines.cfg_sample">sample config</a></li> <li>Create your custom engine module, check the <a href="https://github.com/asciimoo/searx/blob/master/examples/basic_engine.py">example engine</a></li> </ul> <p>Don't forget to restart searx after config edit!</p> -<h3>WSGI support?</h3> -<p><a href="https://about.okhin.fr/posts/Searx/">Okhin wrote</a> a great and detailed article about the setup.</p> + +<h3>Installation/WSGI support?</h3> +<p>See the <a href="https://github.com/asciimoo/searx/wiki/Installation">installation and setup</a> wiki page</p> + <h3>How to debug engines?</h3> <p><a href="/stats">Stats page</a> contains some useful data about the used engines.</p> + </div> {% endblock %} diff --git a/searx/templates/engines.html b/searx/templates/engines.html new file mode 100644 index 000000000..1f52dc09f --- /dev/null +++ b/searx/templates/engines.html @@ -0,0 +1,26 @@ +{% extends 'base.html' %} +{% block content %} +<div class="row"> +<h2>Currently used search engines</h2> + + <table style="width: 80%;"> + <tr> + <th>Engine name</th> + <th>Category</th> + </tr> + {% for (categ,search_engines) in categs %} + {% for search_engine in search_engines %} + + {% if not search_engine.private %} + <tr> + <td>{{ search_engine.name }}</td> + <td>{{ categ }}</td> + </tr> + {% endif %} + {% endfor %} + {% endfor %} + </table> +<p>Please add more engines to this list, pull requests are welcome!</p> +<p class="right"><a href="/">back</a></p> +</div> +{% endblock %} diff --git a/searx/webapp.py b/searx/webapp.py index 48448eb25..15ab17d15 100644 --- a/searx/webapp.py +++ b/searx/webapp.py @@ -70,7 +70,8 @@ def get_base_url(): def render(template_name, **kwargs): global categories - kwargs['categories'] = sorted(categories.keys()) + kwargs['categories'] = ['general'] + kwargs['categories'].extend(x for x in sorted(categories.keys()) if x != 'general') if not 'selected_categories' in kwargs: kwargs['selected_categories'] = [] cookie_categories = request.cookies.get('categories', '').split(',') @@ -174,8 +175,13 @@ def index(): @app.route('/about', methods=['GET']) def about(): + return render('about.html') + + +@app.route('/engines', methods=['GET']) +def list_engines(): global categories - return render('about.html', categs=categories.items()) + return render('engines.html', categs=categories.items()) @app.route('/preferences', methods=['GET', 'POST']) |