Skip to content

briandenicola/azure-multi-region-proof-of-concept

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Introduction

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....

Architecture

Prerequisites

  • A Posix compliant System. It could be one of the following:
  • 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

Notes

The documentation will use bjd.demo throughout as the root domain. This can be replaced with your own domain

Codespaces

You can use the following link to launch a Codespaces configured for this project:

Open in GitHub Codespaces

Public DNS Records:

  • 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

(Back to Top)

Task

  • 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:

Taskfile Variables

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"]

Task Commands

  • Running the task command without any options will run the default command. This will list all the available tasks.
    • task init : Initialized Terraform modules
    • task up : Builds complete environment
    • task down : Destroys all Azure resources and cleans up Terraform
    • task apply : Applies the Terraform configuration for the core components
    • task external : Applies ARM templates for external components
    • task apim : Deploys Azure API Management
    • task appgw : Deploys Azure Application Gateway
    • task frontdoor : Deploys Azure Front Door
    • task build : Builds containers and pushes to Azure Container Registry
    • task deploy : Creates application components and deploy the application code
    • task ui : Deploys Blazor UI components to Azure Static Web Apps
    • task validate : Creates a tunnel to the utils container app to test internal components

(Back to Top)

Roadmap

  • 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

Setup

Return to Main Index 🏠Next Section ⏩

(Back to Top)

Contributors 2

  •  
  •