{"id":15012381,"url":"https://github.com/microsoft/planetary-computer-apis","last_synced_at":"2025-04-05T02:06:30.295Z","repository":{"id":37478423,"uuid":"398018264","full_name":"microsoft/planetary-computer-apis","owner":"microsoft","description":"Planetary Computer APIs","archived":false,"fork":false,"pushed_at":"2025-03-19T16:39:20.000Z","size":11537,"stargazers_count":111,"open_issues_count":21,"forks_count":29,"subscribers_count":10,"default_branch":"main","last_synced_at":"2025-03-29T01:06:49.261Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/microsoft.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":"SUPPORT.md","governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-08-19T17:08:44.000Z","updated_at":"2025-03-19T16:38:54.000Z","dependencies_parsed_at":"2022-07-10T22:33:38.456Z","dependency_job_id":"b39eff06-bcbd-47e0-b396-2354f5004cdb","html_url":"https://github.com/microsoft/planetary-computer-apis","commit_stats":{"total_commits":241,"total_committers":20,"mean_commits":12.05,"dds":0.6887966804979253,"last_synced_commit":"8602de8930ad44c51c738562788f4979460e80e1"},"previous_names":[],"tags_count":25,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/microsoft%2Fplanetary-computer-apis","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/microsoft%2Fplanetary-computer-apis/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/microsoft%2Fplanetary-computer-apis/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/microsoft%2Fplanetary-computer-apis/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/microsoft","download_url":"https://codeload.github.com/microsoft/planetary-computer-apis/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247276163,"owners_count":20912288,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-09-24T19:42:33.502Z","updated_at":"2025-04-05T02:06:30.282Z","avatar_url":"https://github.com/microsoft.png","language":"Python","funding_links":[],"categories":["Planetary Computer"],"sub_categories":["Testing your code"],"readme":"# Microsoft Planetary Computer APIs\n\n__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.\n\nThat said, feel free to crib any code that is useful!\n\n## STAC API + Tiler\n\nThis repository contains two components of the Planetary Computer APIs: the STAC API and the Tiler. These are implementations of the open source [stac-fastapi](https://github.com/stac-utils/stac-fastapi) and [titiler](https://github.com/developmentseed/titiler) projects. It uses [titiler-pgstac](https://github.com/stac-utils/titiler-pgstac) to connect the tiler and database.\n\nThe `pcstac` project provides a STAC API which indexes Microsoft's publicly available [geospatial data](https://planetarycomputer.microsoft.com/catalog) and an API for searching through this large collection.\nThe `pctiler` provides visualization and data access capabilities for the data in the Planetary Computer.\n\n## Azure Functions (a.k.a. Funcs)\n\nThis 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.\n\n## Collection configuration\n\nSee [collection config](./docs/collection-config.md) for more on developing collection configurations.\n\n## Deployment\n\nThis 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)](https://azure.microsoft.com/en-us/services/kubernetes-service/), which we used to stand up a development version of the services. The production deployment code is not contained in this repository.\n\nFor documentation of how you can deploy your own test version of these services, refer to [docs/01-deployment.md](./docs/01-deployment.md).\n\n## Development URLs\n\nAfter 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:\n\n|                      |                                        |\n|----------------------|----------------------------------------|\n| STAC API (via nginx) | \u003chttp://localhost:8080/stac\u003e           |\n| Tiler (via nginx)    | \u003chttp://localhost:8080/data\u003e           |\n| Funcs (vai nginx)    | \u003chttp://localhost:8080/f/image\u003e, etc.. |\n| STAC API (direct)    | \u003chttp://localhost:8081\u003e                |\n| Tiler (direct)       | \u003chttp://localhost:8082\u003e                |\n| Funcs (direct)       | \u003chttp://localhost:8083\u003e                |\n\nTo see the HTTP endpoints available for FastAPI servers, visit the OpenAPI documentation for each service:\n\n|           |                                   |\n|-----------|-----------------------------------|\n| STAC API  | \u003chttp://localhost:8080/stac/docs\u003e |\n| Tiler API | \u003chttp://localhost:8080/data/docs\u003e |\n\nThe 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:\n\n\u003chttp://localhost:8080/stac/collections/naip\u003e\n\n## Building and Testing Locally\n\n### Requirements\n\nThe development environment is run almost entirely through docker containers. Developing locally requires docker-compose v1.27+.\n\n### Running the Planetary Computer API services in a local development environment\n\nThis project uses a variation on [scripts to rule them all](https://github.com/github/scripts-to-rule-them-all).\n\n#### Environment setup and building images\n\nBefore setting up the local environment, you must set the AZURITE_ACCOUNT_KEY environment variable to the Azurite default\naccount key, a string that can be [found here](https://github.com/Azure/Azurite?tab=readme-ov-file#usage-with-azure-storage-sdks-or-tools).\n\nFor example, you can set the environment variable in your terminal with:\n\n```console\nexport AZURITE_ACCOUNT_KEY=$(curl -s https://learn.microsoft.com/en-us/azure/storage/common/storage-use-azurite | grep \"Account key:\" | cut -b 24-111)\n```\n\nTo set up a local environment, use:\n\n```console\n./scripts/setup\n```\n\nThis will build containers, apply database migrations, and load the development data.\n\nAfter migrations and development database loading are in place, you can rebuild the docker images with:\n\n```console\n./scripts/update\n```\n\n`pip` dependencies in `setup.py` are collected and installed through requirements files.\nIf you modify dependencies, run `./scripts/generate-requirements` to regenerate\n`requirements-*.txt` used by Dockerfiles otherwise your dependency change will not\nbe realized.\n\n#### Running the services\n\nThere is a local proxy service that facilitates a local \"managed identity\" functionality, run as your local identity. Make sure to run\n\n```console\naz login\n```\n\nTo run the servers, use\n\n```console\n./scripts/server\n```\n\nThis will bring up the development database, STAC API, Tiler, Azure Functions, and other services.  If at this point something errors out (e.g. nginx complaining about a config file), try deleting the containers/images and rerunning `./scripts/setup`.\n\nThe STAC API can be found at \u003chttp://localhost:8080/stac/\u003e (goes through nginx) or \u003chttp://localhost:8081\u003e directly.\n\nTo hit the tiler, try going to \u003chttp://localhost:8080/data/mosaic/info?collection=naip\u003e, although it will fail due to lack of an authorization header.\n\n#### Testing and and formatting\n\nTo run tests, use one of the following (note, you don't need `./scripts/server` running).  If you get an immediate error related to library stubs, just run it again.  The tiler tests may fail locally, TBD why.\n\n```console\n./scripts/test\n./scripts/test --stac\n./scripts/test --tiler\n./scripts/test --common\n```\n\nTo format code, use\n\n```console\n./scripts/format\n```\n\n## Changing environments\n\nBy default, the `stac`, `tiler`, `funcs`, and supporting services will run against the development containers brought up by `scripts/server`.\nIt can sometimes be convenient to test against other services, e.g. a test database deployed on Azure.\nTo 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`.\nAny environment file named similarly will be .gitignore'd, so you can leave them in your local clone and avoid\ncommitting (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\nenvironment files you want to use before running `scripts/server`. __Note__: Be careful not to run migrations\nwith a non-dev database set - avoid `scripts/setup`, or ensure the migration connection is still using the local\ndev database even if using a remote test db.\n\n## Published images, charts, and functions\n\nThis project publishes images and helm charts, which are used in the deployment of the Planetary Computer.\n\n### Images\n\nThe following images are hosted in the [Microsoft Container Registry](https://github.com/microsoft/ContainerRegistry):\n\n- `mcr.microsoft.com/planetary-computer-apis/stac`\n- `mcr.microsoft.com/planetary-computer-apis/tiler`\n\nOnly tagged builds will be published to MCR, untagged builds will only be published to the internal ACR `pcccr`.\n\n### Charts\n\nSee the [Helm chart repository](https://microsoft.github.io/planetary-computer-apis) published to GitHub pages for the published charts.\n\n### Functions\n\nSee the [Function package repository](https://microsoft.github.io/planetary-computer-apis) published to GitHub pages for the published Azure Functions.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmicrosoft%2Fplanetary-computer-apis","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmicrosoft%2Fplanetary-computer-apis","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmicrosoft%2Fplanetary-computer-apis/lists"}