Getting Up and Running with Dapr

I’ve heard about Dapr a few times from developer friends, but hadn’t really understood it that well. I had a webinar coming up, so I decided to spend a bit of time working with it to understand how it might function with an application.

I went to, and saw the basic outline of Dapr is in this video from their site. I also found this getting started video from Donovan Brown.

What I gathered from this research is that Dapr is really a set of containers that run alongside your app or act as middleware between different components, including state stores. Most of us might think of a state store as a database.

As a part of my learning, I went through some of the getting started tutorials.

The Tutorial

I followed the getting started tutorial. The first thing was to open a cmd prompt with administrative privileges and run this:

powershell -Command "iwr -useb | iex"

Next, I needed to update. I ran the “dapr inti” in an elevated cmd line. I love the first part of this:

2021-09-13 15_58_38-cmd - dapr  init (Admin)

I already have Docker installed, with Linux containers, so I can quickly continue.

I need to start an app so that dapr can run as a sidecar. I don’t have an app configured, but I can run this as a blank one, according to the docs:

dapr run --app-id myapp --dapr-http-port 3500

The next step is to test this. I am supposed to use curl to post an http request with this command:

curl -X POST -H "Content-Type: application/json" -d '[{ "key": "name", "value": "Bruce Wayne"}]' http://localhost:3500/v1.0/state/statestore

When I do that, I get an error. Apparently, this doesn’t work in Windows, and really, it’s a bash request. Since I’m using the Windows CMD Prompt, I’m unable to read the instructions.

2021-09-13 16_12_30-Use the Dapr API _ Dapr Docs

I need to click the PowerShell option and get the Invoke-RestMethod cmd. When I do that, I see that the state is working.

2021-09-13 16_13_16-C__Users_Steve

I can also test this with an interactive connection to Redis. Again, in the tutorial, this lets me get to the data store.

2021-09-13 16_14_40-cmd - docker  exec -it dapr_redis redis-cli

That was most of the tutorial. I worked with the config file, and then looked at the Hello, World tutorial. Overall, this was pretty simple and worked well for me.

My Thoughts

There is a lot of stuff going on here. The concept of a sidecar, is really a container that gets a network call from your app to do something. Then the sidecar does something else. It’s like middleware, or an app server in the older client/server or 3 tier architecture, but without the tight coupling and dependency. More importantly, this allows dapr to scale out and run as a separate process rather than being part of a monolithic entity.

More work, but also more consistency and this gest you used to building an API rather than having developers inconsistently connecting things together.

The goal here is really to think about microservices.  I don’t know if I think that’s the best way to build thing, but it is a trend, I like the cloud native focus, and it’s helpful to understand something about this when talking with developers about pros and cons.

By the way, after my webinar with Donovan Brown and Mark Fussell, I learned this doesn’t require microservices or containers. It can run in many different software models, but abstracts away a lot of the SDK and API struggled with different technologies.

About way0utwest

Editor, SQLServerCentral
This entry was posted in Blog and tagged , . Bookmark the permalink.

1 Response to Getting Up and Running with Dapr

  1. Pingback: An Intro to Dapr – Curated SQL

Comments are closed.