/ooi-ui-services

Ocean Observatories Initiative - User Interface Services for CI Integration

Primary LanguagePythonApache License 2.0Apache-2.0

Build Status

ooi-ui-services

Ocean Observatories Initiative - User Interface Services

Services

The WSGI service endpoints are listed and defined below: Active Routes for Listing:

/arrays
/get_data
/organization
/parameters
/platform_deployments
    /platform_deployments?array_id=
/instrument_deployments
    /instrument_deployments?platform_deployment_id=
/streams
    /streams?instrument_id=
/platformlocation
    /platformlocation?reference_designator=
/display_name?reference_designator=

Active Routes for specific item deployment inspection:

/arrays/<string:array_code>
/parameters/<string:id>
/platform_deployments/<string:reference_designator>
/instrument_deployments/<string:reference_designator>
/streams/<string:stream_name>
/parameter/<string:stream_parameter_name>

POST routes:

/annotation
    'comment':
    'field_x':
    'field_y': 
    'y-files':
    'instrument_name':
    'pos_x':
    'pos_y':
    'stream_name': 
    'title': 'test'
    'user_name': 

uFrame normalized routes:

/get_data/<instrument>/<sensor>

Configuration

Be sure to edit your ooiservices/app/config.yml file to the correct URLs and Database Connectors.

Service setup

Ensure you have the following:

sudo apt-get update -qq
sudo apt-get install -y python-dev
sudo apt-get install -y python-matplotlib
sudo apt-get install -y libhdf5-serial-dev
sudo apt-get install -y libnetcdf-dev

While in your virtualenv, run the requirement.txt file: pip install -r ooiservuces/requirements/dev.txt

Setup your PostgreSQL environment: install postgis...

Make sure you have the environment variables defiend:

PYTHONPATH=.

Setup the Database:

#Note, you may bulk load the database with the -bl option
python ooiservices/manage.py deploy --password <admin-password> -bl=True

Debugging Database Problems

If you attempt to deploy the database ooiservices/manage.py deploy and encounter an error "role postgres does not exist". You need to create the role postgres. You can do so by

psql postgres
CREATE ROLE postgres LOGIN SUPERUSER;

Running the services instance

python ooiservices/manage.py runserver

To run the project using uWSGI (Production)

Remember to modify WSGI.py and app.ini to your specific installation environment

sudo mkdir /tmp/ooi-ui-services
sudo chown ooiui:nginx /tmp/ooi-ui-services
sudo chmod 755 /tmp/ooi-ui-services

Launch as a background process

uwsgi --ini app.ini &

Service Tests

Test your initial setup by running from ooi-ui-services directory:

python ooiservices/manage.py test

Verify you are getting data by using a web browser and navigating to:

http://localhost:4000/arrays

This is the backend for the OOI UI