Skip to content

Latest commit

 

History

History
162 lines (101 loc) · 4.61 KB

README.rst

File metadata and controls

162 lines (101 loc) · 4.61 KB

EIDA Stationlite webservice

Leightweight inventory metadata and routing webservice API as part of EIDA NG. This package implements two major components:

  • Harvesting: Routing information is collected from eidaws-routing localconfig configuration files. Routed stream epochs are fully resolved by means of fdsnws-station and stored in a local DB.

  • Webservice:

    • /eidaws/routing: Alternative implementation of a routing webservice API tailored to the requirements of eidaws-federator (i.e. fully resolved stream epochs, stream epoch canonicalization, etc.). With a few exceptions the API is similar to the one provided by eidaws-routing.
    • /eidaws/stationlite: Leightweight API in order to request inventory metadata information.

    The webservice implementation is based on the Flask framework.

Installation

Development

Download:

Clone the repository:

git clone https://github.com/EIDA/eidaws.git && cd eidaws

Installation:

In order to install the eidaws.stationlite distribution, invoke

pip install numpy
pip install eidaws.utils
pip install eidaws.stationlite[postgres]

The installation of the postgres feature is only required if the application is run with a PostgreSQL backend.

Note, that encapsulating the installation by means of a virtual environment is strongly recommended.

Harvesting

When running the application for the first time you are required to initialize the database for eidaws-stationlite. This will create the database schema.

export FLASK_APP=eidaws.stationlite/eidaws/stationlite/server/ && \
  flask db-init

Routing information is harvested by means of the eida-stationlite-harvest application. For further details on how to use the harvesting application, simply invoke eida-stationlite-harvest -h.

Configuration:

Besides of specifying configuration options at the application's CLI, the application also may be configuration by means of a configuration file. An exemplary fully documented configuration file is provided under eidaws.stationlite/config/eidaws_stationlite_harvest_config.yml.example. In order to change the default configuration simply make a copy of the example configuration with e.g.

cp -v eidaws.stationlite/config/eidaws_stationlite_harvest_config.yml.example \
  eidaws.stationlite/config/eidaws_stationlite_harvest_config.yml

After you've made your changes, invoke the application with

eida-stationlite-harvest \
  -c eidaws.stationlite/config/eidaws_stationlite_harvest_config.yml

Webservice

For development purposes the eidaws.stationlite webservice can be run using the built-in Flask server:

export FLASK_APP=eidaws.stationlite/eidaws/stationlite/server/ && flask run

For additional details execute flask run -h.

Configuration:

The service application can be configured by means of a YAML configuration file. An exemplary fully documented configuration file is provided under eidaws.stationlite/config/eidaws_stationlite_server_config.yml.example. In order to change the configuration make a copy of the example configuration with e.g.

cp -v eidaws.stationlite/config/eidaws_stationlite_server_config.yml.example \
  eidaws.stationlite/config/eidaws_stationlite_server_config.yml

and adjust the configuration according to your needs. Then invoke the corresponding service application with

export EIDAWS_STATIONLITE_SETTINGS=../../../config/eidaws_stationlite_server_config.yml \
  FLASK_APP=eidaws.stationlite/eidaws/stationlite/server/ && flask run

Logging

The eidaws.stationlite distribution uses standard logging for tracking the application activity. An application specific logger named eidaws.stationlite is provided.

When configuring logging by means of a logging configuration file, you may subscribe to this logger for getting log messages.

Testing

Make sure that you're executing the following commands from the repository's root directory.

Required test dependencies can be installed with

(cd eidaws.stationlite && pip install -r requirements/test.txt)

In order to run the tests, invoke

pytest eidaws.utils eidaws.stationlite