Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 41 additions & 15 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,14 @@ Install the dtool lookup server::

$ pip install dtool-lookup-server

For a minimal setup, the lookup server requires search and retrieve plugins.
Pick search and retrieve plugins of your choice and install those. Here, the
``dtool-lookup-server-search-plugin-mongo`` and ``dtool-lookup-server-retrieve-plugin-mongo``
serve as default for demonstration::

$ pip install dtool-lookup-server-search-plugin-mongo
$ pip install dtool-lookup-server-retrieve-plugin-mongo

Setup and configuration
-----------------------

Expand All @@ -74,6 +82,39 @@ the app. One therefore needs to define the ``FLASK_APP`` environment variable::

$ export FLASK_APP=dtool_lookup_server

Configure search and retrieve plugins
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

The dtool lookup server is agnostic of how descriptive data is stored and
searched. The implementation is delegated to search and retrieve plugins.
Refer to their documentation for details on their configuration.

In the sample case of ``dtool-lookup-server-search-plugin-mongo`` and
``dtool-lookup-server-retrieve-plugin-mongo``, the same Mongo database
can be used for both search and information retrieval.

Create a directory where the MongoDB data will be stored::

$ mkdir data

Start Mongo DB, for example using docker::

$ docker run -d -p 27017:27017 -v `pwd`/data:/data/db mongo

Configure the search plugin with::

export SEARCH_MONGO_URI="mongodb://localhost:27017/"
export SEARCH_MONGO_DB="dtool_lookup_server"
export SEARCH_MONGO_COLLECTION="datasets"

and the retrieve plugin with::

export RETRIEVE_MONGO_URI="mongodb://localhost:27017/"
export RETRIEVE_MONGO_DB="dtool_lookup_server"
export RETRIEVE_MONGO_COLLECTION="datasets"

This must happen before issuing any ``flask`` commands as below.

Configure the SQL database
^^^^^^^^^^^^^^^^^^^^^^^^^^

Expand All @@ -95,21 +136,6 @@ Populate the SQL database with tables using the commands below::
$ flask db migrate
$ flask db upgrade

Configure the Mongo database
^^^^^^^^^^^^^^^^^^^^^^^^^^^^

The dtool lookup server stores descriptive data in a Mongo database. This is
used for free text searching.

Create a directory where the MongoDB data will be stored::

$ mkdir data

Start Mongo DB, for example using docker::

$ docker run -d -p 27017:27017 -v `pwd`/data:/data/db mongo


Configure a public and private key pair
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Expand Down
6 changes: 6 additions & 0 deletions dtool_lookup_server/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,15 @@ class Config(object):
"sqlite:///{}".format(os.path.join(_HERE, "..", "app.db")),
)
SQLALCHEMY_TRACK_MODIFICATIONS = False

SEARCH_MONGO_URI = os.environ.get("SEARCH_MONGO_URI", "mongodb://localhost:27017/")
SEARCH_MONGO_DB = os.environ.get("SEARCH_MONGO_DB", "dtool_info")
SEARCH_MONGO_COLLECTION = os.environ.get("SEARCH_MONGO_COLLECTION", "datasets")

RETRIEVE_MONGO_URI = os.environ.get("RETRIEVE_MONGO_URI", "mongodb://localhost:27017/")
RETRIEVE_MONGO_DB = os.environ.get("RETRIEVE_MONGO_DB", "dtool_info")
RETRIEVE_MONGO_COLLECTION = os.environ.get("RETRIEVE_MONGO_COLLECTION", "datasets")

JWT_ALGORITHM = "RS256"
JWT_TOKEN_LOCATION = "headers"
JWT_HEADER_NAME = "Authorization"
Expand Down