Orleans: Shopping Cart App sample

A canonical shopping cart sample application, built using Microsoft Orleans. This app shows the following features:

  • Shopping cart: A simple shopping cart application that uses Orleans 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.

Shopping Cart sample app running.

Features

The app is architected as follows:

Shopping Cart sample app architecture.

Get Started

Prerequisites

Quickstart

  1. git clone https://github.com/Azure-Samples/Orleans-Cluster-on-Azure-App-Service.git orleans-on-app-service
  2. cd orleans-on-app-service
  3. dotnet run --project Silo\Orleans.ShoppingCart.Silo.csproj

Deploying to Azure

Before deploying to Azure, make sure you complete the following steps:

  1. Create an Azure Cosmos DB for NoSQL account.
    1. Create a database named Orleans.
    2. Within the Orleans database, create a container named OrleansStorage with a partition key path of /PartitionKey.
    3. Create another container named OrleansCluster within the Orleans database. Ensure this container has a partition key path of /ClusterId.
    4. Get the connection string.
  2. Create an Azure Container App as the target of your deployment.
    1. Ensure that the target ingress port is 8080. For more information, see default ASP.NET Core port changed to 8080.
    2. Create a secret in the Container App for the Azure Cosmos DB for NoSQL account's connection string.
    3. Create an environment variable in the Container App's container named ORLEANS_AZURE_COSMOS_DB_CONNECTION_STRING. Reference the secret you just created.
  3. Deploy the application to the Azure Container App service. For more information, see Azure Container Apps deployment options.

Build docker image locally

  1. Install Docker Desktop from Docker Hub
  2. Run docker build -t orleans-shopping-cart -f Silo/Dockerfile . to build the docker image locally

Acknowledgements

The Orleans.ShoppingCart.Silo project uses the following open3rd party-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 IEvangelist/orleans-shopping-cart.

Resources