Initial setup (work in progress) - UPOLSearch/UPOL-Search-Engine GitHub Wiki
Create users
adduser celery
adduser upol-search-engine
Create venv and download project
su upol-search-engine
cd
virtualenv -p $(which python3.6) venv
source venv/bin/activate
pip install -I git+https://github.com/UPOLSearch/UPOL-Search-Engine
Create config file as root
mkdir /etc/upol_search_engine/
nano /etc/upol_search_engine/config.ini
[Settings]
mongo_db_server = localhost
mongo_db_port = 27017
mongo_db_user = xxxx
mongo_db_password = xxxx
postgresql_db_server = localhost
postgresql_db_port = 5432
postgresql_db_name = upol
postgresql_db_user = xxxx
postgresql_db_password = xxxx
postgresql_table_name = index
log_dir = /var/log/upol_search_engine/
crawl_task_frequency = 1/s
crawl_every_n_days = 4
analytics_id = xxxxxxxxxxxx
Copy lang dicts
sudo wget https://raw.githubusercontent.com/UPOLSearch/UPOL-Search-Engine/development/psql_dicts/cs_cz.affix /usr/share/postgresql/9.6/tsearch_data/
sudo wget https://raw.githubusercontent.com/UPOLSearch/UPOL-Search-Engine/development/psql_dicts/cs_cz.dict /usr/share/postgresql/9.6/tsearch_data/
sudo wget https://raw.githubusercontent.com/UPOLSearch/UPOL-Search-Engine/development/psql_dicts/en_us.dict /usr/share/postgresql/9.6/tsearch_data/
sudo wget https://raw.githubusercontent.com/UPOLSearch/UPOL-Search-Engine/development/psql_dicts/en_us.affix /usr/share/postgresql/9.6/tsearch_data/
sudo wget https://raw.githubusercontent.com/UPOLSearch/UPOL-Search-Engine/development/psql_dicts/czech.stop /usr/share/postgresql/9.6/tsearch_data/
sudo wget https://raw.githubusercontent.com/UPOLSearch/UPOL-Search-Engine/development/psql_dicts/english.stop /usr/share/postgresql/9.6/tsearch_data/
sudo su postgres
createdb upol
createuser upol
mongo
Then enter
db.createUser( { user: "upol",
pwd: "passwd",
roles: ["readWrite"] })
cd /var/www/
sudo mkdir UPOL-Search-Engine
cd UPOL-Search-Engine/
sudo nano upol-search-engine.wsgi
paste
#!/usr/bin/python
activate_this = '/home/upol-search-engine/venv/bin/activate_this.py'
with open(activate_this) as file_:
exec(file_.read(), dict(__file__=activate_this))
import sys
import logging
logging.basicConfig(stream=sys.stderr)
from upol_search_engine.upol_search_engine import app as application
application.secret_key = 'SECRET_KEY'
site config
cd /etc/apache2/sites-available/
sudo nano upol-search-engine.conf
<VirtualHost *:80>
# The ServerName directive sets the request scheme, hostname and port that
# the server uses to identify itself. This is used when creating
# redirection URLs. In the context of virtual hosts, the ServerName
# specifies what hostname must appear in the request's Host: header to
# match this virtual host. For the default virtual host (this file) this
# value is not decisive as it is used as a last resort host regardless.
# However, you must set it for any further virtual host explicitly.
ServerName DOMAIN
ServerAdmin MAIL
WSGIDaemonProcess upol-search-engine user=celery group=celery threads=5
WSGIScriptAlias / /var/www/UPOL-Search-Engine/upol-search-engine.wsgi
<Directory /var/www/UPOL-Search-Engine>
WSGIProcessGroup upol-search-engine
WSGIApplicationGroup upol-search-engine
Order deny,allow
Allow from all
</Directory>
# Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
# error, crit, alert, emerg.
# It is also possible to configure the loglevel for particular
# modules, e.g.
#LogLevel info ssl:warn
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
# For most configuration files from conf-available/, which are
# enabled or disabled at a global level, it is possible to
# include a line for only one particular virtual host. For example the
# following line enables the CGI configuration for this host only
# after it has been globally disabled with "a2disconf".
#Include conf-available/serve-cgi-bin.conf
</VirtualHost>
# vim: syntax=apache ts=4 sw=4 sts=4 sr noet
cd /etc/init.d/
sudo wget https://raw.githubusercontent.com/celery/celery/3.1/extra/generic-init.d/celeryd
sudo mv celeryd celeryd-upol-search-engine
sudo chmod +x celeryd-upol-search-engine
cd /etc/default/
sudo wget https://raw.githubusercontent.com/UPOLSearch/UP
OL-Search-Engine/development/celeryd-upol-search-engine
sudo su upol-search-engine
source venv/bin/activate
upol_search_engine setup languages
upol_search_engine setup functions
sudo su postgres
psql upol
ALTER USER upol WITH PASSWORD 'new_password';
DROP TEXT SEARCH CONFIGURATION IF EXISTS english;