Skip to content

Latest commit

 

History

History
175 lines (116 loc) · 4.68 KB

README.md

File metadata and controls

175 lines (116 loc) · 4.68 KB

Drug Store

Security Rating Quality Gate Status

Description

A sample e-commerce application that enables users to buy and oversee pharmaceuticals and other health-related items. The application will be constructed with a clean architecture and domain-driven design, utilizing .NET 8.0, and runs on Azure AKS 🛞.

Drug Store

Prerequisites

Note

If you want to deploy the application to Azure, you need to install the Azure CLI and have an Azure Subscription.

Make sure to have the license for the Duende IdentityServer.

Installation

Local setup

  1. Clone the repository
git clone https://github.com/foxminchan/DrugStore
  1. Restore the packages and install the dependencies
cd DrugStore
dotnet restore ./DrugStore.sln
dotnet tool restore
pnpm install
  1. Set up infrastructure
docker-compose -f ./docker-compose.yml -f ./docker-compose.o11y.yaml up -d

Usage

Running the application

From the root directory, run the following command:

tye run

Warning

Ensure that the Docker Desktop is running.

Testing the application

For load testing, run the following command:

k6 run ./k6/performance.js

For unit testing, run the following command:

dotnet test ./DrugStore.sln

For test the tests, run the following command:

dotnet stryker

Important

To use SpecFlow for BDD testing, make sure to install the SpecFlow extension in Visual Studio. You can install the extension from the Visual Studio Marketplace. After installing the extension, you can run the tests using the Test Explorer. The tests are located in the Backoffice.EndToEnd and Storefront.EndToEnd projects.

Observability

LGTM

Overview

The application is instrumented with OpenTelemetry and uses LGTM as the observability platform. LGTM is a lightweight, open-source observability platform that enables you to monitor and troubleshoot applications. It provides a dashboard that displays traces, metrics, and logs. The dashboard is accessible at http://localhost:3000. The default credentials are admin for both the username and password.

Viewing the dashboard

  1. Open the LGTM dashboard
open http://localhost:3000
  1. Login with the following credentials:
Username: admin
Password: admin
  1. View the traces, metrics, and logs

Dashboard

Deployment

To deploy the application to Azure, follow the steps below:

  1. Login and select the subscription
az login
az account set --subscription "subscription_id"
  1. Deploy the infrastructure
az deployment sub create --location eastus --template-file ./azure/main.bicep
  1. Login to the Azure Container Registry
export PASSWORD=YOUR_PASSWORD
echo $PASSWORD | docker login "acr_name".azurecr.io -u "username" --password-stdin
  1. Build and push the images to the Azure Container Registry
docker compose build
docker compose push "acr_name".azurecr.io/drug-store-api:latest
docker compose push "acr_name".azurecr.io/drug-store-storefront:latest
docker compose push "acr_name".azurecr.io/drug-store-backoffice:latest
docker compose push "acr_name".azurecr.io/drug-store-identityserver:latest
  1. Get the Azure Kubernetes Service credentials
az aks get-credentials --resource-group "resource_group" --name "aks_name"
  1. Deploy the application to the Azure Kubernetes Service
az deployment group create --resource-group "resource_group" --template-file ./azure/app.bicep
  1. Open the application
kubectl get ingress

License

This project is licensed under the MIT License - see the LICENSE file for details.