This repo contains the solution shown during the ACA vs AKS PlatformCon session.
- Azure subscription with owner rights
- VS Code or Visual Studio
- Azure CLI with Bicep
- REST Client or Postman VS code plugin or similar
- Clone this repo
- Build and run a C# console program
These are the Azure services that main.bicep will create.
This section contains a step-by-step guide to setup and test the demos that was shown during the session.
Choose a postfix for the resource group name, five characters. e.g. "duxcf" Replace [postfix] with your postfix in the following code, run the command.
az group create --name rg-[postfix] --location swedencentrals
Make sure the correct subscription is used by running.
az account show
If the correct subscription is not shown run
az account set -s [subscription name]
Deploy the infrastructure using the following command. This will deploy the infrastructure but not the container apps.
az deployment group create -g rg-[postfix] -n mainDeploy -f infrastructure/main.bicep
This creates the Azure services to be used. Wait until the Azure services are deployed, open the Azure portal in a browser and copy the name of the Azure Container Registry, replace [acr] with this name in the next step.
Use Azure Container Registry task to build the image and push it. Run the command, make sure the sourcecode is not opened in VS.
az acr build -t platformcon/acaapi:1.0 -r [acr] AcaApi/.
Run the command with the deploy=true parameter.
az deployment group create -g rg-[postfix] -n mainDeploy -f infrastructure/main.bicep -p deploy=true
Replace the values in brackets in LoadConsole/appsettings.json.
Grab the unique string (5 characters) that has been created for all the azure services. e.g ns-abc12, then "abc12" is the unique string
Grab the primary connection string for the servicebus.
az servicebus namespace authorization-rule keys list -g rg-[postfix] --namespace-name ns-[unique string] --name RootManageSharedAccessKey --query primaryConnectionString -o tsv
Grab the primary url address for the container app.
az containerapp show -g rg-[postfix] --name superman --query properties.configuration.ingress.fqdn -o tsv
The LoadConsole application is a .NET console application that can be run in a terminal. The application can be run in two ways, with the .NET CLI or with Docker.
The app takes 3 arguments
Type: http or queue | http endpoint or servicebus
Requests: int | number of requests for every thread
Threads: int | number of threads to run
if you run the app with the http type, the messages is sent to the url address for the container app.
if you run the app with the queue type, the messages is sent to servicebus.
Example "dotnet run --project ./LoadConsole/LoadConsole.csproj -- http 10 5" runs 10 requests on 5 threads to the http endpoint
Http
dotnet run --project ./LoadConsole/LoadConsole.csproj http 10 5
Servicebus
dotnet run --project ./LoadConsole/LoadConsole.csproj queue 10 5
Build the LoadConsole application docker container, run the command.
docker build -t loadconsole LoadConsole/.
Run the LoadConsole container with the following command.
Http
docker run -t loadconsole http 10 5
Servicebus
docker run -t loadconsole queue 10 5
Http
az containerapp logs show --name superman --resource-group rg-[postfix] --type console --follow
Servicebus
az containerapp logs show --name catwomen --resource-group rg-[postfix] --type console --follow