How-To: Run Dapr in self-hosted mode without Docker

How to deploy and run Dapr in self-hosted mode without Docker installed on the local machine

This article provides guidance on running Dapr in self-hosted mode without Docker.

Prerequisites

Initialize Dapr without containers

The Dapr CLI provides an option to initialize Dapr using slim init, without the default creation of a development environment which has a dependency on Docker. To initialize Dapr with slim init, after installing the Dapr CLI use the following command:

dapr init --slim

In this mode two different binaries are installed daprd and placement. The placement binary is needed to enable actors in a Dapr self-hosted installation.

In this mode no default components such as Redis are installed for state management or pub/sub. This means, that aside from Service Invocation, no other building block functionality is available on install out of the box. Users are free to setup their own environment and custom components. Furthermore, actor based service invocation is possible if a state store is configured as explained in the following sections.

Service invocation

See this sample for an example on how to perform service invocation in this mode.

Enabling state management or pub/sub

See configuring Redis in self hosted mode without docker to enable a local state store or pub/sub broker for messaging.

Enabling actors

The placement service must be run locally to enable actor placement. Also a transactional state store must be enabled for actors.

By default for Linux/MacOS the placement binary is installed in /$HOME/.dapr/bin or for Windows at %USERPROFILE%\.dapr\bin.

$ $HOME/.dapr/bin/placement

INFO[0000] starting Dapr Placement Service -- version 0.8.0 -- commit 74db927  instance=host.localhost.name scope=dapr.placement type=log ver=0.8.0
INFO[0000] log level set to: info                        instance=host.localhost.name scope=dapr.placement type=log ver=0.8.0
INFO[0000] metrics server started on :9090/              instance=host.localhost.name scope=dapr.metrics type=log ver=0.8.0
INFO[0000] placement Service started on port 50005       instance=host.localhost.name scope=dapr.placement type=log ver=0.8.0
INFO[0000] Healthz server is listening on :8080          instance=host.localhost.name scope=dapr.placement type=log ver=0.8.0

From here on you can follow the sample example created for the java-sdk, python-sdk or dotnet-sdk for running an application with Actors enabled.

Update the state store configuration files to have the Redis host and password match the setup that you have. Additionally to enable it as a actor state store have the metadata piece added similar to the sample Java Redis component definition.

  - name: actorStateStore
    value: "true"

The logs of the placement service are updated whenever a host that uses actors is added or removed similar to the following output:

INFO[0446] host added: 192.168.1.6                       instance=host.localhost.name scope=dapr.placement type=log ver=0.8.0
INFO[0450] host removed: 192.168.1.6                     instance=host.localhost.name scope=dapr.placement type=log ver=0.8.0

Cleanup

Follow the uninstall instructions to remove the binaries.