on master help sign in
Merge pull request #23 from matejc/supervisor
d6949d8Adam Tauber
.gitignore+1
@@ -15,3 +15,4 @@ eggs/
15local/
15local/
16searx.egg-info/
16searx.egg-info/
17parts/
17parts/
18+var/
Makefile+7−3
@@ -37,14 +37,18 @@ coverage: .installed.cfg
37 @bin/coverage report --show-missing
37 @bin/coverage report --show-missing
38 @bin/coverage html --directory ./coverage
38 @bin/coverage html --directory ./coverage
39
39
40−minimal: bin/buildout production.cfg setup.py enginescfg
40+production: bin/buildout production.cfg setup.py enginescfg
41 bin/buildout -c production.cfg $(options)
41 bin/buildout -c production.cfg $(options)
42 @echo "* Please modify `readlink --canonicalize-missing ./searx/settings.py`"
42 @echo "* Please modify `readlink --canonicalize-missing ./searx/settings.py`"
43 @echo "* Hint 1: on production, disable debug mode and change secret_key"
43 @echo "* Hint 1: on production, disable debug mode and change secret_key"
44− @echo "* Hint 2: to run server execute 'bin/searx-run'"
44+ @echo "* Hint 2: searx will be executed at server startup by crontab"
45+ @echo "* Hint 3: to run immediatley, execute 'bin/supervisord'"
46+
47+minimal: bin/buildout minimal.cfg setup.py enginescfg
48+ bin/buildout -c minimal.cfg $(options)
45
49
46clean:
50clean:
47 @rm -rf .installed.cfg .mr.developer.cfg bin parts develop-eggs \
51 @rm -rf .installed.cfg .mr.developer.cfg bin parts develop-eggs \
48 searx.egg-info lib include .coverage coverage
52 searx.egg-info lib include .coverage coverage
49
53
50−.PHONY: all tests enginescfg robot flake8 coverage minimal clean
54+.PHONY: all tests enginescfg robot flake8 coverage production minimal clean
README.md+27−3
@@ -7,6 +7,7 @@ List of [running instances](https://github.com/asciimoo/searx/wiki/Searx-instanc
7
7
8[![Flattr searx](http://api.flattr.com/button/flattr-badge-large.png)](https://flattr.com/submit/auto?user_id=asciimoo&url=https://github.com/asciimoo/searx&title=searx&language=&tags=github&category=software)
8[![Flattr searx](http://api.flattr.com/button/flattr-badge-large.png)](https://flattr.com/submit/auto?user_id=asciimoo&url=https://github.com/asciimoo/searx&title=searx&language=&tags=github&category=software)
9
9
10+
10### Features
11### Features
11
12
12* Tracking free
13* Tracking free
@@ -19,6 +20,7 @@ List of [running instances](https://github.com/asciimoo/searx/wiki/Searx-instanc
19* Opensearch support (you can set as default search engine)
20* Opensearch support (you can set as default search engine)
20* Configurable search engines/categories
21* Configurable search engines/categories
21
22
23+
22### Installation
24### Installation
23
25
24* clone source: `git clone git@github.com:asciimoo/searx.git && cd searx`
26* 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
29
31
30For all the details, follow this [step by step installation](https://github.com/asciimoo/searx/wiki/Installation)
32For all the details, follow this [step by step installation](https://github.com/asciimoo/searx/wiki/Installation)
31
33
34+
32### Alternative (Recommended) Installation
35### Alternative (Recommended) Installation
33
36
34* clone source: `git clone git@github.com:asciimoo/searx.git && cd searx`
37* 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/
38
41
39### Development
42### Development
40
43
41−Just run `make`. Versions of dependencies are pinned down inside `versions.cfg` to produce most stable build.
44+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`
45+
46+
47+### Deployment
48+
49+* clone source: `git clone git@github.com:asciimoo/searx.git && cd searx`
50+* build in current folder: `make production`
51+* run `bin/supervisord` to start the application
42
52
53+
54+### Upgrading
55+
56+* inside previously cloned searx directory run: `git stash` to temporarily save any changes you have made
57+* pull source: `git pull origin master`
58+* re-build in current folder: `make production`
59+* run `bin/supervisorctl stop searx` to stop searx, if it does not, then run `fuser -k 8888/tcp`
60+* run `bin/supervisorctl reload` to re-read supervisor config and start searx
61+
62+
43−#### Command make
63+### Command make
44
64
45##### `make`
65##### `make`
46
66
@@ -62,9 +82,13 @@ Runs robot (Selenium) tests, you must have `firefox` installed because this func
62
82
63Checks coverage of tests, after running this, execute this: `firefox ./coverage/index.html`
83Checks coverage of tests, after running this, execute this: `firefox ./coverage/index.html`
64
84
85+##### `make production`
86+
87+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.
88+
65##### `make minimal`
89##### `make minimal`
66
90
67−Used to make co-called production environment - without tests (you should ran tests before deploying searx on the server).
91+Minimal build - without test frameworks, the quickest build option.
68
92
69##### `make clean`
93##### `make clean`
70
94
minimal.cfgnew file+17
@@ -0,0 +1,17 @@
1+[buildout]
2+extends = base.cfg
3+develop = .
4+
5+eggs =
6+ searx
7+
8+parts +=
9+ pyscripts
10+
11+
12+[pyscripts]
13+recipe = zc.recipe.egg:script
14+eggs = ${buildout:eggs}
15+interpreter = py
16+entry-points =
17+ searx-run=searx.webapp:run
production.cfg+19
@@ -7,6 +7,8 @@ eggs =
7
7
8parts +=
8parts +=
9 pyscripts
9 pyscripts
10+ supervisor
11+ crontab_reboot
10
12
11
13
12[pyscripts]
14[pyscripts]
@@ -15,3 +17,20 @@ eggs = ${buildout:eggs}
15interpreter = py
17interpreter = py
16entry-points =
18entry-points =
17 searx-run=searx.webapp:run
19 searx-run=searx.webapp:run
20+
21+
22+[supervisor]
23+recipe = collective.recipe.supervisor
24+http-socket = unix
25+user = searxer
26+password = ohpleasedochangeme
27+file = /tmp/supervisor.sock
28+chmod = 0700
29+programs =
30+ 50 searx ${buildout:bin-directory}/searx-run
31+
32+
33+[crontab_reboot]
34+recipe = z3c.recipe.usercrontab
35+times = @reboot
36+command = ${buildout:bin-directory}/supervisord