A very simple Multi-Region design for an application following Command Query Responsibility Separation (CQRS) principles in Azure. In other words, the world's most expensive random number generator....
- A Posix compliant System. It could be one of the following:
- Github CodeSpaces
- Azure Linux VM - Standard_B1s VM will work ($18/month)
- Windows 11 with Windows Subsystem for Linux
- dotnet 8 - The .NET Platform
- Golang - The Go Programming Language
- Visual Studio Code or equivalent - A lightweight code editor
- Docker - The Docker Desktop to build/push containers
- Azure CLI - A tool for managing Azure resources
- PowerShell - The PowerShell Core for running scripts
- git - The source control tool
- Taskfile - A task runner for the shell
- Terraform - A tool for building Azure infrastructure and infrastructure as code
- If exposing application externally then a public domain that you can create DNS records
- Required Certificates
The documentation will use bjd.demo throughout as the root domain. This can be replaced with your own domain
You can use the following link to launch a Codespaces configured for this project:
- The following DNS records are required for the application to work correctly. These are used for the application to be accessed externally. The following records are required:
Name Usage DNS Record Type IP Address api.bjd.demo Azure Front Door CNAME Front Door URL> westus.api.bjd.demo App Gateway A App Gateway IP Address in West US eastus.api.bjd.demo App Gateway A App Gateway IP Address in East US
- The deployment of this application has been automated using Taskfile. This was done instead of using a CI/CD pipeline to make it easier to understand the deployment process.
- Of course, the application can be deployed manually
- The Taskfile is a simple way to run commands and scripts in a consistent manner.
- The Taskfile definition is located in the root of the repository
- The Task file declares the default values that can be updated to suit specific requirements:
Name | Usage | Location | Required | Default or Example Value |
---|---|---|---|---|
TITLE | Value used in Azure Tags | taskfile.yaml | Yes | CQRS Multi-region Pattern in Azure |
DEFAULT_REGIONS | Default region to deploy to | taskfile.yaml | Yes | ["westus3"] |
DOMAIN_ROOT | Default root domain used for all URLs & certs | taskfile.yaml | Yes | bjd.demo |
EXTERNAL_DEPLOYMENT | Will this deployment deploy external components | taskfile.yaml | Yes | false |
USE_REDIS_CACHE | Caches results into Azure Redis Cache | taskfile.yaml | No | false |
DEPLOYMENT_TYPE | Will this deployment deploy to multiple regions | taskfile.yaml | Yes | single (multiregion or single are valid options) |
APIM_PFX_CERT_PATH | Path to the APIM PFX certificate | .env | External Only | ./certs/apim.pfx |
APIM_PFX_CERT_PASSWORD | Password for the APIM PFX certificate | .env | External Only | |
APP_GW_PFX_CERT_PATH | Path to the App Gateway PFX certificate | .env | External Only | ./certs/appgw.pfx |
APP_GW_PFX_CERT_PASSWORD | Password for the App Gateway PFX certificate | .env | External Only | |
FRONTDOOR_URL | The Custom URL for the Azure Front Door | .env | External Only | api.bjd.demo |
APP_GW_URLS | The URLs for the App Gateways | .env | External Only | ["westus.api.bjd.demo"] |
APIM_URLS | The Urls for the APIM Gateways | .env | External Only | ["westus.apim.bjd.demo"] |
- Running the
task
command without any options will run the default command. This will list all the available tasks.task init
: Initialized Terraform modulestask up
: Builds complete environmenttask down
: Destroys all Azure resources and cleans up Terraformtask apply
: Applies the Terraform configuration for the core componentstask external
: Applies ARM templates for external componentstask apim
: Deploys Azure API Managementtask appgw
: Deploys Azure Application Gatewaytask frontdoor
: Deploys Azure Front Doortask build
: Builds containers and pushes to Azure Container Registrytask deploy
: Creates application components and deploy the application codetask ui
: Deploys Blazor UI components to Azure Static Web Appstask validate
: Creates a tunnel to theutils
container app to test internal components
- Moved to Taskfile for deployments instead of script
- Validate certificates naming standards
- General rev updates of TF resources
- General rev updates of ARM template resources
- Update naming standards
- Moved to Managed Redis instead of Azure Cache for Redis
- Code (and modules) updated to latest versions
- Event Processor Function Code updated to Managed Identities for Event Hubs, Functions Runtime/Storage and Redis
- Change Feed Processor Function Code updated to Managed Identities for Event Hubs, Functions Runtime/Storage
- API updated to Managed Identities for Event Hubs, App Insights and Redis
- Gracefully handle connection issues on API startup - non-persistent mode
- Review new APIM v2 features and platform for additional updates
- Update documentation
- Review AppGateway and Front Door configurations for additional updates