The publicly available Planetary Computer APIs is a collection of related services that run as containers in Azure Kubernetes Service (AKS). Getting those containers deployed requires a few steps, that we'll go into more below:
- Configure Azure resources
- Build and publish containers
- Create Helm apps consuming those containers
There are many other resources deployed in the public Planetary Computer APIs, but we'll focus here just on the "run containers in the cloud" piece of the deployment.
The key resources required for deploying containers into AKS are a cluster and a container registry. If you're not familiar with Kubernetes, the cluster is an abstraction representing a connection between a scheduler and a node pool. This is a gross oversimplification, but it's sufficient for describing the Planetary Query Engine's Kubernetes deployment. The node pool is responsible for providing undifferentiated compute capacity, e.g., "two cores and 8gb of RAM." The scheduler is responsible for keeping track of what tasks need to run and assigning them to the node pool.
We provision this cluster using terraform, and you can find the cluster configuration in aks.tf.
Building containers happens in the update
script. You can
see there that there are a few build
commands starting with docker-compose
.
Those commands build the containers necessary for running the services, running
migrations, and more.
After those images are built, they need to be pushed to a container
registry. That happens in continuous
integration in the publish-images
job. For each of
the stac and tiler services, that script ships the
images to the an appropriate container registry associated with this
repository. These published container images are publicly available.
To run the published containers in the cluster, we create Helm charts. Helm charts are a templating system for deploying services to Kubernetes clusters.
If you're unfamiliar with Helm and need to debug deployment-related issues, you
can check out the Helm's topics. However, in
short, you'll need to be able to provide variables to fill in the deploy values
template. Most of them are
available from Terraform output, if you completed the Terraform step; however
some also depend on environment variables that you also already needed. You can
find the latter category of values prefixed with env.
in the template.
The entire workflow for testing, building, publishing, and deploying the data
and metadata query engines is publicly viewable in this repository. You can view
workflow runs in the Actions
tab
for this repo at any time.