Planetary Computer APIs
Перейти к файлу
Gustavo Hidalgo 2ee54a0d46
Merge branch 'main' into guhidalgo/securitypatching
2024-04-15 14:17:32 -04:00
.github Publish tagged builds to pccomponents (#202) 2024-04-15 14:17:08 -04:00
auxiliary/az-cli-proxy Add config/map/token endpoint to support Data Catalog (#187) 2024-03-18 09:44:34 -04:00
deployment Add AKS cluster maintenance window. (#201) 2024-04-12 11:12:08 -04:00
docs Upgrade pgstac and use queryables (#131) 2023-04-07 14:03:52 -04:00
nginx Support collection-level vector tiles (#147) 2023-01-24 15:22:44 -05:00
pccommon Merge branch 'main' into guhidalgo/securitypatching 2024-04-15 14:06:15 -04:00
pcfuncs Update more packages 2024-03-28 11:48:50 -04:00
pcstac Remove files from older commits 2024-04-15 14:15:25 -04:00
pctiler Merge branch 'main' into guhidalgo/securitypatching 2024-04-15 14:06:15 -04:00
pgstac Support collection-level vector tiles (#147) 2023-01-24 15:22:44 -05:00
scripts Merge branch 'main' into guhidalgo/securitypatching 2024-04-15 14:17:32 -04:00
.flake8 Add Azure Functions for creating images and animations (#115) 2022-08-16 12:02:09 -04:00
.gitignore Publish pcfuncs package (#117) 2022-09-13 20:34:29 -04:00
.isort.cfg Initial commit. 2021-10-18 12:13:28 -04:00
CHANGELOG.md Update changelog for release (#174) 2023-05-03 10:31:13 -04:00
CODE_OF_CONDUCT.md CODE_OF_CONDUCT.md committed 2021-08-19 10:08:58 -07:00
LICENSE LICENSE committed 2021-08-19 10:08:59 -07:00
README.md Merge branch 'main' into guhidalgo/securitypatching 2024-04-15 14:06:15 -04:00
SECURITY.md Initial commit. 2021-10-18 12:13:28 -04:00
SUPPORT.md Initial commit. 2021-10-18 12:13:28 -04:00
azure-pipelines.yml Initial commit. 2021-10-18 12:13:28 -04:00
docker-compose.dev.yml Add config/map/token endpoint to support Data Catalog (#187) 2024-03-18 09:44:34 -04:00
docker-compose.yml Update Azurite 2024-03-27 14:59:34 -04:00
mypy.ini Initial commit. 2021-10-18 12:13:28 -04:00
pc-funcs.dev.env Remove sleep call in pcfunc tile fetching (#132) 2022-10-25 17:18:10 -04:00
pc-stac.dev.env Hydrate search result items in the API (#81) 2022-05-13 21:16:41 -04:00
pc-tiler.dev.env Support collection-level vector tiles (#147) 2023-01-24 15:22:44 -05:00
pytest.ini Include hostname in redis cache key (#98) 2022-05-24 13:19:27 -04:00
requirements-dev.txt Generate requirments.txt 2024-03-26 11:23:32 -04:00

README.md

Microsoft Planetary Computer APIs

Note: This repository serves as a reference implementation for deploying APIs on Azure. This code supports the production deployment of the Planetary Computer APIs. This repository is not meant to be reusable in other situations without significant modification, and the repository maintainers will not provide any support for non-development deployments of this code.

That said, feel free to crib any code that is useful!

STAC API + Tiler

This repository contains two components of the Planetary Computer APIs: the STAC API and the Tiler. These are implementations of the open source stac-fastapi and titiler projects. It uses titiler-pgstac to connect the tiler and database.

The pcstac project provides a STAC API which indexes Microsoft's publicly available geospatial data and an API for searching through this large collection. The pctiler provides visualization and data access capabilities for the data in the Planetary Computer.

Azure Functions

This repository also contains Azure Functions that provide additional endpoints for working with Planetary Computer data and metadata. This includes Function endpoints for generating images and animations based on STAC searches, using the tiler to render mosaiced data from Collections

Collection configuration

See collection config for more on developing collection configurations.

Deployment

This repository hosts the code that is deployed in the Planetary Computer. It contains deployment code for hosting these services in Azure through running the published docker images and Helm charts in Azure Kubernetes Service (AKS), which we used to stand up a development version of the services. The production deployment code is not contained in this repository.

For documentation of how you can deploy your own test version of these services, refer to docs/01-deployment.md.

Development URLs

After building the project locally using the instructions below, you can access the development version of the services by pointing your browser to the following URLs:

STAC API (via nginx) http://localhost:8080/stac
Tiler (via nginx) http://localhost:8080/data
Funcs (vai nginx) http://localhost:8080/f/image, etc..
STAC API (direct) http://localhost:8081
Tiler (direct) http://localhost:8082
Funcs (direct) http://localhost:8083

To see the HTTP endpoints available for FastAPI servers, visit the OpenAPI documentation for each service:

STAC API http://localhost:8080/stac/docs
Tiler API http://localhost:8080/data/docs

The development data only includes a single collection naip, with a few items in it. You can verify the data is loaded correctly by visiting the following URL:

http://localhost:8080/stac/collections/naip

Building and Testing Locally

Requirements

The development environment is run almost entirely through docker containers. Developing locally requires docker-compose v1.27+.

Running the Planetary Computer API services in a local development environment

This project uses a variation on scripts to rule them all.

Environment setup and building images

To set up a local environment, use

> ./scripts/setup

This will build containers, apply database migrations, and load the development data.

After migrations and development database loading are in place, you can rebuild the docker images with

> ./scripts/update

pip dependencies in setup.py are collected and installed through requirements files. If you modify dependencies, run ./scripts/generate-requirements to regenerate requirements-*.txt used by Dockerfiles otherwise your dependency change will not be realized.

Running the services

There is a local proxy service that facilitates a local "managed identity" functionality, run as your local identity. Make sure to run

az login

To run the servers, use

> ./scripts/server

This will bring up the development database, STAC API, Tiler, Azure Functions, and other services.

Testing and and formatting

To run tests, use

./scripts/test

To format code, use

./scripts/format

Changing environments

By default, the stac, tiler, funcs, and supporting services will run against the development containers brought up by scripts/server. It can sometimes be convenient to test against other services, e.g. a test database deployed on Azure. To do that, you can create a new environment file for the services based on ./pc-stac.dev.env, ./pc-tiler.dev.env, and/or ./pc-funcs.dev.env. Any environment file named similarly will be .gitignore'd, so you can leave them in your local clone and avoid committing (e.g. ./pc-stac.testing.env). You then need to set the PC_STAC_ENV_FILE, PC_TILER_ENV_FILE, and PC_FUNCS_ENV_FILE to the environment files you want to use before running scripts/server. Note: Be careful not to run migrations with a non-dev database set - avoid scripts/setup, or ensure the migration connection is still using the local dev database even if using a remote test db.

Published images, charts, and functions

This project publishes images and helm charts, which are used in the deployment of the Planetary Computer.

Images

The following images are hosted in the Microsoft Container Registry:

  • mcr.microsoft.com/planetary-computer-apis/stac
  • mcr.microsoft.com/planetary-computer-apis/tiler

Only tagged builds will be published to MCR, untagged builds will only be published to the internal ACR pcccr.

Charts

See the Helm chart repository published to GitHub pages for the published charts.

Functions

See the Function package repository published to GitHub pages for the published Azure Functions.