This solution uses Azure Pipelines based CI/CD. For GitHub Actions samples please see this repository.
This is the modernized and up to date version of sample provided by Microsoft (Orleans Cluster on Azure Container Apps). It uses:
- Fully automated Azure Pipelines to deploy from code to cloud with minimal effort
- Blazor Server model which works on .NET 9 and Microsoft Orleans 9
- Scalable server-side Blazor app on Azure Container Apps
- Azure SignalR Service, Azure Key Vault, Azure Storage Account, Azure Application Insights, Azure Load Testing, Microsoft Playwright for E2E Tests, Azure DevOps and many more
What is required for this solution?
- Microsoft Azure Subscription, you can create a free account if you don't have any.
- Open Azure DevOps portal : https://dev.azure.com/
- Create new organization/use an existing organization. A sample name: orleans-on-ctap1
- Create a new public project. A sample name: ShoppingApp. For a public project Microsoft provides unlimited restriction for parallel jobs (by default up to 25 parallel jobs) in case you use self-hosted agents.
- Import existing repository: https://github.com/Async-Hub/Orleans-Cluster-on-Azure-Container-Apps-Advanced.git
- Create YAML pipeline by using exsisting "Azure-Pipelines.yml" from imporeted sources. A sample name: Default CI and CD pipeline. After creation just only save it, don't run it.
Install Docker Desktop on operation system which you are using.
Attention! The steps outlined below, up to section 3, are optional
If you are using Windows 11 or Windows 10 it is more appropriate to use WSL 2 and install Docker Desktop on Ubuntu-22.04. Here we have two options:
- The first option is to use WSL 2 on the host operationg system.
- The second option is to keep the host operating system clean and create a Windows 10/11 Virtual Machine with Hyper-V using Nested Virtualization. What are required for Nested Virtualization?
- Windows machine with virtualization technology (AMD-V / Intel VT-x)
- Windows Server 2016/Windows 10 or greater for Intel processor with VT-x
- Windows Server 2022/Windows 11 or greater AMD EPYC/Ryzen processor
- Enable nested virtualization on the Virtual Machine
Regardless of the option you chose above, you need to open a terminal on the host (for the first option) or on the VM (for the second option). Then enable WSL 2 and install Ubuntu 22.04 with the following command, typing it in the terminal window:
wsl --install -d Ubuntu-22.04
Install Docker Engine on Ubuntu.
$ sudo apt-get update
$ sudo apt-get install ca-certificates curl
$ sudo install -m 0755 -d /etc/apt/keyrings
$ sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc
$ sudo chmod a+r /etc/apt/keyrings/docker.asc
$ echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu \
$(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
$ sudo apt-get update
$ sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
Start Docker service.
sudo service docker start
sudo service docker status
You can clone the solution you have imported https://dev.azure.com/orleans-on-ctap1/_git/ShoppingApp into C:\ drive on your Windows machine (Git CLI is required)
mkdir C:\Repos
cd C:\Repos
git clone https://dev.azure.com/orleans-on-ctap1/_git/ShoppingApp
and interop with it from Ubuntu-22.04 by the following way:
$ cd /mnt/c/Repos/ShoppingApp/build/azure-pipelines-agents/debian-12.x/
$ sudo docker build -t azure-pipelines-agents-debian-12.7:27112024 .
Build an agent docker image by using files from "build\azure-pipelines-agents" based on Debian image
docker build -t azure-pipelines-agents-debian-12.7:27112024 .
or on Ubuntu image.
docker build -t azure-pipelines-agents-ubuntu-24.04:27112024 .
Also create Playwright image
docker build -t azure-pipelines-agents-playwright-1.x:1.49.0.27112024 .
Create Azure DevOps personal access token (PAT token). For the scope select: Agent Pools (read, manage), Deployment group (read, manage).
Run Debian or Ubuntu based Azure Pipelines agent by using the following command:
docker run --rm -v /var/run/docker.sock:/var/run/docker.sock \
-e AZP_URL=https://dev.azure.com/orleans-on-ctap1 \
-e AZP_TOKEN=<PAT token> -e AZP_AGENT_NAME=01_debian-12.7 \
-e AZP_POOL=Default -e AZP_WORK=_work --name 01_debian-12.7 azure-pipelines-agents-debian-12.7:27112024
The syntax above uses Bash. If you use PowerShell shell, just replace "\" (backslash) with "`" (backtick).
Warning! Doing Docker within a Docker by using Docker socket has serious security implications. The code inside the container can now run as root on your Docker host. Please be very careful.
Use your existing Microsoft Azure Subscription, you can create a free account if you don't have any.
By using Azure CLI create a service principal and configure its access to Azure resources. To retrieve current subscription ID, run:
az account show --query id --output tsv
Configure its access to Azure subscription:
az ad sp create-for-rbac --name Orleans-On-Ctap1 --role Owner --scopes /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
Cretae a new Azure Resource Manager service connection with an existing service principal (orleans-on-ctap1), required name: DefaultAzureServiceConnection. Choose Verify connection to validate the settings you entered Install GitTools for the current Azure DevOps Organization. Install Azure Load Testing for the current Azure DevOps Organization. Disable shallow fetch for the Azure Pipeline. It's required for GitTools.
Run the Azure Pipeline, wait till it completely deploy the solution and enjoy it.