From the course: Complete Guide to Dapr for .NET and Azure Developers: Building and Managing Microservices

Installing and initializing Dapr

- [Instructor] There are different ways to install Dapr. In this video, I'll show you the easiest one, which is open up the dapr.io website and then click on the Get Started button. Then in this getting started webpage, you can find the installed the Dapr CLI button, and you're going to navigate to this install the Dapr CLI webpage. And here you can find the different operating systems where you can install Dapr in. In this case, I'm going to use Windows, and there are two different scripts that we can copy. In this case, I'm going to copy the first one, which requires elevated permissions. Otherwise, if you don't have the elevated permissions on your machine, you can use this other one. Okay, so let's copy this one, and let's open up the Windows terminal. Here in the Windows terminal, I'm going to paste the script. And as you can see, the Windows terminal is asking me for this, so I'm going to click on the Paste anyway button. And now the installation begins. And as you can see, this is a very fast process. You can verify if you have Dapr installed, if you just type dapr on the Windows terminal. And this is the CLI that we are going to use in this course. So it looks like Dapr was installed correctly. If you are wondering what's happening in this installation, you can go to the dapr folder, and you'll find the dapr.exe file, which is the CLI that we're going to use. Of course, you don't have to navigate to the dapr folder to use the Dapr CLI. Actually, it was included in the path environment variable, so you can use Dapr in any folder. Okay, so now we're going to initialize Dapr. You can do that by running the dapr init command. And this is going to download all the Docker images in your Docker for Windows installation. As you can see, this is very fast as well, and if I type docker ps, you can see that now those Docker containers are running. These containers are Zipkin, which is used by the observability building block. Dapr placement if you happen to use the actor's building Block. And finally, Redis, which is used by my standalone Dapr installation as a message broker for the pops up building block and as a storage mechanism for the state management building block. Okay, so now I can show you my home folder, and then this .dapr folder, which was created by the initialization. And here you can find the different components that Dapr has configured by default. So if I go to the components folder, you can find those YAML files. And for instance, if I showed you the content of pubsub.yaml, you can see that this is using my Redis Docker container that is running on my local Docker instance. And also let's see the content of statestore. As you can see, this is using Redis as well. So those two components are the way that we use concrete implementations for our building blocks when using Dapr. Okay, so let's go back to the previous folder. And here we can find this other file, which is named config.yaml. And we can see the contents as well. Let's type cat .\config.yaml. And in this case, this config.yaml is configuring the observability building block in terms of where it's going to send the telemetry data to. In this case, it's using Zipkin as the target, which is the Docker container that we've seen before. Okay, as demonstrated, installing and initializing Dapr is a straightforward process. Now join me in the next video where we'll see some of the most typical commands that we use with the Dapr CLI.

Contents