docs/daprdocs/content/en/getting-started/install-dapr-selfhost.md

4.3 KiB

type title linkTitle weight description aliases
docs How-To: Install Dapr into your local environment Init Dapr locally 20 Install Dapr in your local environment for testing and self-hosting
/getting-started/install-dapr/

Prerequisites

  • Install [Dapr CLI]({{< ref install-dapr-cli.md >}})
  • Install Docker Desktop
    • Windows users ensure that Docker Desktop For Windows uses Linux containers.
    • (alternately) Install Dapr without Docker using [Dapr slim init]({{< ref self-hosted-no-docker.md >}})

Initialize Dapr using the CLI

This step installs the latest Dapr Docker containers and setup a developer environment to help you get started easily with Dapr.

  • In Linux/MacOS Dapr is initialized with default components and files in $HOME/.dapr.
  • For Windows Dapr is initialized to %USERPROFILE%\.dapr\

{{% alert title="Note" color="warning" %}} This command downloads and installs Dapr runtime v1.0-rc.2. To install v0.11, the latest release prior to the release candidates for the upcoming v1.0 release, please visit the v0.11 docs. {{% /alert %}}

  1. Ensure you are in an elevated terminal:

    {{< tabs "Linux/MacOS" "Windows">}}

    {{% codetab %}} If you run your docker commands with sudo or the install path is /usr/local/bin(default install path), you need to use sudo {{% /codetab %}}

    {{% codetab %}} Make sure that you run the command prompt terminal in administrator mode (right click, run as administrator) {{% /codetab %}}

    {{< /tabs >}}

  2. Run dapr init --runtime-version 1.0.0-rc.2:

    You can install or upgrade to a specific version of the Dapr runtime using dapr init --runtime-version. You can find the list of versions in Dapr Release

    $ dapr init --runtime-version 1.0.0-rc.2
    ⌛  Making the jump to hyperspace...
    Downloading binaries and setting up components
    ✅  Success! Dapr is up and running. To get started, go here: https://aka.ms/dapr-getting-started
    
  3. Verify Dapr version with dapr --version:

    $ dapr --version
    CLI version: 1.0.0-rc.3
    Runtime version: 1.0.0-rc.2
    
  4. Verify Dapr containers are running with docker ps:

    Make sure the daprio/dapr, openzipkin/zipkin, and redis container images are all running:

    $ docker ps
    CONTAINER ID   IMAGE                    COMMAND                  CREATED         STATUS         PORTS                              NAMES
    0dda6684dc2e   openzipkin/zipkin        "/busybox/sh run.sh"     2 minutes ago   Up 2 minutes   9410/tcp, 0.0.0.0:9411->9411/tcp   dapr_zipkin
    9bf6ef339f50   redis                    "docker-entrypoint.s…"   2 minutes ago   Up 2 minutes   0.0.0.0:6379->6379/tcp             dapr_redis
    8d993e514150   daprio/dapr:1.0.0-rc.2   "./placement"            2 minutes ago   Up 2 minutes   0.0.0.0:6050->50005/tcp            dapr_placement
    
  5. Verify Dapr directory has been initialized

    {{< tabs "Linux/MacOS" "Windows">}}

    {{% codetab %}} Run ls $HOME/.dapr:

    $ ls $HOME/.dapr
    bin  components  config.yaml
    

    {{% /codetab %}}

    {{% codetab %}} Open %USERPROFILE%\.dapr\ in file explorer

    Explorer files {{% /codetab %}}

    {{< /tabs >}}

Uninstall Dapr in self-hosted mode

This cli command removes the placement Dapr container:

$ dapr uninstall

{{% alert title="Warning" color="warning" %}} This command won't remove the Redis or Zipkin containers by default, just in case you were using them for other purposes. To remove Redis, Zipkin, Actor Placement container, as well as the default Dapr directory located at $HOME/.dapr or %USERPROFILE%\.dapr\, run:

$ dapr uninstall --all

{{% /alert %}}

{{% alert title="Note" color="primary" %}} For Linux/MacOS users, if you run your docker cmds with sudo or the install path is /usr/local/bin(default install path), you need to use sudo dapr uninstall to remove dapr binaries and/or the containers. {{% /alert %}}

Next steps

  • [Setup a state store and pub/sub message broker]({{< ref configure-state-pubsub.md >}})