The coffeeshop event-driven application is developed in C# and runs on Dapr (AKS)
MIT License
The .NET coffeeshop application runs on Dapr
> dapr init
> docker compose up
Finally, you can play around using client.http to explore the application!
Make sure no
redis
,zipkin
instances running
Ensure you have access to an Azure subscription and the Azure CLI installed
az login
az account set --subscription "My Subscription"
Clone this repository
git clone https://github.com/thangchung/coffeeshop-on-dapr.git
cd coffeeshop-on-dapr
Install KEDA extension
az feature register --namespace "Microsoft.ContainerService" --name "AKS-KedaPreview"
Deploy the infrastructure
az deployment sub create --location eastus --template-file ./iac/bicep/main.bicep
Install Dapr extension
az k8s-extension create --cluster-type managedClusters --cluster-name coffeeshop --resource-group azure_oss_rg --name dapr --extension-type Microsoft.Dapr
Log into Azure Container Registry You can get your registry name from your resource group in the Azure Portal
# enable admin login on Azure Portal
docker login <registry_server_uri> -u <admin username> -p <password>
For example: <registry_server_uri> looks like
coffeeshopf2syic6ephtxk.azurecr.io
Build and push containers
Create an .env file at root project folder with content
DOCKER_REGISTRY=<registry_server_uri>
Then run docker-compose CLI as
docker compose build
docker push <registry_server_uri>/product-service:latest
docker push <registry_server_uri>/counter-service:latest
docker push <registry_server_uri>/barista-service:latest
docker push <registry_server_uri>/kitchen-service:latest
docker push <registry_server_uri>/reverse-proxy:latest
Get AKS credentials
az aks get-credentials --resource-group az_oss_rg --name coffeeshop
Make sure when you go to Azure Portal, you should see keda
and dapr
components as the picture below
Create dapr component on AKS
kubectl apply -f iac/dapr/azure/orderup_pubsub.yaml
kubectl apply -f iac/dapr/azure/barista_pubsub.yaml
kubectl apply -f iac/dapr/azure/kitchen_pubsub.yaml
Deploy the application
az deployment group create --resource-group az_oss_rg --template-file ./iac/bicep/app.bicep
Get your frontend URL
kubectl get ingress
For example,
NAME | CLASS | HOSTS | ADDRESS | PORTS | AGE |
---|---|---|---|---|---|
reverseproxy | app.5cde744b1d1242ffbc32.eastus.aksapp.io | 20.241.232.155 | 80 | 13m |
Navigate to client.http, and change @host
to what you can see on previous command, for example: app.5cde744b1d1242ffbc32.eastus.aksapp.io
, then play with REST APIs there. Enjoy!
az group delete -n az_oss_rg