Microsoft Azure
PMTiles can be served from a Azure Container App using the go-pmtiles Docker image.
Blob Storage
PMTiles should stored in a Azure Blob Storage container. File names must include only S3 safe characters.
Make note of the Storage Account Name, region and container name (e.g. main
) for the below steps.
Creating an Azure Container App
In Create Container App, choose the same Azure region as your storage bucket. Create a new Container Apps Environment if necessary.
In Container Details, name your container and choose Docker Hub or other registries as the Image Source.
For Image and Tag input
protomaps/go-pmtiles:v1.22.1
For Command Override input:
/go-pmtiles, serve, ., --bucket=azblob://main?storage_account=account, --public-url=https://example.com
/go-pmtiles, serve, ., --bucket=azblob://main?storage_account=account, --public-url=https://example.com
- Substitute
main
for your Blob Storage container name,account
for your Storage Account name, andhttps://example.com
for the final user-facing URL you intended your tiles to be served from. If you leave this blank, TileJSON won't work.
In the Ingress tab, Enable Ingress and choose Accepting Traffic from Anywhere. Enter
8080
for the Target Port.After validation runs, create your Container App.
Service Connector
You Azure Container App needs read access to your Azure Storage Blob.
After it's initially created, choose Service Connector (preview) > Create.
for Service Type, choose Storage - Blob.
Choose any connection name.
In the Authentication tab, choose Connection String. Click the Advanced tag and rename the
AZURE_STORAGEBLOB_CONNECTIONSTRING
environment variable toAZURE_STORAGE_CONNECTION_STRING
.After validation runs, create your Service Connector.
Your tiles can now be served through your Container App ingress endpoint, e.g. https://example.name.region.azurecontainerapps.io/tileset/0/0/0.mvt
.
For TileJSON to work, tileset.json
, re-configure your Container Command Override with the final user-facing URL for your tiles, such as tiles.example.com
, my-tiles.azureedge.net
for Microsoft CDN, etc.
Cost and Latency
By setting minimum replicas to 0, Azure Container Apps can scale to 0 when there are no requests to be served. However, cold start requests when there are 0 instances can take 10+ seconds to complete.
Setting minimum replicas to 1 can eliminate cold starts and only incur idle usage charges when running.