Table of Contents

cotopaxi

About

A toolset for deploying data to Azure Cosmos DB as part of a cloud-native application, designed for straightforward integration with CI/CD pipelines. The package format is based on Microsoft Common Data Model (CDM) and ECMA-376 (Open Packaging Conventions).

flowchart LR
  s1[/"<p style='width:100px'>JSON<br />documents</p>"/]
  s2[["<p style='width:100px'>cotopaxi<br />pack</p>"]]
  s3[/"<p style='width:100px'>CDM<br />package</p>"/]
  s4[["<p style='width:100px'>cotopaxi<br />deploy</p>"]]
  s5[("<p style='width:100px'>Azure<br />Cosmos DB</p>")]
  s1 --> s2 --> s3 --> s4 --> s5
  classDef default stroke-width: 2px, font-family: system-ui

Packing the database documents specified in a database package project (an example with Azure Pipelines):

$ dotnet tool run cotopaxi pack $(Build.SourcesDirectory)/adventureworks.json $(Build.StagingDirectory)/adventureworks.cdbpkg
/home/vsts/work/1/s/adventureworks/products/bikes.json:$[0]: upsert /adventureworks/products/3202cb6f-42af-4fe6-a3c5-d61927721e75 (4)
/home/vsts/work/1/s/adventureworks/products/bikes.json:$[1]: upsert /adventureworks/products/e1894e24-550d-4fe3-9784-47d614600baa (4)

Deploying the created database package to a configured Azure Cosmos DB account (an example with Azure Pipelines):

$ dotnet tool run cotopaxi deploy $(System.ArtifactsDirectory)/**/*.cdbpkg
/home/vsts/work/r1/a/adventureworks.cdbpkg >>> https://adventureworks.documents.azure.com:443
upsert /adventureworks/products/3202cb6f-42af-4fe6-a3c5-d61927721e75:["bikes"]: HTTP 200 (6.67 RU)
upsert /adventureworks/products/e1894e24-550d-4fe3-9784-47d614600baa:["bikes"]: HTTP 200 (6.67 RU)

References