brandonmayer-zz / sci-wms

SCI-WMS: A Python WMS service for geospatial gridded data (Only triangular unstructured meshes and logically rectangular grids officially supported at this time)
http://asascience-open.github.io/sci-wms
GNU General Public License v3.0
1 stars 0 forks source link

sci-wms

A Python WMS service for geospatial gridded data

COPYRIGHT 2010 RPS ASA

SCI-WMS is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

SCI-WMS is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with SCI-WMS.  If not, see <http://www.gnu.org/licenses/>.

System Requirements

Your system may have already installed the following dependencies, but they are required by some of the module dependencies installed in the next section.

Community

We have started a Google Group for the sci-wms project located here.

Installation

Download the compressed project and unpack or clone this github project into the location the installation will run: git clone https://github.com/asascience-open/sci-wms.git.cat re

Install the following Python dependencies using pip, easy_install, or equivalent. If you are using virtualenv, just make sure you have the environment activated before you try to install the packages or point to the environment with pip on the install command.

pip install numpy
pip install Django==1.6
pip install Shapely
pip install greenlet>=0.3.1
pip install gevent>=0.13.6
pip install gunicorn>=0.13.4
pip install matplotlib>=1.2.0
pip install netCDF4>=1.0.2
pip install rtree
pip install south

You also need to ensure that you have basemap matplotlib toolkit installed, which isn't available from pypi.

wget http://sourceforge.net/projects/matplotlib/files/matplotlib-toolkits/basemap-1.0.6/basemap-1.0.6.tar.gz
pip install basemap-1.0.6.tar.gz

If your version of the HDF5 C libraries is >=1.8.10, you may have to install the netCDF4 Python module from the source repository in order for it to work properly. This requires an SVN client to be installed on your system. (Please let us know if you have problems importing netCDF4 in Python after running this command.)

pip install -e svn+http://netcdf4-python.googlecode.com/svn/trunk#egg=netCDF4

If your NetCDF4 and HDF5 libraries are in non-typical locations, you will need to pass the locations to the pip command:

NETCDF4_DIR=path HDF5_DIR=path pip install netCDF4

If there is problem with gevent or greenlet, or if you would like gunicorn to use an alternative worker, you can install the eventlet worker. With some configuration of the sci-wms gunicorn configuration files, you can also use tornado workers.

pip install eventlet
pip install tornado

Run Migrations

Be sure to run the the south database migrations after setting up your environment. This will add sample data and allow you to set the default user for sci-wms.

python manage.py syncdb       # Prompts to create superuser account
python manage.py migrate

Developing

Testing

To make sure that dependencies have been installed correctly, and that sci-wms is fully functional. Run the following command from the root sci-wms directory to run the tests.

python manage.py test

Running

You can start a development/testing service on port 8000 from the command line by using the following command.

python manage.py runserver

Static assets

If you make changes to any of the static assets within sci-wms, run the following command and commit the results:

python manage.py collectstatic

Deployment

Start the services

You should NOT run the development service on a production server! You will need to run all production sci-wms application servers using gunicorn. Learn about gunicorn wsgi server configuration by clicking here.. A helper script for starting a gunicorn sci-wms server is included with the source. To manage the service, you may use two helper scripts included with sci-wms:

bash start_server.sh

and

bash stop_server.sh

start_server.sh loads the config file gunicorn_config_prod.py that is in the root of the sci-wms source tree. Please look at the gunicorn documentation for additional config options and edit this file as necessary.

In production, you will also need to use a webserver (apache or ngnix) to serve static assets inside of sci-wms. See this nginx example to get started.

Locking down the deployment

You should edit the sciwms/settings/prod.py file after deployment and replace the * in ALLOWED_HOSTS with specific host(s) that that server should be accessible on. Example:

#ALLOWED_HOSTS  = ["*"]
ALLOWED_HOSTS  = ["sciwms.external-host.com", "YOUR_IP_ADDRESS", "sciwms.internal-host"]

Local cache data

Sci-wms caches data on disk so it does not have to read static data from each dataset every request. By default, the path is SCIWMS_ROOT/sciwms/apps/wms/topology. To change this, edit the sciwms/settings/dev.py or sciwms/settings/prod.py files and add a TOPOLOGY_PATH variable.

# Where to store the Topology data?
TOPOLOGY_PATH = "/data/sci-wms-topology"
if not os.path.exists(TOPOLOGY_PATH):
    os.makedirs(TOPOLOGY_PATH)

Caveats:

Look at https://github.com/asascience-open/sci-wms/issues?state=open for a list of known issues and problems.