This sample demonstrates how to migrate a relational data model to Azure Cosmos DB, a distributed, horizontally scalable, NoSQL database. The repository contains a PowerPoint presentation and a .NET project that demonstrates the evolution of data models from relational to NoSQL.
Choose one of these options to get started:
- Run in GitHub Codespaces - The fastest way to get started with zero local setup
- Run with Docker - Run locally in a container with minimal setup
- Run locally - Traditional local development experience
- Deploy with Azure Developer CLI - Deploy to Azure and run with real Azure Cosmos DB resources
This is the quickest way to get started with CosmicWorks:
- Click the Open in GitHub Codespaces button at the top of this README
- Wait for the Codespace to initialize (this may take a few minutes)
- Once the environment is ready, open the integrated terminal and run:
# Deploy to Azure azd auth login azd init azd up # Run the application cd src dotnet run
- On the main menu, press 'k' to load data
- Explore the different functions by pressing the corresponding menu keys
GitHub Codespaces provides the best performance for data loading since it runs in the cloud, closer to the Azure Cosmos DB resources.
To run CosmicWorks in a containerized environment:
- Make sure Docker is installed on your system
- Clone the repository:
git clone https://github.com/AzureCosmosDB/CosmicWorks.git cd CosmicWorks
- Deploy to Azure first (this creates the necessary appsettings.development.json file):
azd auth login azd init azd up
- Build and run the container:
docker-compose up --build
You can also build and run the Docker container manually:
docker build -t cosmicworks .
docker run -it --volume "./src/appsettings.development.json:/app/appsettings.development.json:ro" cosmicworks
To run CosmicWorks directly on your local machine:
- Ensure .NET 8 SDK is installed
- Clone the repository:
git clone https://github.com/AzureCosmosDB/CosmicWorks.git cd CosmicWorks
- Deploy to Azure (to create the Cosmos DB resources):
azd auth login azd init azd up
- Run the application:
cd src dotnet run
- On the main menu, press 'k' to load data (Note: this can take time when run locally over low bandwidth connections)
- Explore the different functions by pressing the corresponding menu keys
This option deploys a serverless Cosmos DB account with all required databases and containers, and sets up RBAC permissions for both a managed identity and the current user.
- Install the Azure Developer CLI
- Clone this repository to your local machine
- Run the following commands from the repository root:
# Login to Azure
azd auth login
# Initialize the environment (first time only)
azd init
# Provision resources and deploy
azd up
The deployment will automatically:
- Create a serverless Cosmos DB account with all necessary containers
- Set up RBAC permissions
- Create an
appsettings.development.json
file in the src folder with the Cosmos DB endpoint - Configure everything needed to run the application
Important
This project uses a serverless Cosmos DB account so you will not incur RU charges when not running. However, you will pay for storage, approximately $0.25 USD per container per month.
To minimize costs, you can remove the deployed Azure resources when not in use:
azd down --force --purge
The sample data represents 4 versions of the Cosmos DB databases as they progress through the migration from a relational database to a highly scalable NoSQL database: