Installing Diva on web on your server

From GHER

Jump to: navigation, search

The software Diva on web/OceanBrowser is composed by a client and server part. The server essentially supports the standardized requests for listing all available layers and format and projection in which they are available, provides a rendered picture of the required layer, and provides additional information of a given location (often the value of the field). The server is built entirely upon open source software. It is written in python using Matplotlib and basemap for graphical output. It is embedded in Apache and runs on a dedicated Linux server (two Intel Xeon E5420 quad-cores) at the University of Liege. The client part runs in a web browser and uses the JavaScript library OpenLayers to display the layers from the server. A simplified version of OceanBrowser is also used in Diva-on-web, an on-line tool to create interpolated fields from in situ ocean data.


Contents

Before you start

You should have a Linux web-server with about 8 GB of RAM (or more). All this steps are automated if you use divaonweb/OceanBrowser with Docker.


Download

The source code is available at: http://modb.oce.ulg.ac.be/mediawiki/upload/Alex/divaonweb/

Requirements

in addition those packages are recommended

8 - 16 GB of RAM are recommended. Specific instructions for Ubuntu.

Installation

In the following we assume that the package is installed in $HOME/Python/packages. This directory must be included in the environment variable PYTHONPATH. If your shell is bash, you can include the following to your file .bashrc

mkdir -p $HOME/Python/packages/
export PYTHONPATH=$PYTHONPATH:$HOME/Python/packages

You can install the package with the command easy_install. If you downloaded a package:

export PYTHONPATH=$PYTHONPATH:$HOME/Python/packages
easy_install --install-dir ~/Python/packages/ divaonweb-x.y.z.tar.gz

Or for the SVN check-out

easy_install --install-dir ~/Python/packages/ divaonweb

Deployment

To create a new instance of the server called here (my-server), issue the following command:

paster create -t divaonweb_server my-server

Where 'my-server' is the name of the new instance. You may want adjust the file my-server/server.ini.

Stand-alone

To launch the server:

paster serve ./my-server/server.ini

You can access the interface at http://localhost:8080. To make public set host:

[server:main]
use = egg:Paste#http
# Change to 0.0.0.0 to make public
#host = 127.0.0.1
host = 0.0.0.0


Apache

You can also run diva-on-web and OceanBrowser behind an Apache web server. You may need to adapt the file apache/divaonweb.wsgi.

In apache's configuration file (/etc/apache2/sites-enabled/000-default.conf in ubuntu) you need to define WSGIScriptAlias inside the VirtualHost tags:

WSGIScriptAlias /mount-point /path/to/apache/divaonweb.wsgi

For example:

<Directory /home/abarth/workspace/seadatanet-server/apache>
   Require all granted
</Directory>

WSGIDaemonProcess gher-diva.phys.ulg.ac.be processes=8 threads=15
WSGIProcessGroup gher-diva.phys.ulg.ac.be
WSGIScriptAlias /web-vis /home/abarth/workspace/seadatanet-server/apache/divaonweb.wsgi
WSGIApplicationGroup %{GLOBAL}

See http://stackoverflow.com/questions/17516424/from-scipy-interpolate-import-interp1d-hangs-django

mkdir /var/www/.python-eggs
chown -R  www-data.www-data /var/www/.python-eggs
touch /home/divaonweb/workspace/seadatanet-server/divaonweb.log
chown -R  www-data.www-data /home/divaonweb/workspace/seadatanet-server/divaonweb.log /home/divaonweb/workspace/seadatanet-server/tmp
mkdir /home/divaonweb/workspace/seadatanet-server/tmp/P011
chown www-data.www-data /home/divaonweb/workspace/seadatanet-server/tmp/P011
sudo chmod +rx /var/www/data


wms_url in server.ini must then be:

wms_url = http://<IP address or server name>/mount-point/Python/web/wms?

Caveats

Warnings like:

/usr/lib/pymodules/python2.6/matplotlib/__init__.py:835: UserWarning:  This call to matplotlib.use() has no effect
because the the backend has already been chosen;
matplotlib.use() must be called *before* pylab, matplotlib.pyplot,
or matplotlib.backends is imported for the first time.

can be safely ignored.

Web-interface for make a diva analysis on-line

Some additional steps are required to used the web-interface for making diva analysis on-line:

File permission

sudo chown -R www-data.www-data /var/www
sudo chmod -R g+w /var/www
sudo adduser $USER www-data
# logout and login


# not really necessary, but otherwise octave complains
touch /var/www/.octave_hist
sudo chown  www-data.www-data /var/www/.octave_hist

Diva

Downloading and installing Diva

svn co svn+ssh://modb.oce.ulg.ac.be/home/svn/repos/diva/trunk diva
cd diva
svn up -r '{2009-01-08}'
mkdir bin
cd src/Fortran

adapt divacompile

./divacompile
cd ../..
mkdir -p /var/www/web-vis/Diva/
cp -R bin divastripped /var/www/web-vis/Diva/
cd /var/www/web-vis/Diva/
mkdir divastripped_template
cd divastripped_template/
ln -s ../divastripped/* .
rm divawork gnuwork input meshgenwork output
mkdir -p divawork gnuwork input meshgenwork output/{ghertonetcdf,meshvisu}
cd ..
chown -R www-data.www-data /var/www/web-vis/Diva

Troubleshooting

  • The following request should produce the land-sea mask of the Earth:
http://gher-diva.phys.ulg.ac.be/web-vis/Python/web/continents?LAYERS=cont&FORMAT=image%2Fpng&EXCEPTIONS=application%2Fvnd.ogc.se_xml&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&STYLES=&SRS=EPSG%3A4326&BBOX=-180,-90,180,90&WIDTH=512&HEIGHT=256

(replace the hostname and the WSGI monting point)

continents.png

This test is indepented from your NetCDF files.

Versions to avoid

  • matplotlib 1.1.1rc: creates a spurious transparent 1 pixel around every tile (works in matplotlib 1.2.1)

Credits

Besides all software listed in Requirements, "Diva on web" uses the great Javascript library Openlayers.

Personal tools