Nwd stands for Northwind 😜 This solution's idea is to exercise a few concepts using modern tools, frameworks and libraries. I'm using microservices approach. Each microservice has a different pattern to solve different problems.
Why Dapr? It fits this architecture because it solves an essential part of configuring services, such as queue topics, to support publish/subscriber patterns. It avoids a lot of boilerplate code.
.
├── .static :: support files.
├── components :: dapr components for local development.
├── infrastructure :: Azure infrastructure.
└── templates :: individual bicep templates that are deployed.
├── pipelines :: azure devops pipeline definitions and templates.
├── src :: dotnet solution and source files.
└── README.md
It handles basket operations.
- It simulates a Data-Driven (CRUD) scenario.
- Consumes Dapr State Service API.
- TODO: Once basket is submitted to checkout it publishes a message in the topic order-submitted.
It handles product and inventory operations.
- It simulates a very complext domain.
- Pusblishes a ProductCreatedEvent into a topic new-product-topic for every new product created.
- Uses isolation level to deal with concurrency transactions due to stock level operations.
It handles orders operations.
- It simulates a CRUD.
- Subscribes a topic new-product-topic.
- Once a order is submitted a state machine (SAGA) starts to reserve the items in the inventory and process payment.
- TODO: Subscribes a topic order-submitted.
Follow the steps below to setup you development enviroment.
- Install Docker
- Install Docker
- Switch to Linux containers.
- Install Azure Cosmos DB Emulator.
- Install Dapr-Cli.
$Env:DAPR_INSTALL_DIR = "C:\Users\<user>\.dapr\bin" powershell -Command "iwr -useb https://raw.githubusercontent.com/dapr/cli/master/install/install.ps1 | iex"
Open Visual Studion Solition and run docker-compose. Solution will start and attach all application with debugging support.
Login-AzAccount -Subscription "??"
$templateArgs = @{
SolutionName = '??'
EnvironmentName = 'lab'
BuildId = ((Get-Date).ToUniversalTime()).ToString('MMddHHmm')
}
$deploymentArgs = @{
TemplateArgs = $templateArgs
SubscriptionId = '??'
ResourceGroupName = '??'
BicepFilePath = '.\templates\main.infrastructure.bicep'
TemplateOutFile = '.\out\main.json'
}
.\Deploy-Infrastructure.ps1 @deploymentArgs -Verbose
$templateArgs = @{
SolutionName = '??'
EnvironmentName = 'lab'
BuildId = ((Get-Date).ToUniversalTime()).ToString('MMddHHmm')
KeyVaultName = '??'
imageVersion = '??'
containerRegistryLoginServer= '??'
containerAppEnvName = '??'
containerAppEnvUsrMngtIdName= '??'
}
$deploymentArgs = @{
TemplateArgs = $templateArgs
SubscriptionId = '??'
ResourceGroupName = '??'
BuildId = ((Get-Date).ToUniversalTime()).ToString('MMddHHmm')
BicepFilePath = './templates/main.application.bicep'
TemplateOutFile = './out/main.json'
}
.\Deploy-Infrastructure.ps1 @deploymentArgs -Verbose
This solution uses Azure DevOps pipelines integrated with GH. You can check out YML pipelines into deployment\pipelines folder. Run the pipelines following:
- Getting started - https:/docs.dapr.io/getting-started/
- Dapr Official Web Site - https://dapr.io/
- Youtube presentation about Dapr and Container App
- MS Dapr Application Example