-
Notifications
You must be signed in to change notification settings - Fork 1
Installation
The installation as described here for Ubuntu 14.04, but should be similar on other Linux distributions. In order to run the application locally do the following:
A) Setup the project source code We recommend using a virtual python environment, but you can also skip step 2-4.
Get a copy of the source code git clone https://github.com/GFZ-Centre-for-Early-Warning/REM_RRVS
$ sudo pip install virtualenv
go to root of project folder (usally the webfolder e.g. "/var/www/rrvs") and run $ virtualenv venv this creates a new folder venv to hold the virtualenvironment
run $ venv/bin/activate to start the enviroment ($ deactivate to stop it)
now you can install python libraries localy in a virtual environment not affecting the host systems python libraries.
sudo apt-get install redis (used for server-side caching)
Use $pip install -r python-requirements.txt
Adjust the rrvs_config.py.example and save it as rrvs_config.py
Create and connect to a database e.g. called rem on the server (or adjust the name accordingly in the rrvs_config.py)
run the templating script for a rem database from within the database (https://github.com/GFZ-Centre-for-Early-Warning/REM_DBschema)
run the extend_rem_db.sql script to extend the schema for the rrvs functionality THE ORDER FOR THE FOLLOWING MATTERS!
populate the database with image and survey information (metadata.sql files as created with PERManEnt makalu.gfz-potsdam.de:/media/EWC/git/permanent.git)
populate the database with assets (building footprints) by using fp2rem_db.py and importing the resulting sql file fp2rem.sql
create users in the users schema of the database see e.g. Users.sql
create tasks for the analysis, there is an R-script for doing so based on a stratification available as a shapefile (rrvsTask.R)
C) OPTIONAL BUT RECOMMENDED: Run the application on an apache2 server with mod_wsgi 1.Install mod_wsgi for apache2
sudo apt-get install libapache2-mod-wsgi
Activate wsgi for apache2
sudo a2enmod wsgi
Create a virtual host for the app
sudo touch /etc/apache2/sites-available/rrvs
4.Add following content (e.g. to run on Port 8080 if you want to keep 80 free):
Listen 8080
<VirtualHost *:8080>
ServerName localhost
WSGIScriptAlias / /var/www/rrvs/rrvs.wsgi
<Directory /var/www/rrvs/webapp>
Order allow,deny
Allow from all
Alias /static /var/www/rrvs/webapp/static
<Directory /var/www/rrvs/webapp/static/>
Order allow,deny
Allow from all
ErrorLog ${APACHE_LOG_DIR}/error.log
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/access.log combined
Activate the site
sudo a2ensite rrvs
Panoramic images are served to the app on a virtual directory called /pano which can be a different place than document root, you'll have to write an Alias in the alias_module part of the apache httpd.conf (add it to the virtual host you created above in Point 4):
Alias /pano /path/to/your/directory
<Directory /path/to/your/directory/>
Options Indexes FollowSymLinks MultiViews
Require all granted
</Directory>
Make sure the permissions for this directory (and all it's parents) are set to 755:
chmod 755 /path chmod 755 /path/to ...
The directory can also have it's own index.html Make sure that in your database image.img.repository is the path to the images relative to /path/to/your/directory. If for example your images are at /path/to/your/directory/survey image.img.repository would be '/survey'.
Reload apache2
sudo service apache2 restart
WARNING:
Currently the app is designed as being open to all IP-Addresses!(webapp/init.py app.run(host="0.0.0.0"))
The default secret key is very weak change it to something more complex! (runserver.py or rrvs_config.py, depending how you run the app)
You can enter the site via the port you defined int the virtual host, e.g. localhost:8080 in a webbrowser
python runserver.py