Install Dapr (Distributed Application Runtime)

Dapr (Distributed Application Runtime) is a set of integrated APIs for communication, state, and workflow implemented using best practices for security, resiliency, and observability, helping us easily build flexible, stateless, and stateful microservices applications, supporting many different languages. In this tutorial, I will guide you on installing Dapr with Dapr’s CLI tool so you can easily work with it!

Install Dapr CLI

Dapr provides us with a script to easily install its CLI at https://raw.githubusercontent.com/dapr/cli/master/install/install.sh. To install, you just need to run the curl command with the following syntax:

By default, Dapr CLI will be installed at /usr/local/bin, you can change this default directory by declaring the environment variable DAPR_INSTALL_DIR pointing to the directory where you want it to be installed!

My example is as follows:

Now, run the curl command above, you will see the same result as me, as follows:

To be able to run Dapr CLI anywhere on your computer, edit the $PATH environment variable of the operating system you are using to add the path to the Dapr installation file!

I am using macOS, so I will open the .bash_profile file in the user directory and add the path to the Dapr installation file to the $PATH environment variable as follows:

Now check the version of Dapr that we just installed, you will see the following result:

So we have successfully installed Dapr CLI! The Runtime version value is n/a because we have not installed Dapr.

Install Dapr

After installing the CLI tool, run the following command:

to install Dapr’s available services for the development environment. In the production environment, Dapr will run as a sidecar with the service!

The result when I run the above command on my machine is as follows:

As you can see, Dapr has up and running containers like:

  • dapr_placement: for local actor
  • dapr_redis: for local state store and message broker
  • dapr_zipkin: for observability
  • and dapr_scheduler: for job scheduling.

Now run the command to check the version, you will see the Runtime version has a value, like mine as follows:

Add Comment