summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatej Cotman <cotman.matej@gmail.com>2014-01-15 21:18:11 +0100
committerMatej Cotman <cotman.matej@gmail.com>2014-01-15 21:19:24 +0100
commit8210fe90eaff71d5c78cec07e0172444e8b3de97 (patch)
treec4666cf032522990314b18ccefeadfbe7e83ec9a
parent77bd3e04968e9450203fbb2b0ef4b9eb165c5889 (diff)
downloadsearxng-8210fe90eaff71d5c78cec07e0172444e8b3de97.tar.gz
searxng-8210fe90eaff71d5c78cec07e0172444e8b3de97.zip
production environment with supervisor and crontab
-rw-r--r--.gitignore1
-rw-r--r--Makefile10
-rw-r--r--README.md30
-rw-r--r--minimal.cfg17
-rw-r--r--production.cfg19
5 files changed, 71 insertions, 6 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/
diff --git a/Makefile b/Makefile
index b63282ec9..da59ad659 100644
--- a/Makefile
+++ b/Makefile
@@ -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
diff --git a/README.md b/README.md
index d9f159d5d..956796ed0 100644
--- a/README.md
+++ b/README.md
@@ -7,6 +7,7 @@ List of [running instances](https://github.com/asciimoo/searx/wiki/Searx-instanc
[![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)
+
### 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`
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