Skip to content

bcgov/bc-stac

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

bc-stac with stac-fastapi-pgstac

FastAPI

About stac-fastapi-pgstac

https://github.com/stac-utils/stac-fastapi-pgstac

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

Overview

stac-fastapi-pgstac is an HTTP interface built in FastAPI. It validates requests and data sent to a PgSTAC backend, and adds links to the returned data. All other processing and search is provided directly using PgSTAC procedural sql / plpgsql functions on the database. PgSTAC stores all collection and item records as jsonb fields exactly as they come in allowing for any custom fields to be stored and retrieved transparently.

PgSTAC version

stac-fastapi-pgstac depends on pgstac database schema and pypgstac python package.

stac-fastapi-pgstac Version pgstac
4.0 >=0.8,<0.10

Openshift

Postgres bitnami db can be deployed with helm charts/pgstac

helm upgrade --install charts/pgstac/

after deployment migrate to pgstac

Python -m venv venv
Source venv/bin/activate
python -m pip install pypgstac[psycopg]
export PGHOST='127.0.0.1'
export PGPORT='5432'
export PGUSER='quickuser'
export PGDATABASE='bcstac'
export PGPASSWORD='quickpass'
pypgstac migrate

Docker testing

Debugging stac-fastapi-pgstac with docker (need to figure out networking to openshift) ? would this flag work
--add-host=host.docker.internal:host-gateway

docker build -t bc-stac-api .
docker run \
    -p 8080:8080 \
    --name=bc-stac-api \
    --rm \
    --detach \
    --env-file=./.env \
    bc-stac-api

Debug from inside container

docker run -it --env-file=./.env bc-stac-api bash
uvicorn stac_fastapi.pgstac.app:app --host 127.0.0.1 --port 8080

Migrations - this needs to be done on database init

There is a Python utility as part of PgSTAC (pypgstac) that includes a migration utility. To use:

pypgstac migrate

Bulk Loading

There is a Python utility for bulk load of STAC collections and items

pypgstac load collections collection.ndjson
pypgstac load items items.json
''''

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages