Skip to content

IS-ENES-Data/stac-fastapi-elasticsearch

 
 

Repository files navigation

Elasticsearch Backend for the stac-fastapi server

stac-fastapi-elasticsearch

Getting started

Copy settings.py.tmpl and remove the tmpl extension. Fill in

  • ELASTICSEARCH_HOST
  • api_key

Create a virtualenv and install requirements

python -m venv venv
./venv/bin/activate
pip intall -r requirements.txt

Running the development server

Option 1 (virtual environment):

This option makes use of traditional virtual environment. You might need to specify the path to the uvicorn binary e.g. /venv/bin/uvicorn to make sure you are using the right environment.

```bash
export STAC_ELASTICSEARCH_SETTINGS=stac_fastapi.elasticsearch.settings
```

```bash
uvicorn stac_fastapi.elasticsearch.app:app --reload
```

Option 2 (Docker):

This option makes use of Docker compose and includes some sample data. It will start a local elasticsearch instance, populate with some data and start the application which will reload if you modify the code or configuration.

make run-sample-elasticsearch

You can change the default settings by creating a file in /conf/settings.d and adding include_dir(base_dir / 'settings.d') to /conf/settings.py Here you can set:

  • ELASTICSEARCH_CONNECTION
  • COLLECTION_INDEX
  • ITEM_INDEX
  • ASSET_INDEX

You could use this to point at production or staging data instead of the local instance.

Demo Application

You can use docker-compose to create a demo instance. This will create an elasticsearch node, add some sample data and run the API.

make run-sample-elasticsearch

NOTE: You will need to build the image first docker-compose build

About

Elasticsearch backend for the stac-fastapi server

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 93.3%
  • Shell 5.4%
  • Other 1.3%