-
Notifications
You must be signed in to change notification settings - Fork 7
DeployingWithApache
These instructions should get you up and running with an installation of Guampa on your Linux server with Apache. Here we assume Ubuntu 14.04, although more recent releases should work as well, and other Linux distributions will be similar.
At least on Ubuntu 14.04...
python3
python-pip
python-virtualenv
apache2
libapache2-mod-wsgi-py3
java7-jdk
git clone https://github.com/hltdi/guampa.git
Note!! You should probably check out your copy of guampa somewhere underneath /var/www, so you don't have to change much about the Apache default security model. Let's call it /var/www/guampa.
This will be easier if your user has write access to the /var/www folder.
you@host:/var/www/guampa $ scripts/setup_virtualenv
virtualenv lets us keep all of the dependencies for Guampa (or any other Python project) in one place. It's incredibly convenient!
you@host:/var/www/guampa $ source venv/bin/activate
you@host:/var/www/guampa $ scripts/create_db.sh
You can skip this step and just use the web interface to upload documents.
Either use the Wikipedia import scripts, or import with: you@host:/var/www/guampa $ scripts/store_document.sh documents/sample.txt you@host:/var/www/guampa $ scripts/tag_document.sh 1 "example tag"
Effectively, do something like this: http://flask.pocoo.org/docs/deploying/mod_wsgi/#configuring-apache
Specifically...
-
Turn on mod_rewrite: sudo ln -s /etc/apache2/mods-available/rewrite.load /etc/apache2/mods-enabled/
-
Add something like this to your site config file (which might be named /etc/apache2/sites-enabled/000-default):
RewriteEngine on RewriteRule ^/guampa-demo$ /guampa-demo/ [R] WSGIDaemonProcess guampa-demo user=www-data group=www-data processes=1 threads=5 WSGIScriptAlias /guampa-demo /var/www/guampa/app.wsgi <Directory /var/www/guampa> WSGIProcessGroup guampa-demo WSGIApplicationGroup %{GLOBAL} WSGIScriptReloading On Order allow,deny Allow from all </Directory> -
Restart apache2 (you may have to do this later, or a few times) sudo /etc/init.d/apache2 restart
Make sure your Apache, in its /etc/apache2/envvars, does not set the LANG environment variable to "C". It should be something like "en_US.UTF-8", which is the default locale on our Ubuntu machine. A LANG of "C" will screw up document upload.
So in /etc/apache2/envvars, comment out that line that says "export LANG=C".
Uncomment where it it says:
# . /etc/default/locale
Again in /etc/apache2/envvars, add a line like this:
export NLTK_DATA=/home/YOURUSERNAMEHERE/nltk_data
(the setup_virtualenv script should have downloaded some files and put them in that nltk_data directory)
The www-data will need to have rights to write not just to the guampa.db file, but also to the but also to the directory that contains guampa.db.
$ sudo chgrp www-data /var/www/guampa/guampa.db
$ sudo chgrp www-data /var/www/guampa
$ sudo chmod g+rw /var/www/guampa
$ sudo chmod g+rw /var/www/guampa/guampa.db