Skip to main content

A stac-fastapi backend using EODAG

Project description

stac-fastapi-eodag

FastAPI

EODAG backend for stac-fastapi, the FastAPI implementation of the STAC API spec

stac-fastapi-eodag combines the capabilities of EODAG and STAC FastAPI to provide a powerful, unified API for accessing Earth observation data from various providers.

Disclaimer

⚠️ This project is a WIP and not ready for any production usage. Use at your own risks.

Getting started

Run stac-fastapi-eodag locally

Prerequisites

Make sure you have the required dependencies installed:

pip install .[server]

Running the server

Once the server is properly set up, you can start it with:

python stac_fastapi/eodag/app.py

# or run directly using uvicorn
# the uvicorn parameters configuration will not be applied
uvicorn stac_fastapi.eodag.app:app

By default, the EODAG HTTP server runs at port 8000.

Run in a container

To run the server as a container:

  1. Build the container image:
docker build -t eodag-fastapi .
  1. Run the container:
docker run -p 8000:8000 eodag-fastapi

Docker Compose

You can also run the server using Docker Compose:

docker compose up

NOTE: This will start a stac-fastapi-eodag container and an otel-collector container for the collection of metrics. The STAC API is available on http://localhost:8080, the metrics can be checked using http://localhost:8000/metrics.

Run in Kubernetes

You can install stac-fastapi-eodag in your Kubernetes cluster with the Helm chart in this repository.

Configuration

stac-fastapi-eodag supports multiple environment variables to customize the deployment of your API.

Uvicorn parameters

name description default value
APP_HOST Bind socket to this host. Use 0.0.0.0 to make the application available from every host. 0.0.0.0
APP_PORT Port from which the application is available. 8000
RELOAD Enable auto-reload. Useful for debug, should be disabled for production. True
UVICORN_ROOT_PATH Used to compute the base_url when exposing the API on a subPath. For instance /stac. You should set ROOT_PATH (from stac-fastapi parameters) as well. This parameter does not change the path on which the API is exposed. It only modify the links in the response body. ""

The full list of available Uvicorn parameters is available from Uvicorn settings page.

stac-fastapi parameters

name description default value
STAC_FASTAPI_TITLE Title of the API. It is displayed on the landing page. "stac-fastapi"
STAC_FASTAPI_DESCRIPTION Description for the API. It is displayed on the landing page. "stac-fastapi"
STAC_FASTAPI_VERSION It is the version number of your API instance. This is not the STAC version. It is displayed on the landing page. 0.1
STAC_FASTAPI_LANDING_PAGE_ID It is a unique identifier for the landing page. It is displayed on the landing page. "stac-fastapi"
ENABLE_RESPONSE_MODELS Turn on response validation. False
OPENAPI_URL Path for the OpenAPI definition of the API. "/api"
DOCS_URL Path for the Swagger UI of the API. "/api.html"
ROOT_PATH Used to compute the base_url when exposing the API on a subPath. For instance /stac. You should set UVICORN_ROOT_PATH (from Uvicorn parameters) as well. This parameter does not change the path on which the API is exposed. It only modify the links in the response body. ""

Reach to stac-fastapi documentation for exhaustive documentation on stac-fastapi.

stac-fastapi-eodag parameters

name description default value
DEBUG When set to True, set the EODAG logging level to 3. Otherwise, set EODAG logging level to 2. False
KEEP_ORIGIN_URL Keep origin as alternate URL when data-download extension is enabled. False
ORIGIN_URL_BLACKLIST Hide from clients items assets' origin URLs starting with URLs from the list. A string of comma separated values is expected. ""
COUNT Whether to run a query with a count request or not. False
FETCH_PROVIDERS Fetch additional collections from all EODAG providers. False
AUTO_ORDER_WHITELIST List of providers for which the order should be done at the same time as the download. ["wekeo_main"]
DOWNLOAD_BASE_URL Useful to expose asset download URL in a separate domain name. ""

OpenTelemetry parameters

name description default value
OTEL_EXPORTER_OTLP_ENDPOINT Target url to which the exporter sends the metrics. ""
OTEL_METRIC_EXPORT_INTERVAL Time interval (in milliseconds) between the start of two export attempts. 60000
OTEL_EXPORTER_OTLP_TIMEOUT Timeout value for all outgoing data (traces, metrics, and logs) in milliseconds. 10000

To start an otel-collector container and to connect it to an instance of STAC API the following commands can be used:

pip install .[server,telemetry]
docker run -p 4318:4318 -p 8000:8000 \
    -v ./config/otelcol_config.yml:/etc/otel-collector-config.yaml \
    otel/opentelemetry-collector:latest \
    --config=/etc/otel-collector-config.yaml
export OTEL_EXPORTER_OTLP_ENDPOINT="http://localhost:4318/"
export OTEL_METRIC_EXPORT_INTERVAL="5000"  # shorter export interval for testing
export APP_PORT=8080  # change app port because otel-collector uses 8000
python stac_fastapi/eodag/app.py

EODAG parameters

EODAG configuration parameters are available from EODAG documentation.

Contribute

Have you spotted a typo in our documentation? Have you observed a bug while running stac-fastapi-eodag? Do you have a suggestion for a new feature?

Don't hesitate and open an issue or submit a pull request, contributions are most welcome!

For guidance on setting up a development environment and how to make a contribution to eodag, see the contributing guidelines.

Acknowledgments

We would like to express our gratitude to the maintainers and contributors of the following projects which have been instrumental in the development of this project:

  • stac-fastapi: Thanks to the stac-fastapi team for their implementation of the STAC API spec.
  • FastAPI: Thanks to the FastAPI team for providing a modern, fast (high-performance) web framework for building APIs.

License

stac-fastapi-eodag is licensed under Apache License v2.0. See LICENSE file for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

stac_fastapi_eodag-0.2.0.tar.gz (66.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

stac_fastapi_eodag-0.2.0-py3-none-any.whl (66.2 kB view details)

Uploaded Python 3

File details

Details for the file stac_fastapi_eodag-0.2.0.tar.gz.

File metadata

  • Download URL: stac_fastapi_eodag-0.2.0.tar.gz
  • Upload date:
  • Size: 66.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for stac_fastapi_eodag-0.2.0.tar.gz
Algorithm Hash digest
SHA256 c14c273192ebd1bcee4c156e86a4582e7c50431d2cf3865c53a7920cd98b2121
MD5 d5c00832af184d423af7ef426a4b317d
BLAKE2b-256 873e4a84ea76baef17473386951ad7fa52124426f939ff65e58197f097075f1a

See more details on using hashes here.

File details

Details for the file stac_fastapi_eodag-0.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for stac_fastapi_eodag-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f6f91e82ea244cae40ab812012103431fe61834c63d83cf3021caf224e09703d
MD5 cf09cee1001b671c7d26782c69fe2ffc
BLAKE2b-256 8587edf9f61604129720ce3fbf62fb6bcc43b86eb9b4e4c4f84e643bb01dc3aa

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page