Skip to content

I-GUIDE/catalogapi

Repository files navigation

I-GUIDE catalog API

I-GUIDE Catalog API

Getting Started

cp .env.template .env
make build
make up

Formatting

make format

Schema Generation

make schema

JSON Schema file serving

Files in api/models/schemas are served at /api/schemas

(i.e. https://localhost/api/schemas/dataset.json)

Atlas

For discovery to work the mongo db must be configured to use Atlas, search indexes created and a couple of adminstrative settings must be configured. Reach out to sblack@cuahsi.org if you need a db for development work.

  1. Update the .env file with Atlas credentials
OIDC_ISSUER=https://orcid.org/

DB_USERNAME={username}
DB_PASSWORD={password}
DB_HOST=cluster0.iouzjvv.mongodb.net
DATABASE_NAME=iguide_{user}
DB_PROTOCOL=mongodb+srv

HYDROSHARE_META_READ_URL=https://www.hydroshare.org/hsapi2/resource/%s/json/
HYDROSHARE_FILE_READ_URL=https://www.hydroshare.org/hsapi/resource/%s/files/

TESTING=True
  1. Login and submit a record to create all the collections
  2. Run triggers/management/change_streams_pre_and_post.py
  3. Create the catalog and typeahead indexes from atlas/ (TODO detailed instructions)

Triggers

Triggers have their own docker image (docker/triggers/Dockerfile). There are two triggers:

  1. triggers/update_catalog.py listens to the Submission collections and updates the discovery collection accordingly.
  2. triggers/update_typeahead.py listens to the discovery collection and updates the typeahead collection accordingly.

The triggers have not been configured with a resume_token yet.

Frontend

A vue application. docker/frontend/Dockerfile deploys a development version of the vue application and is slow to start up. Deployments should use frontend/Dockerfile as it is configured to generate the static files and then serve them.