The root folder of the repository contains Docker Compose files to run the solution locally. The docker-compose.yml
file contains the definition of all the images needed to run eShopOnDapr. The docker-compose.override.yml
file contains the base configuration for all images of the previous file.
To start eShopOnDapr from the CLI, run the following command from the root folder:
docker-compose up
First Docker pulls the images. This can take some time to complete. Once the images are available, Docker will start the containers. You should now see the application logs in the terminal:
Use Visual Studio to get the best F5 debugging experience. To start, open the eShopOnDapr.sln
solution file in Visual Studio. Below you can see the full eShopOnDapr.sln
solution opened in Visual Studio:
The solution contains a Docker Compose project. Make sure it's set as the default startup project. Right-click on the docker-compose
node in the Project Explorer, and select the Set as StartUp Project menu option:
Now you can build and run the application by pressing Ctrl+F5 or start debugging by pressing F5. You can also press the Debug button in the toolbar:
To run eShopOnDapr from Visual Studio Code it's best to install the C# and Docker extensions.
Open the root folder in Visual Studio Code:
Open the command palette (Ctrl+Shift+P/Command+Shift+P) and select the Docker: Compose Up command:
Visual Studio Code will run docker compose to build and start the containers.
Do not select Compose Up from the context menu of the
docker-compose.yml
file in the explorer. This will not work because Visual Studio Code does not include the associateddocker-compose.override.yml
file in the compose operation.
Visual Studio Code supports attaching to containers for debugging. Once the application has started, go to the Run tab and click on the Start Debugging button with the Docker .NET Core Attach (Preview) profile selected:
Visual Studio Code will ask you to select a container group. Choose eshopondapr.
Next, you can select the container you want to attach to. Select one of the .NET microservice containers.
Finally, Visual Studio Code will ask you if you want to copy the .NET Core debugger to the container. Select Yes.
The debugger is now attached to your container and you can set breakpoints in the code of the selected .NET microservice.
You can run eShopOnDapr on a local Kubernetes cluster by leveraging the support for Kubernetes in Docker for Desktop.
-
Install the NGINX ingress controller:
kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/controller-v1.1.3/deploy/static/provider/cloud/deploy.yaml
-
Deploy Dapr to the cluster (see the Install Dapr into a Kubernetes cluster how-to for details.):
dapr init -k
-
eShopOnDapr includes a Helm chart for easy deployment to a Kubernetes cluster. Run the following command from the
deploy\k8s\helm
folder:helm install --set hostName=kubernetes.docker.internal myeshop .
After a little while, you should be able to access the eShopOnDapr health UI at http://kubernetes.docker.internal/status.
When all microservices are healthy, you can navigate to http://kubernetes.docker.internal to view the eShopOnDapr UI.
To remove eShopOnDapr from Kubernetes, uninstall the Helm chart:
helm uninstall myeshop
You can run eShopOnDapr on any external Kubernetes cluster, such as Azure Kubernetes Service or Amazon EKS. The following steps describe deploying eShopOnDapr to an AKS cluster:
-
Create a new resource group:
az group create --name eShopOnDaprAKS --location westeurope
-
Create the AKS cluster:
az aks create --resource-group eShopOnDaprAKS --name eshopAKSCluster
-
Configure
kubectl
to connect to the new cluster:az aks get-credentials --resource-group eShopOnDaprAKS --name eshopAKSCluster
-
Install the NGINX ingress controller:
kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/controller-v1.1.3/deploy/static/provider/cloud/deploy.yaml
-
Deploy Dapr to the cluster (see the Install Dapr into a Kubernetes cluster how-to for details.):
dapr init -k
-
Get the IP address of the cluster load balancer's public endpoint:
kubectl get services ingress-nginx-controller -n ingress-nginx -o=jsonpath='{.status.loadBalancer.ingress[0].ip}'
-
Configuring DNS is outside the scope of these instructions. Instead of using a 'real' hostname, we'll configure a local
eshopondapr.internal
DNS alias that you can use to reach the Kubernetes cluster.Windows
On Windows, open the following file:
c:\Windows\System32\Drivers\etc\hosts
Add the alias to the bottom of the file and save it. Use the IP address obtained in step 6, for example:
20.73.115.88 eshopondapr.internal
macOS
On macOS, open the following file:
/private/etc/hosts
Add the alias to the bottom of the file and save it. Use the IP address obtained in step 6, for example:
20.73.115.88 eshopondapr.internal
After saving your changes, you may need to run
dscacheutil -flushcache
to force your changes to have effect. -
eShopOnDapr includes a Helm chart for easy deployment to a Kubernetes cluster. Run the following command from the
deploy\k8s\helm
folder:helm install --set hostName=eshopondapr.internal myeshop .
After a little while, you should be able to access the eShopOnDapr health UI at http://eshopondapr.internal/status.
When all microservices are healthy, you can navigate to http://eshopondapr.internal to view the eShopOnDapr UI.
To remove eShopOnDapr from Kubernetes, uninstall the Helm chart:
helm uninstall myeshop
eShopOnDapr includes Bicep files for easy deployment to Azure Container Apps. Run the following commands from the deploy\containerapps
folder to start install using the Azure CLI:
az group create --name eShopOnContainerApps --location eastus
az deployment group create --resource-group eShopOnContainerApps --template-file main.bicep
Use the following commands to get the URLs to the eShopOnDapr health UI and start pages respectively (requires CLI 2.37.0 or higher):
az containerapp show --name webstatus --resource-group eShopOnContainerApps --query "properties.configuration.ingress.fqdn" --output tsv
az containerapp show --name blazor-client --resource-group eShopOnContainerApps --query "properties.configuration.ingress.fqdn" --output tsv