A canonical shopping cart sample application, built using Akka.NET. This app shows the following features:
-
Shopping cart: A simple shopping cart application that uses Akka.NET for its cross-platform framework support, and its scalable distributed applications capabilities.
- Inventory management: Edit and/or create product inventory.
- Shop inventory: Explore purchasable products and add them to your cart.
- Cart: View a summary of all the items in your cart, and manage these items; either removing or changing the quantity of each item.
- .NET 6
- Docker
- ASP.NET Core Blazor
- Akka.NET: Akka.Persistence
- Akka.NET: Akka.Management
- Azure Bicep
- Azure Container Apps
The app is architected as follows:
- Have Docker installed
- A GitHub account
- The .NET 6 SDK or later
- The Azure CLI
- A .NET integrated development environment (IDE)
- Feel free to use the Visual Studio IDE or the Visual Studio Code
git clone [email protected]:petabridge/azure-container-app-akkadotnet.git akka-on-container-apps
cd akka-on-container-apps
dotnet run --project src\Akka.ShoppingCart\Akka.ShoppingCart.csproj
Before deploying the app, you need to create an Azure Resource Group (or you could choose to use an existing one). To create a new Azure Resource Group, use one of the following articles:
In this tutorial, we will be using Azure CLI and Azure Bicep to create all of the resources needed by the example project and to deploy the Docker container into Azure Container Apps.
We will use PowerShell, Azure CLI, and the provided .bicep files to automate our Azure resource creation. A convenience PowerShell script deploy.ps1 is available to deploy the whole stack in one go.
The deploy.ps1 file will:
- Prompt you for a unique name for your Azure Container Apps
- Prompt you for the Azure Resource Group to deploy to
- Prompt you for the location to deploy the resources
- Launch
az login
for you to log in to your Azure account - Flex the acr.bicep file to deploy an Azure Container registry
- Login Docker to Azure Container Registry
- Builds a Docker image for the sample project
- Push the Docker image to Azure Container registry
- Flex the main.bicep file to provision:
- Azure Storage account
- Azure Application Insight
- Azure Log Analytics workspace
- Azure Container Apps Environment
- Azure Container App
The Bicep files used in this example is nearly identical to the one used in the Orleans example.
To read more about the Bicep files and how they are used in resource provisioning, please read the documentation.
The Akka.ShoppingCart project uses the following 3rd party open-source projects:
- MudBlazor: Blazor Component Library based on Material design.
- Bogus: A simple fake data generator for C#, F#, and VB.NET.
- Blazorators: Source-generated packages for Blazor JavaScript interop.
Derived from: