mirror of https://github.com/dapr/docs.git
Merge pull request #1055 from orizohar/getting-started-tutorial
Getting started tutorial
This commit is contained in:
commit
aa6b830732
|
@ -22,7 +22,7 @@ For the purpose of this how to we'll use a Redis state store, but any state stor
|
|||
{{< tabs "Self-Hosted (CLI)" Kubernetes>}}
|
||||
|
||||
{{% codetab %}}
|
||||
When using `Dapr init` in Standalone mode, the Dapr CLI automatically provisions a state store (Redis) and creates the relevant YAML in a `components` directory, which for Linux/MacOS is `$HOME/.dapr/components` and for Windows is `%USERPROFILE%\.dapr\components`
|
||||
When using `dapr init` in Standalone mode, the Dapr CLI automatically provisions a state store (Redis) and creates the relevant YAML in a `components` directory, which for Linux/MacOS is `$HOME/.dapr/components` and for Windows is `%USERPROFILE%\.dapr\components`
|
||||
|
||||
To change the state store being used, replace the YAML under `/components` with the file of your choice.
|
||||
{{% /codetab %}}
|
||||
|
|
|
@ -3,7 +3,24 @@ type: docs
|
|||
title: "Getting started with Dapr"
|
||||
linkTitle: "Getting started"
|
||||
weight: 20
|
||||
description: "Get up and running with Dapr"
|
||||
type: docs
|
||||
description: "How to get up and running with Dapr in minutes"
|
||||
no_list: true
|
||||
---
|
||||
|
||||
Welcome to the Dapr getting started guide!
|
||||
|
||||
{{% alert title="Dapr Concepts" color="primary" %}}
|
||||
If you are looking for an introductory overview of Dapr and learn more about basic Dapr terminology, it is recommended to visit the [concepts section]({{<ref concepts>}}).
|
||||
{{% /alert %}}
|
||||
|
||||
This guide will walk you through a series of steps to install, initialize and start using Dapr. The recommended way to get started with Dapr is to setup a local development environment (also referred to as [_self-hosted_ mode]({{< ref self-hosted >}})) which includes the Dapr CLI, Dapr sidecar binaries, and some default components that can help you start using Dapr quickly.
|
||||
|
||||
The following steps in this guide are:
|
||||
1. Install the Dapr CLI
|
||||
1. Initialize Dapr
|
||||
1. Use the Dapr API
|
||||
1. Configure a component
|
||||
1. Explore Dapr quickstarts
|
||||
|
||||
<a class="btn btn-primary" href="{{< ref install-dapr-cli.md >}}" role="button">First step: Install the Dapr CLI >></a>
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
---
|
||||
type: docs
|
||||
title: "How-To: Configure state store and pub/sub message broker"
|
||||
linkTitle: "Configure state & pub/sub"
|
||||
weight: 40
|
||||
linkTitle: "(optional) Configure state & pub/sub"
|
||||
weight: 80
|
||||
description: "Configure state store and pub/sub message broker components for Dapr"
|
||||
aliases:
|
||||
- /getting-started/configure-redis/
|
||||
|
@ -228,5 +228,4 @@ kubectl apply -f redis-pubsub.yaml
|
|||
{{< /tabs >}}
|
||||
|
||||
## Next steps
|
||||
- [Setup your development environment]({{< ref dev-environment.md >}})
|
||||
- [Try out a Dapr quickstart]({{< ref quickstarts.md >}})
|
|
@ -1,26 +0,0 @@
|
|||
---
|
||||
type: docs
|
||||
title: "How-To: Setup a Dapr dev environment"
|
||||
linkTitle: "Setup Dev environment"
|
||||
weight: 50
|
||||
description: "How to get up and running with Dapr SDKs, extensions, and tooling"
|
||||
---
|
||||
|
||||
As you get up and running with Dapr there are a variety of SDKs and tools to make things easier for you. Check out the below the options to get up and running in your preferred tools.
|
||||
|
||||
## Dapr SDKs
|
||||
|
||||
Dapr offers a variety of SDKs for developing with Dapr in your preferred language.
|
||||
|
||||
Visit the [Dapr SDK docs]({{< ref sdks>}}) for more information and to get started in your preferred language.
|
||||
|
||||
## IDE integrations
|
||||
|
||||
For information on the available extensions and integrations with IDEs such as [VS Code]({{< ref vscode.md >}}) and [IntelliJ]({{< ref intellij.md >}}) visit the [Dapr IDE integrations docs]({{< ref ides >}}).
|
||||
|
||||
## Dapr Dashboard
|
||||
|
||||
For easy access to key information about your Dapr applications and components, make sure to run `dapr dashboard` to launch the [dashboard app](https://github.com/dapr/dashboard).
|
||||
|
||||
## Next steps
|
||||
- [Try out a Dapr quickstart]({{< ref quickstarts.md >}})
|
|
@ -0,0 +1,104 @@
|
|||
---
|
||||
type: docs
|
||||
title: "Use the Dapr API"
|
||||
linkTitle: "Use the Dapr API"
|
||||
weight: 30
|
||||
---
|
||||
|
||||
After running the `dapr init` command in the [previous step]({{<ref install-dapr-selfhost.md>}}), your local environment has the Dapr sidecar binaries as well as default component definitions for both state management and a message broker (both using Redis). You can now try out some of what Dapr has to offer by using the Dapr CLI to run a Dapr sidecar and try out the state API that will allow you to store and retrieve a state. You can learn more about the state building block and how it works in [these docs]({{< ref state-management >}}).
|
||||
|
||||
You will now run the sidecar and call the API directly (simulating what an application would do).
|
||||
|
||||
## Step 1: Run the Dapr sidecar
|
||||
|
||||
One the most useful Dapr CLI commands is [`dapr run`]({{< ref dapr-run.md >}}). This command launches an application together with a sidecar. For the purpose of this tutorial you'll run the sidecar without an application.
|
||||
|
||||
Run the following command to launch a Dapr sidecar that will listen on port 3500 for a blank application named myapp:
|
||||
|
||||
```bash
|
||||
dapr run --app-id myapp --dapr-http-port 3500
|
||||
```
|
||||
|
||||
With this command, no custom component folder was defined so the Dapr uses the default component definitions that were created during the init flow (these can be found under `$HOME/.dapr/components` on Linux or MacOS and under `%USERPROFILE%\.dapr\components` on Windows). These tell Dapr to the local Redis Docker container as a state store and message broker.
|
||||
|
||||
## Step 2: Save state
|
||||
|
||||
In a separate terminal run:
|
||||
|
||||
{{< tabs "HTTP API (Bash)" "HTTP API (PowerShell)">}}
|
||||
{{% codetab %}}
|
||||
|
||||
```bash
|
||||
curl -X POST -H "Content-Type: application/json" -d '[{ "key": "name", "value": "Bruce Wayne"}]' http://localhost:3500/v1.0/state/statestore
|
||||
```
|
||||
{{% /codetab %}}
|
||||
|
||||
{{% codetab %}}
|
||||
|
||||
```powershell
|
||||
Invoke-RestMethod -Method Post -ContentType 'application/json' -Body '[{ "key": "name", "value": "Bruce Wayne"}]' -Uri 'http://localhost:3500/v1.0/state/statestore'
|
||||
```
|
||||
{{% /codetab %}}
|
||||
|
||||
{{< /tabs >}}
|
||||
|
||||
## Step 2: Get state
|
||||
|
||||
Now get the state you just stored using a key with the state management API:
|
||||
|
||||
{{< tabs "HTTP API (Bash)" "HTTP API (PowerShell)">}}
|
||||
|
||||
{{% codetab %}}
|
||||
With the same Dapr instance running from above run:
|
||||
```bash
|
||||
curl http://localhost:3500/v1.0/state/statestore/name
|
||||
```
|
||||
{{% /codetab %}}
|
||||
|
||||
{{% codetab %}}
|
||||
With the same Dapr instance running from above run:
|
||||
```powershell
|
||||
Invoke-RestMethod -Uri 'http://localhost:3500/v1.0/state/statestore/name'
|
||||
```
|
||||
{{% /codetab %}}
|
||||
|
||||
{{< /tabs >}}
|
||||
|
||||
## Step 3: See how the state is stored in Redis
|
||||
|
||||
You can look in the Redis container and verify Dapr is using it as a state store. Run the following to use the Redis CLI:
|
||||
|
||||
```bash
|
||||
docker exec -it dapr_redis redis-cli
|
||||
```
|
||||
|
||||
List the redis keys to see how Dapr created a key value pair (with the app-id you provided to `dapr run` as a prefix to the key):
|
||||
|
||||
```bash
|
||||
keys *
|
||||
```
|
||||
|
||||
```
|
||||
1) "myapp||name"
|
||||
```
|
||||
|
||||
View the state value by running:
|
||||
|
||||
```bash
|
||||
hgetall "myapp||name"
|
||||
```
|
||||
|
||||
```
|
||||
1) "data"
|
||||
2) "\"Bruce Wayne\""
|
||||
3) "version"
|
||||
4) "1"
|
||||
```
|
||||
|
||||
Exit the redis-cli with:
|
||||
|
||||
```bash
|
||||
exit
|
||||
```
|
||||
|
||||
<a class="btn btn-primary" href="{{< ref get-started-component.md >}}" role="button">Next step: Define a component >></a>
|
|
@ -0,0 +1,93 @@
|
|||
---
|
||||
type: docs
|
||||
title: "Define a component"
|
||||
linkTitle: "Define a component"
|
||||
weight: 40
|
||||
---
|
||||
|
||||
In the [previous step]({{<ref get-started-api.d>}}) you called the Dapr HTTP API to store and retrieve a state from a Redis backed state store. Dapr knew to use the Redis instance that was configured locally on your machine through default component definition files that were created when Dapr was initialized.
|
||||
|
||||
When building an app, you most likely would create your own component file definitions depending on the building block and specific component that you'd like to use.
|
||||
|
||||
As an example of how to define custom components for your application, you will now create a component definition file to interact with the [secrets building block]({{< ref secrets >}}).
|
||||
|
||||
In this guide you will:
|
||||
- Create a local JSON secret store
|
||||
- Register the secret store with Dapr using a component definition file
|
||||
- Obtain the secret using the Dapr HTTP API
|
||||
|
||||
## Step 1: Create a JSON secret store
|
||||
|
||||
While Dapr supports [many types of secret stores]({{< ref supported-secret-stores >}}), the easiest way to get started is a local JSON file with your secret (note this secret store is meant for development purposes and is not recommended for production use cases as it is not secured).
|
||||
|
||||
Begin by saving the following JSON contents into a file named `mysecrets.json`:
|
||||
|
||||
```json
|
||||
{
|
||||
"my-secret" : "I'm Batman"
|
||||
}
|
||||
```
|
||||
|
||||
## Step 2: Create a secret store Dapr component
|
||||
|
||||
Create a new directory named `my-components` to hold the new component file:
|
||||
|
||||
```bash
|
||||
mkdir my-components
|
||||
```
|
||||
|
||||
Inside this directory create a new file `localSecretStore.yaml` with the following contents:
|
||||
|
||||
|
||||
```yaml
|
||||
apiVersion: dapr.io/v1alpha1
|
||||
kind: Component
|
||||
metadata:
|
||||
name: my-secret-store
|
||||
namespace: default
|
||||
spec:
|
||||
type: secretstores.local.file
|
||||
version: v1
|
||||
metadata:
|
||||
- name: secretsFile
|
||||
value: <PATH TO SECRETS FILE>/secrets.json
|
||||
- name: nestedSeparator
|
||||
value: ":"
|
||||
```
|
||||
|
||||
You can see that the above file definition has a `type: secretstores.local.file` which tells Dapr to use the local file component as a secret store. The metadata fields provide component specific information needed to work with this component (in this case, the path to the secret store JSON)
|
||||
|
||||
## Step 3: Run the Dapr sidecar
|
||||
|
||||
Run the following command to launch a Dapr sidecar that will listen on port 3500 for a blank application named myapp:
|
||||
|
||||
```bash
|
||||
dapr run --app-id myapp --dapr-http-port 3500 --components-path ./my-components
|
||||
```
|
||||
|
||||
## Step 4: Get a secret
|
||||
|
||||
In a separate terminal run:
|
||||
|
||||
{{< tabs "HTTP API (Bash)" "HTTP API (PowerShell)">}}
|
||||
{{% codetab %}}
|
||||
|
||||
```bash
|
||||
curl http://localhost:3500/v1.0/secrets/my-secret-store/my-secret
|
||||
```
|
||||
{{% /codetab %}}
|
||||
|
||||
{{% codetab %}}
|
||||
```powershell
|
||||
Invoke-RestMethod -Uri 'http://localhost:3500/v1.0/secrets/my-secret-store/my-secret'
|
||||
```
|
||||
{{% /codetab %}}
|
||||
{{< /tabs >}}
|
||||
|
||||
You should see output with the secret you stored in the JSON file.
|
||||
|
||||
```
|
||||
"I'm Batman"
|
||||
```
|
||||
|
||||
<a class="btn btn-primary" href="{{< ref quickstarts.md >}}" role="button">Next step: Explore Dapr quickstarts >></a>
|
|
@ -1,14 +1,17 @@
|
|||
---
|
||||
type: docs
|
||||
title: "How-To: Install Dapr CLI"
|
||||
title: "Install the Dapr CLI"
|
||||
linkTitle: "Install Dapr CLI"
|
||||
weight: 10
|
||||
description: "Install the Dapr CLI to get started with Dapr"
|
||||
---
|
||||
|
||||
## Dapr CLI installation scripts
|
||||
The Dapr CLI is the main tool you'll be using for various Dapr related tasks. You can use it to run an application with a Dapr sidecar, as well as review sidecar logs, list running services, and run the Dapr dashboard. The Dapr CLI works with both [self-hosted]({{< ref self-hosted >}}) and [Kubernetes]({{< ref Kubernetes >}}) environments.
|
||||
|
||||
Begin by downloading and installing the Dapr CLI for v0.11. This is used to initialize your environment on your desired platform.
|
||||
You can learn more about the CLI and available commands in the [CLI reference docs]( {{< ref cli >}}).
|
||||
|
||||
### Step 1: Run the installation script
|
||||
|
||||
Begin by downloading and installing the latest version of the Dapr CLI:
|
||||
|
||||
{{% alert title="Note" color="warning" %}}
|
||||
This command downloads and install Dapr CLI v0.11. To install the latest preview release, please visit the [v1.0-rc2 version of this page](https://v1-rc2.docs.dapr.io/getting-started/install-dapr-cli/).
|
||||
|
@ -24,11 +27,10 @@ wget -q https://raw.githubusercontent.com/dapr/cli/master/install/install.sh -O
|
|||
{{% /codetab %}}
|
||||
|
||||
{{% codetab %}}
|
||||
This command installs the latest windows Dapr cli to `C:\dapr` and add this directory to User PATH environment variable. Run in Command Prompt:
|
||||
This Command Prompt command installs the latest windows Dapr cli to `C:\dapr` and adds this directory to User PATH environment variable.
|
||||
```powershell
|
||||
powershell -Command "iwr -useb https://raw.githubusercontent.com/dapr/cli/master/install/install.ps1 | iex"
|
||||
```
|
||||
Verify by opening Explorer and entering `C:\dapr` into the address bar. You should see folders for bin, components, and a config file.
|
||||
{{% /codetab %}}
|
||||
|
||||
{{% codetab %}}
|
||||
|
@ -50,13 +52,59 @@ Each release of Dapr CLI includes various OSes and architectures. These binary v
|
|||
2. Unpack it (e.g. dapr_linux_amd64.tar.gz, dapr_windows_amd64.zip)
|
||||
3. Move it to your desired location.
|
||||
- For Linux/MacOS - `/usr/local/bin`
|
||||
- For Windows, create a directory and add this to your System PATH. For example create a directory called `c:\dapr` and add this directory to your path, by editing your system environment variable.
|
||||
- For Windows, create a directory and add this to your System PATH. For example create a directory called `C:\dapr` and add this directory to your User PATH, by editing your system environment variable.
|
||||
{{% /codetab %}}
|
||||
{{< /tabs >}}
|
||||
|
||||
Learn more about the CLI and available commands in the [CLI docs]( {{< ref cli >}}).
|
||||
|
||||
## Next steps
|
||||
- [Init Dapr locally]({{< ref install-dapr-selfhost.md >}})
|
||||
- [Init Dapr on Kubernetes]({{< ref install-dapr-kubernetes.md >}})
|
||||
### Step 2: Verify the installation
|
||||
|
||||
You can verify the CLI is installed by restarting your terminal/command prompt and running the following:
|
||||
|
||||
```bash
|
||||
dapr
|
||||
```
|
||||
|
||||
The output should look like this:
|
||||
|
||||
|
||||
```md
|
||||
|
||||
____/ /___ _____ _____
|
||||
/ __ / __ '/ __ \/ ___/
|
||||
/ /_/ / /_/ / /_/ / /
|
||||
\__,_/\__,_/ .___/_/
|
||||
/_/
|
||||
|
||||
===============================
|
||||
Distributed Application Runtime
|
||||
|
||||
Usage:
|
||||
dapr [command]
|
||||
|
||||
Available Commands:
|
||||
completion Generates shell completion scripts
|
||||
components List all Dapr components. Supported platforms: Kubernetes
|
||||
configurations List all Dapr configurations. Supported platforms: Kubernetes
|
||||
dashboard Start Dapr dashboard. Supported platforms: Kubernetes and self-hosted
|
||||
help Help about any command
|
||||
init Install Dapr on supported hosting platforms. Supported platforms: Kubernetes and self-hosted
|
||||
invoke Invoke a method on a given Dapr application. Supported platforms: Self-hosted
|
||||
list List all Dapr instances. Supported platforms: Kubernetes and self-hosted
|
||||
logs Get Dapr sidecar logs for an application. Supported platforms: Kubernetes
|
||||
mtls Check if mTLS is enabled. Supported platforms: Kubernetes
|
||||
publish Publish a pub-sub event. Supported platforms: Self-hosted
|
||||
run Run Dapr and (optionally) your application side by side. Supported platforms: Self-hosted
|
||||
status Show the health status of Dapr services. Supported platforms: Kubernetes
|
||||
stop Stop Dapr instances and their associated apps. . Supported platforms: Self-hosted
|
||||
uninstall Uninstall Dapr runtime. Supported platforms: Kubernetes and self-hosted
|
||||
|
||||
Flags:
|
||||
-h, --help help for dapr
|
||||
--version version for dapr
|
||||
|
||||
Use "dapr [command] --help" for more information about a command.
|
||||
```
|
||||
|
||||
<a class="btn btn-primary" href="{{< ref install-dapr-selfhost.md >}}" role="button">Next step: Initialize Dapr >></a>
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
---
|
||||
type: docs
|
||||
title: "How-To: Install Dapr into a Kubernetes cluster"
|
||||
linkTitle: "Init Dapr on Kubernetes"
|
||||
weight: 30
|
||||
linkTitle: "(optional) Init Dapr on Kubernetes"
|
||||
weight: 70
|
||||
description: "Install Dapr in a Kubernetes cluster"
|
||||
---
|
||||
|
||||
|
@ -51,11 +51,13 @@ The `-k` flag initializes Dapr on the Kubernetes cluster in your current context
|
|||
Make sure the correct "target" cluster is set. Check `kubectl context (kubectl config kubectl config get-contexts)` to verify. You can set a different context using `kubectl config use-context <CONTEXT>`.
|
||||
{{% /alert %}}
|
||||
|
||||
Run `dapr init -k` on your local machine:
|
||||
Run on your local machine:
|
||||
|
||||
```bash
|
||||
$ dapr init -k
|
||||
dapr init -k
|
||||
```
|
||||
|
||||
```
|
||||
⌛ Making the jump to hyperspace...
|
||||
ℹ️ Note: To install Dapr using Helm, see here: https://github.com/dapr/docs/blob/master/getting-started/environment-setup.md#using-helm-advanced
|
||||
|
||||
|
@ -67,7 +69,7 @@ $ dapr init -k
|
|||
|
||||
The default namespace when initializing Dapr is `dapr-system`. You can override this with the `-n` flag.
|
||||
|
||||
```
|
||||
```bash
|
||||
dapr init -k -n mynamespace
|
||||
```
|
||||
|
||||
|
@ -76,7 +78,7 @@ dapr init -k -n mynamespace
|
|||
|
||||
You can run Dapr with 3 replicas of each control plane pod with the exception of the Placement pod in the dapr-system namespace for [production scenarios]({{< ref kubernetes-production.md >}}).
|
||||
|
||||
```
|
||||
```bash
|
||||
dapr init -k --enable-ha=true
|
||||
```
|
||||
|
||||
|
@ -84,14 +86,14 @@ dapr init -k --enable-ha=true
|
|||
|
||||
Dapr is initialized by default with [mTLS]({{< ref "security-concept.md#sidecar-to-sidecar-communication" >}}). You can disable it with:
|
||||
|
||||
```
|
||||
```bash
|
||||
dapr init -k --enable-mtls=false
|
||||
```
|
||||
|
||||
### Uninstall Dapr on Kubernetes with CLI
|
||||
|
||||
```bash
|
||||
$ dapr uninstall --kubernetes
|
||||
dapr uninstall --kubernetes
|
||||
```
|
||||
|
||||
## Install with Helm (advanced)
|
||||
|
@ -130,8 +132,10 @@ The latest Dapr helm chart no longer supports Helm v2. Please migrate from helm
|
|||
Once the chart installation is complete verify the dapr-operator, dapr-placement, dapr-sidecar-injector and dapr-sentry pods are running in the `dapr-system` namespace:
|
||||
|
||||
```bash
|
||||
$ kubectl get pods -n dapr-system -w
|
||||
kubectl get pods -n dapr-system -w
|
||||
```
|
||||
|
||||
```
|
||||
NAME READY STATUS RESTARTS AGE
|
||||
dapr-dashboard-7bd6cbf5bf-xglsr 1/1 Running 0 40s
|
||||
dapr-operator-7bd6cbf5bf-xglsr 1/1 Running 0 40s
|
||||
|
|
|
@ -1,116 +1,117 @@
|
|||
---
|
||||
type: docs
|
||||
title: "How-To: Install Dapr into your local environment"
|
||||
title: "Initialize Dapr in your local environment"
|
||||
linkTitle: "Init Dapr locally"
|
||||
weight: 20
|
||||
description: "Install Dapr in your local environment for testing and self-hosting"
|
||||
aliases:
|
||||
- /getting-started/install-dapr/
|
||||
---
|
||||
|
||||
## Prerequisites
|
||||
Now that you have the [Dapr CLI installed]({{<ref install-dapr-cli.md>}}), it's time to initialize Dapr on your local machine using the CLI.
|
||||
|
||||
- Install [Dapr CLI]({{< ref install-dapr-cli.md >}})
|
||||
- Install [Docker Desktop](https://docs.docker.com/install/)
|
||||
- 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 >}})
|
||||
Dapr runs as a sidecar alongside your application, and in self-hosted mode this means it is a process on your local machine. Therefore, initializing Dapr includes fetching the Dapr sidecar binaries and installing them locally.
|
||||
|
||||
## Initialize Dapr using the CLI
|
||||
In addition, the default initialization process also creates a development environment that helps streamline application development with Dapr. This includes the following steps:
|
||||
|
||||
This step installs the latest Dapr Docker containers and setup a developer environment to help you get started easily with Dapr.
|
||||
1. Running a **Redis container instance** to be used as a local state store and message broker
|
||||
1. Running a **Zipkin container instance** for observability
|
||||
1. Creating a **default components folder** with component definitions for the above
|
||||
1. Running a **Dapr placement service container instance** for local actor support
|
||||
|
||||
{{% alert title="Dapr release candidate" color="warning" %}}
|
||||
This page provides instructions for installing Dapr runtime v0.11. To install v1.0-rc2 preview, the release candidate for the upcoming v1.0 release please visit the [v1.0-rc2 docs version of this page](https://v1-rc1.docs.dapr.io/getting-started/install-dapr-selfhost/). Note you will need to ensure you are also using the preview version of the CLI (instructions to install the latest preview CLI can be found [here](https://v1-rc2.docs.dapr.io/getting-started/install-dapr-cli/)).
|
||||
{{% /alert %}}
|
||||
|
||||
{{% alert title="Docker" color="primary" %}}
|
||||
This recommended development environment requires [Docker](https://docs.docker.com/install/). It is possible to initialize Dapr without a dependency on Docker (see [this guidance]({{<ref self-hosted-no-docker.md>}})) but next steps in this guide assume the recommended development environment.
|
||||
{{% /alert %}}
|
||||
|
||||
### Step 1: Open 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 will need to use `sudo` below.
|
||||
{{% /codetab %}}
|
||||
|
||||
{{% codetab %}}
|
||||
Make sure that you run Command Prompt as administrator (right click, run as administrator)
|
||||
{{% /codetab %}}
|
||||
|
||||
{{< /tabs >}}
|
||||
|
||||
### Step 2: Run the init CLI command
|
||||
|
||||
Install the latest Dapr runtime binaries:
|
||||
|
||||
```bash
|
||||
dapr init
|
||||
```
|
||||
|
||||
### Step 3: Verify Dapr version
|
||||
|
||||
```bash
|
||||
dapr --version
|
||||
```
|
||||
|
||||
Output should look like this:
|
||||
```
|
||||
CLI version: 0.11
|
||||
Runtime version: 0.11
|
||||
```
|
||||
|
||||
### Step 4: Verify containers are running
|
||||
|
||||
As mentioned above, the `dapr init` command launches several containers that will help you get started with Dapr. Verify this by running:
|
||||
|
||||
```bash
|
||||
docker ps
|
||||
```
|
||||
|
||||
Make sure that instances with `daprio/dapr`, `openzipkin/zipkin`, and `redis` images are all running:
|
||||
|
||||
```
|
||||
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 "./placement" 2 minutes ago Up 2 minutes 0.0.0.0:6050->50005/tcp dapr_placement
|
||||
```
|
||||
|
||||
### Step 5: Verify components directory has been initialized
|
||||
|
||||
On `dapr init`, the CLI also creates a default components folder which includes several YAML files with definitions for a state store, pub/sub and zipkin. These will be read by the Dapr sidecar, telling it to use the Redis container for state management and messaging and the Zipkin container for collecting traces.
|
||||
|
||||
- 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 v0.11. To install v1.0-rc2 preview, the release candidate for the upcoming v1.0 release please visit the [v1.0-rc2 docs version of this page](https://v1-rc1.docs.dapr.io/getting-started/install-dapr-selfhost/). Note you will need to ensure you are also using the preview version of the CLI (instructions to install the latest preview CLI can be found [here](https://v1-rc2.docs.dapr.io/getting-started/install-dapr-cli/)).
|
||||
{{% /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 >}}
|
||||
|
||||
1. Run `dapr init`:
|
||||
|
||||
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](https://github.com/dapr/dapr/releases)
|
||||
|
||||
```bash
|
||||
$ dapr init
|
||||
⌛ 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
|
||||
```
|
||||
|
||||
1. Verify Dapr version with `dapr --version`:
|
||||
|
||||
```bash
|
||||
$ dapr --version
|
||||
CLI version: 0.11
|
||||
Runtime version: 0.11
|
||||
```
|
||||
|
||||
1. Verify Dapr containers are running with `docker ps`:
|
||||
|
||||
Make sure the `daprio/dapr`, `openzipkin/zipkin`, and `redis` container images are all running:
|
||||
|
||||
```bash
|
||||
$ 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 "./placement" 2 minutes ago Up 2 minutes 0.0.0.0:6050->50005/tcp dapr_placement
|
||||
```
|
||||
|
||||
1. Verify Dapr directory has been initialized
|
||||
|
||||
{{< tabs "Linux/MacOS" "Windows">}}
|
||||
|
||||
{{% codetab %}}
|
||||
Run `ls $HOME/.dapr`:
|
||||
```bash
|
||||
$ ls $HOME/.dapr
|
||||
bin components config.yaml
|
||||
```
|
||||
{{% /codetab %}}
|
||||
|
||||
{{% codetab %}}
|
||||
Open `%USERPROFILE%\.dapr\` in file explorer
|
||||
|
||||

|
||||
{{% /codetab %}}
|
||||
|
||||
{{< /tabs >}}
|
||||
|
||||
## Uninstall Dapr in self-hosted mode
|
||||
|
||||
This cli command removes the placement Dapr container:
|
||||
{{< tabs "Linux/MacOS" "Windows">}}
|
||||
|
||||
{{% codetab %}}
|
||||
Run:
|
||||
```bash
|
||||
$ dapr uninstall
|
||||
ls $HOME/.dapr
|
||||
```
|
||||
|
||||
{{% 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:
|
||||
|
||||
```bash
|
||||
$ dapr uninstall --all
|
||||
You should see:
|
||||
```
|
||||
{{% /alert %}}
|
||||
bin components config.yaml
|
||||
```
|
||||
{{% /codetab %}}
|
||||
|
||||
{{% 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 %}}
|
||||
{{% codetab %}}
|
||||
Open `%USERPROFILE%\.dapr\` in file explorer:
|
||||
|
||||
## Next steps
|
||||
- [Setup a state store and pub/sub message broker]({{< ref configure-state-pubsub.md >}})
|
||||
```powershell
|
||||
explorer "%USERPROFILE%\.dapr\"
|
||||
```
|
||||
|
||||
You will see the Dapr config, Dapr binaries directory, and the default components directory for Dapr:
|
||||
|
||||
<img src="/images/install-dapr-selfhost-windows.png" width=500>
|
||||
{{% /codetab %}}
|
||||
|
||||
{{< /tabs >}}
|
||||
|
||||
<a class="btn btn-primary" href="{{< ref get-started-api.md >}}" role="button">Next step: Use the Dapr API >></a>
|
||||
|
||||
|
|
|
@ -0,0 +1,22 @@
|
|||
---
|
||||
type: docs
|
||||
title: "Uninstall Dapr in a self-hosted environment"
|
||||
linkTitle: "Uninstall Dapr"
|
||||
weight: 60000
|
||||
description: "Steps to remove Dapr from your local machine"
|
||||
---
|
||||
|
||||
The following CLI command removes the Dapr sidecar binaries and the placement container:
|
||||
|
||||
```bash
|
||||
dapr uninstall
|
||||
```
|
||||
The above command will not remove the Redis or Zipkin containers that were installed during `dapr init` 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:
|
||||
|
||||
```bash
|
||||
dapr uninstall --all
|
||||
```
|
||||
|
||||
{{% 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 %}}
|
|
@ -3,7 +3,7 @@ type: docs
|
|||
title: "Steps to upgrade Dapr in a self-hosted environment"
|
||||
linkTitle: "Upgrade Dapr"
|
||||
weight: 50000
|
||||
description: "Follow these steps to upgrade Dapr in self-hosted mode and ensure a smooth upgrade."
|
||||
description: "Follow these steps to upgrade Dapr in self-hosted mode and ensure a smooth upgrade"
|
||||
---
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue