Update getting started guide (#968)
* Update getting started * Added pre-req for kubectl * Added link to samples * Change "will" to present tense * Uppercase Redis
|
@ -26,6 +26,7 @@ These conventions should be followed throughout all Dapr documentation to ensure
|
|||
- **Use simple sentences** - Easy-to-read sentences mean the reader can quickly use the guidance you share.
|
||||
- **Avoid the first person** - Use 2nd person "you", "your" instead of "I", "we", "our".
|
||||
- **Assume a new developer audience** - Some obvious steps can seem hard. E.g. Now set an environment variable Dapr to a value X. It is better to give the reader the explicit command to do this, rather than having them figure this out.
|
||||
- **Use present tense** - Avoid sentences like "this command will install redis", which implies the action is in the future. Instead use "This command installs redis" which is in the present tense.
|
||||
|
||||
## Contributing a new docs page
|
||||
- Make sure the documentation you are writing is in the correct place in the hierarchy.
|
||||
|
|
|
@ -1,228 +0,0 @@
|
|||
---
|
||||
type: docs
|
||||
title: "How-To: Setup a customized Redis store"
|
||||
linkTitle: "(optional) Configure Redis"
|
||||
weight: 40
|
||||
description: "Configure Redis for Dapr state management or Pub/Sub"
|
||||
---
|
||||
|
||||
Dapr can use Redis in two ways:
|
||||
|
||||
1. As state store component (state.redis) for persistence and restoration
|
||||
2. As pub/sub component (pubsub.redis) for async style message delivery
|
||||
|
||||
## Create a Redis store
|
||||
|
||||
Dapr can use any Redis instance - containerized, running on your local dev machine, or a managed cloud service. If you already have a Redis store, move on to the [configuration](#configure-dapr-components) section.
|
||||
|
||||
{{< tabs "Self-Hosted" "Kubernetes (Helm)" "Azure Redis Cache" "AWS Redis" "GCP Memorystore" >}}
|
||||
|
||||
{{% codetab %}}
|
||||
Redis is automatically installed in self-hosted environments by the Dapr CLI as part of the initialization process.
|
||||
{{% /codetab %}}
|
||||
|
||||
{{% codetab %}}
|
||||
You can use [Helm](https://helm.sh/) to quickly create a Redis instance in our Kubernetes cluster. This approach requires [Installing Helm v3](https://github.com/helm/helm#install).
|
||||
|
||||
1. Install Redis into your cluster:
|
||||
|
||||
```bash
|
||||
helm repo add bitnami https://charts.bitnami.com/bitnami
|
||||
helm repo update
|
||||
helm install redis bitnami/redis
|
||||
```
|
||||
|
||||
Note that you will need a Redis version greater than 5, which is what Dapr's pub/sub functionality requires. If you're intending on using Redis as just a state store (and not for pub/sub) a lower version can be used.
|
||||
|
||||
2. Run `kubectl get pods` to see the Redis containers now running in your cluster:
|
||||
|
||||
```bash
|
||||
$ kubectl get pods
|
||||
NAME READY STATUS RESTARTS AGE
|
||||
redis-master-0 1/1 Running 0 69s
|
||||
redis-slave-0 1/1 Running 0 69s
|
||||
redis-slave-1 1/1 Running 0 22s
|
||||
```
|
||||
|
||||
3. Add `redis-master.default.svc.cluster.local:6379` as the `redisHost` in your [redis.yaml](#configure-dapr-components) file. For example:
|
||||
|
||||
```yaml
|
||||
metadata:
|
||||
- name: redisHost
|
||||
value: redis-master.default.svc.cluster.local:6379
|
||||
```
|
||||
|
||||
4. Securely reference the redis passoword in your [redis.yaml](#configure-dapr-components) file. For example:
|
||||
|
||||
```yaml
|
||||
- name: redisPassword
|
||||
secretKeyRef:
|
||||
name: redis
|
||||
key: redis-password
|
||||
```
|
||||
|
||||
5. (Alternative) It is **not recommended**, but you can use a hard code a password instead of using secretKeyRef. First you'll get the Redis password, which is slightly different depending on the OS you're using:
|
||||
|
||||
- **Windows**: In Powershell run:
|
||||
```powershell
|
||||
PS C:\> $base64pwd=kubectl get secret --namespace default redis -o jsonpath="{.data.redis-password}"
|
||||
PS C:\> $redispassword=[System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String($base64pwd))
|
||||
PS C:\> $base64pwd=""
|
||||
PS C:\> $redispassword
|
||||
```
|
||||
- **Linux/MacOS**: Run:
|
||||
```bash
|
||||
kubectl get secret --namespace default redis -o jsonpath="{.data.redis-password}" | base64 --decode
|
||||
```
|
||||
|
||||
Add this password as the `redisPassword` value in your [redis.yaml](#configure-dapr-components) file. For example:
|
||||
|
||||
```yaml
|
||||
metadata:
|
||||
- name: redisPassword
|
||||
value: lhDOkwTlp0
|
||||
```
|
||||
{{% /codetab %}}
|
||||
|
||||
{{% codetab %}}
|
||||
This method requires having an Azure Subscription.
|
||||
|
||||
1. Open the [Azure Portal](https://ms.portal.azure.com/#create/Microsoft.Cache) to start the Azure Redis Cache creation flow. Log in if necessary.
|
||||
1. Fill out the necessary information
|
||||
1. Click "Create" to kickoff deployment of your Redis instance.
|
||||
1. Once your instance is created, you'll need to grab your access key. Navigate to "Access Keys" under "Settings" and copy your key.
|
||||
1. You'll need the hostname of your Redis instance, which you can retrieve from the "Overview" in Azure. It should look like `xxxxxx.redis.cache.windows.net:6380`.
|
||||
1. Finally, you'll need to add our key and our host to a `redis.yaml` file that Dapr can apply to our cluster. If you're running a sample, you'll add the host and key to the provided `redis.yaml`. If you're creating a project from the ground up, you'll create a `redis.yaml` file as specified in [Configuration](#configure-dapr-components).
|
||||
|
||||
As the connection to Azure is encrypted, make sure to add the following block to the `metadata` section of your `redis.yaml` file.
|
||||
|
||||
```yaml
|
||||
metadata:
|
||||
- name: enableTLS
|
||||
value: "true"
|
||||
```
|
||||
|
||||
> **NOTE:** Dapr pub/sub uses [Redis streams](https://redis.io/topics/streams-intro) that was introduced by Redis 5.0, which isn't currently available on Azure Cache for Redis. Consequently, you can use Azure Cache for Redis only for state persistence.
|
||||
{{% /codetab %}}
|
||||
|
||||
{{% codetab %}}
|
||||
Visit [AWS Redis](https://aws.amazon.com/redis/).
|
||||
{{% /codetab %}}
|
||||
|
||||
{{% codetab %}}
|
||||
Visit [GCP Cloud MemoryStore](https://cloud.google.com/memorystore/).
|
||||
{{% /codetab %}}
|
||||
|
||||
{{< /tabs >}}
|
||||
|
||||
## Configure Dapr components
|
||||
|
||||
Dapr can use Redis as a [`statestore` component]({{< ref setup-state-store >}}) for state persistence (`state.redis`) or as a [`pubsub` component]({{< ref setup-pubsub >}}) (`pubsub.redis`). The following yaml files demonstrates how to define each component using either a secretKey reference (which is preferred) or a plain text password.
|
||||
|
||||
### Create component files
|
||||
|
||||
#### State store component with secret reference
|
||||
|
||||
Create a file called redis-state.yaml, and paste the following:
|
||||
|
||||
```yaml
|
||||
apiVersion: dapr.io/v1alpha1
|
||||
kind: Component
|
||||
metadata:
|
||||
name: statestore
|
||||
namespace: default
|
||||
spec:
|
||||
type: state.redis
|
||||
version: v1
|
||||
metadata:
|
||||
- name: redisHost
|
||||
value: <HOST e.g. redis-master.default.svc.cluster.local:6379>
|
||||
- name: redisPassword
|
||||
secretKeyRef:
|
||||
name: redis
|
||||
key: redis-password
|
||||
```
|
||||
|
||||
#### Pub/sub component with secret reference
|
||||
|
||||
Create a file called redis-pubsub.yaml, and paste the following:
|
||||
|
||||
```yaml
|
||||
apiVersion: dapr.io/v1alpha1
|
||||
kind: Component
|
||||
metadata:
|
||||
name: pubsub
|
||||
namespace: default
|
||||
spec:
|
||||
type: pubsub.redis
|
||||
version: v1
|
||||
metadata:
|
||||
- name: redisHost
|
||||
value: <HOST e.g. redis-master.default.svc.cluster.local:6379>
|
||||
- name: redisPassword
|
||||
secretKeyRef:
|
||||
name: redis
|
||||
key: redis-password
|
||||
```
|
||||
|
||||
#### State store component with hard coded password (not recommended)
|
||||
|
||||
For development purposes only, create a file called redis-state.yaml, and paste the following:
|
||||
|
||||
```yaml
|
||||
apiVersion: dapr.io/v1alpha1
|
||||
kind: Component
|
||||
metadata:
|
||||
name: statestore
|
||||
namespace: default
|
||||
spec:
|
||||
type: state.redis
|
||||
version: v1
|
||||
metadata:
|
||||
- name: redisHost
|
||||
value: <HOST>
|
||||
- name: redisPassword
|
||||
value: <PASSWORD>
|
||||
```
|
||||
|
||||
#### Pub/Sub component with hard coded password (not recommended)
|
||||
|
||||
For development purposes only, create a file called redis-pubsub.yaml, and paste the following:
|
||||
|
||||
```yaml
|
||||
apiVersion: dapr.io/v1alpha1
|
||||
kind: Component
|
||||
metadata:
|
||||
name: pubsub
|
||||
namespace: default
|
||||
spec:
|
||||
type: pubsub.redis
|
||||
version: v1
|
||||
metadata:
|
||||
- name: redisHost
|
||||
value: <HOST>
|
||||
- name: redisPassword
|
||||
value: <PASSWORD>
|
||||
```
|
||||
|
||||
### Apply the configuration
|
||||
|
||||
{{< tabs "Self-Hosted" "Kubernetes">}}
|
||||
|
||||
{{% codetab %}}
|
||||
By default the Dapr CLI creates a local Redis instance when you run `dapr init`. However, if you want to configure a different Redis instance, create a `components` dir containing the YAML file and provide the path to the `dapr run` command with the flag `--components-path`.
|
||||
|
||||
If you initialized Dapr using `dapr init --slim`, the Dapr CLI did not create a Redis instance or a default configuration file for it. Follow [the instructions above](#creat-a-redis-store) to create a Redis store. Create the `redis.yaml` following the configuration [instructions](#configure-dapr-components) in a `components` dir and provide the path to the `dapr run` command with the flag `--components-path`.
|
||||
{{% /codetab %}}
|
||||
|
||||
{{% codetab %}}
|
||||
|
||||
Run `kubectl apply -f <FILENAME>` for both state and pubsub files:
|
||||
|
||||
```bash
|
||||
kubectl apply -f redis-state.yaml
|
||||
kubectl apply -f redis-pubsub.yaml
|
||||
```
|
||||
{{% /codetab %}}
|
||||
|
||||
{{< /tabs >}}
|
|
@ -0,0 +1,232 @@
|
|||
---
|
||||
type: docs
|
||||
title: "How-To: Configure state store and pub/sub message broker"
|
||||
linkTitle: "Configure state & pub/sub"
|
||||
weight: 40
|
||||
description: "Configure state store and pub/sub message broker components for Dapr"
|
||||
aliases:
|
||||
- /getting-started/configure-redis/
|
||||
---
|
||||
|
||||
In order to get up and running with the state and pub/sub building blocks two components are needed:
|
||||
|
||||
1. A state store component for persistence and restoration
|
||||
2. As pub/sub message broker component for async-style message delivery
|
||||
|
||||
A full list of supported components can be found here:
|
||||
- [Supported state stores]({{< ref supported-state-stores >}})
|
||||
- [Supported pub/sub message brokers]({{< ref supported-pubsub >}})
|
||||
|
||||
The rest of this page describes how to get up and running with Redis.
|
||||
|
||||
{{% alert title="Self-hosted mode" color="warning" %}}
|
||||
When initialized in self-hosted mode, Dapr automatically runs a Redis container and sets up the required component yaml files. You can skip this page and go to [next steps](#next-steps)
|
||||
{{% /alert %}}
|
||||
|
||||
## Create a Redis store
|
||||
|
||||
Dapr can use any Redis instance - either containerized on your local dev machine or a managed cloud service. If you already have a Redis store, move on to the [configuration](#configure-dapr-components) section.
|
||||
|
||||
{{< tabs "Self-Hosted" "Kubernetes" "Azure" "AWS" "GCP" >}}
|
||||
|
||||
{{% codetab %}}
|
||||
Redis is automatically installed in self-hosted environments by the Dapr CLI as part of the initialization process. You are all set and can skip to the [next steps](next steps)
|
||||
{{% /codetab %}}
|
||||
|
||||
{{% codetab %}}
|
||||
You can use [Helm](https://helm.sh/) to quickly create a Redis instance in our Kubernetes cluster. This approach requires [Installing Helm v3](https://github.com/helm/helm#install).
|
||||
|
||||
1. Install Redis into your cluster:
|
||||
|
||||
```bash
|
||||
helm repo add bitnami https://charts.bitnami.com/bitnami
|
||||
helm repo update
|
||||
helm install redis bitnami/redis
|
||||
```
|
||||
|
||||
Note that you will need a Redis version greater than 5, which is what Dapr's pub/sub functionality requires. If you're intending on using Redis as just a state store (and not for pub/sub) a lower version can be used.
|
||||
|
||||
2. Run `kubectl get pods` to see the Redis containers now running in your cluster:
|
||||
|
||||
```bash
|
||||
$ kubectl get pods
|
||||
NAME READY STATUS RESTARTS AGE
|
||||
redis-master-0 1/1 Running 0 69s
|
||||
redis-slave-0 1/1 Running 0 69s
|
||||
redis-slave-1 1/1 Running 0 22s
|
||||
```
|
||||
|
||||
Note that the hostname is `redis-master.default.svc.cluster.local:6379`, and a Kubernetes secret, `redis`, is created automatically.
|
||||
|
||||
{{% /codetab %}}
|
||||
|
||||
{{% codetab %}}
|
||||
This method requires having an Azure Subscription.
|
||||
|
||||
1. Open the [Azure Portal](https://ms.portal.azure.com/#create/Microsoft.Cache) to start the Azure Redis Cache creation flow. Log in if necessary.
|
||||
1. Fill out the necessary information
|
||||
- Dapr pub/sub uses [Redis streams](https://redis.io/topics/streams-intro) that was introduced by Redis 5.0. If you would like to use Azure Redis Cache for pub/sub make sure to set the version to (PREVIEW) 6.
|
||||
1. Click "Create" to kickoff deployment of your Redis instance.
|
||||
1. You'll need the hostname of your Redis instance, which you can retrieve from the "Overview" in Azure. It should look like `xxxxxx.redis.cache.windows.net:6380`. Note this for later.
|
||||
1. Once your instance is created, you'll need to grab your access key. Navigate to "Access Keys" under "Settings" and create a Kubernetes secret to store your Redis password:
|
||||
```bash
|
||||
kubectl create secret generic redis --from-literal=redis-password=*********
|
||||
```
|
||||
|
||||
{{% /codetab %}}
|
||||
|
||||
{{% codetab %}}
|
||||
1. Visit [AWS Redis](https://aws.amazon.com/redis/) to deploy a Redis instance
|
||||
1. Note the Redis hostname in the AWS portal for use later
|
||||
1. Create a Kubernetes secret to store your Redis password:
|
||||
```bash
|
||||
kubectl create secret generic redis --from-literal=redis-password=*********
|
||||
```
|
||||
{{% /codetab %}}
|
||||
|
||||
{{% codetab %}}
|
||||
1. Visit [GCP Cloud MemoryStore](https://cloud.google.com/memorystore/) to deploy a MemoryStore instance
|
||||
1. Note the Redis hostname in the GCP portal for use later
|
||||
1. Create a Kubernetes secret to store your Redis password:
|
||||
```bash
|
||||
kubectl create secret generic redis --from-literal=redis-password=*********
|
||||
```
|
||||
{{% /codetab %}}
|
||||
|
||||
{{< /tabs >}}
|
||||
|
||||
## Configure Dapr components
|
||||
|
||||
Dapr uses components to define what resources to use for building block functionality. These steps go through how to connect the resources you created above to Dapr for state and pub/sub.
|
||||
|
||||
In self-hosted mode, component files are automatically created under:
|
||||
- **Windows**: `%USERPROFILE%\.dapr\components\`
|
||||
- **Linux/MacOS**: `$HOME/.dapr/components`
|
||||
|
||||
For Kubernetes, files can be created in any directory, as they are applied with `kubectl`.
|
||||
|
||||
### Create State store component
|
||||
|
||||
Create a file named `redis-state.yaml`, and paste the following:
|
||||
|
||||
```yaml
|
||||
apiVersion: dapr.io/v1alpha1
|
||||
kind: Component
|
||||
metadata:
|
||||
name: statestore
|
||||
namespace: default
|
||||
spec:
|
||||
type: state.redis
|
||||
version: v1
|
||||
metadata:
|
||||
- name: redisHost
|
||||
value: <REPLACE WITH HOSTNAME FROM ABOVE - for Redis on Kubernetes it is redis-master.default.svc.cluster.local:6379>
|
||||
- name: redisPassword
|
||||
secretKeyRef:
|
||||
name: redis
|
||||
key: redis-password
|
||||
```
|
||||
|
||||
This example uses the the kubernetes secret that was created when setting up a cluster with the above instructions.
|
||||
|
||||
{{% alert title="Other stores" color="primary" %}}
|
||||
If using a state store other than Redis, refer to the [supported state stores]({{< ref supported-state-stores >}}) for information on what options to set.
|
||||
{{% /alert %}}
|
||||
|
||||
### Create Pub/sub message broker component
|
||||
|
||||
Create a file called redis-pubsub.yaml, and paste the following:
|
||||
|
||||
```yaml
|
||||
apiVersion: dapr.io/v1alpha1
|
||||
kind: Component
|
||||
metadata:
|
||||
name: pubsub
|
||||
namespace: default
|
||||
spec:
|
||||
type: pubsub.redis
|
||||
version: v1
|
||||
metadata:
|
||||
- name: redisHost
|
||||
value: <REPLACE WITH HOSTNAME FROM ABOVE - for Redis on Kubernetes it is redis-master.default.svc.cluster.local:6379>
|
||||
- name: redisPassword
|
||||
secretKeyRef:
|
||||
name: redis
|
||||
key: redis-password
|
||||
```
|
||||
|
||||
This example uses the the kubernetes secret that was created when setting up a cluster with the above instructions.
|
||||
|
||||
{{% alert title="Other stores" color="primary" %}}
|
||||
If using a pub/sub message broker other than Redis, refer to the [supported pub/sub message brokers]({{< ref supported-pubsub >}}) for information on what options to set.
|
||||
{{% /alert %}}
|
||||
|
||||
### Hard coded passwords (not recommended)
|
||||
|
||||
For development purposes only you can skip creating kubernetes secrets and place passwords directly into the Dapr component file:
|
||||
|
||||
```yaml
|
||||
apiVersion: dapr.io/v1alpha1
|
||||
kind: Component
|
||||
metadata:
|
||||
name: statestore
|
||||
namespace: default
|
||||
spec:
|
||||
type: state.redis
|
||||
version: v1
|
||||
metadata:
|
||||
- name: redisHost
|
||||
value: <HOST>
|
||||
- name: redisPassword
|
||||
value: <PASSWORD>
|
||||
```
|
||||
|
||||
```yaml
|
||||
apiVersion: dapr.io/v1alpha1
|
||||
kind: Component
|
||||
metadata:
|
||||
name: pubsub
|
||||
namespace: default
|
||||
spec:
|
||||
type: pubsub.redis
|
||||
version: v1
|
||||
metadata:
|
||||
- name: redisHost
|
||||
value: <HOST>
|
||||
- name: redisPassword
|
||||
value: <PASSWORD>
|
||||
```
|
||||
|
||||
## Apply the configuration
|
||||
|
||||
{{< tabs "Self-Hosted" "Kubernetes">}}
|
||||
|
||||
{{% codetab %}}
|
||||
|
||||
By default the Dapr CLI creates a local Redis instance when you run `dapr init`. However, if you want to configure a different Redis instance you can either:
|
||||
- Update the existing component files or create new ones in the default components directory
|
||||
- **Linux/MacOS:** `$HOME/.dapr/components`
|
||||
- **Windows:** `%USERPROFILE%\.dapr\components`
|
||||
- Create a new `components` directory in your app folder containing the YAML files and provide the path to the `dapr run` command with the flag `--components-path`
|
||||
|
||||
{{% alert title="Self-hosted slim mode" color="primary" %}}
|
||||
If you initialized Dapr in [slim mode]({{< ref self-hosted-no-docker.md >}}) (without Docker) you need to manually create the default directory, or always specify a components directory using `--components-path`.
|
||||
{{% /alert %}}
|
||||
|
||||
{{% /codetab %}}
|
||||
|
||||
{{% codetab %}}
|
||||
|
||||
Run `kubectl apply -f <FILENAME>` for both state and pubsub files:
|
||||
|
||||
```bash
|
||||
kubectl apply -f redis-state.yaml
|
||||
kubectl apply -f redis-pubsub.yaml
|
||||
```
|
||||
{{% /codetab %}}
|
||||
|
||||
{{< /tabs >}}
|
||||
|
||||
## Next steps
|
||||
- [Setup your development environment]({{< ref dev-environment.md >}})
|
||||
- [Try out a Dapr quickstart]({{< ref quickstarts.md >}})
|
|
@ -0,0 +1,26 @@
|
|||
---
|
||||
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 >}})
|
|
@ -8,31 +8,31 @@ description: "Install the Dapr CLI to get started with Dapr"
|
|||
|
||||
## Dapr CLI installation scripts
|
||||
|
||||
Begin by downloading and installing the Dapr CLI for v1.0.0-rc.2. This will be used to initialize your environment on your desired platform.
|
||||
Begin by downloading and installing the Dapr CLI for v1.0.0-rc.2. This is used to initialize your environment on your desired platform.
|
||||
|
||||
{{% alert title="Note" color="warning" %}}
|
||||
This command will download and install Dapr CLI v1.0-rc.2. To install v0.11, the latest release prior to the release candidates for the [upcoming v1.0 release](https://blog.dapr.io/posts/2020/10/20/the-path-to-v.1.0-production-ready-dapr/), please visit the [v0.11 docs](https://docs.dapr.io).
|
||||
This command downloads and install Dapr CLI v1.0-rc.2. To install v0.11, the latest release prior to the release candidates for the [upcoming v1.0 release](https://blog.dapr.io/posts/2020/10/20/the-path-to-v.1.0-production-ready-dapr/), please visit the [v0.11 docs](https://docs.dapr.io).
|
||||
{{% /alert %}}
|
||||
|
||||
{{< tabs Linux Windows MacOS Binaries>}}
|
||||
|
||||
{{% codetab %}}
|
||||
This command will install the latest linux Dapr CLI to `/usr/local/bin`:
|
||||
This command installs the latest linux Dapr CLI to `/usr/local/bin`:
|
||||
```bash
|
||||
wget -q https://raw.githubusercontent.com/dapr/cli/master/install/install.sh -O - | /bin/bash -s 1.0.0-rc.2
|
||||
```
|
||||
{{% /codetab %}}
|
||||
|
||||
{{% codetab %}}
|
||||
This command will install the latest windows Dapr cli to `%USERPROFILE%\.dapr\` and add this directory to User PATH environment variable:
|
||||
This command installs the latest windows Dapr cli to `C:\dapr` and add this directory to User PATH environment variable. Run in Command Prompt:
|
||||
```powershell
|
||||
powershell -Command "$script=iwr -useb https://raw.githubusercontent.com/dapr/cli/master/install/install.ps1; $block=[ScriptBlock]::Create($script); invoke-command -ScriptBlock $block -ArgumentList 1.0.0-rc.2"
|
||||
```
|
||||
Verify by opening Explorer and entering `%USERPROFILE%\.dapr\` into the address bar. You should see folders for bin, componenets and a config file.
|
||||
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 %}}
|
||||
This command will install the latest darwin Dapr CLI to `/usr/local/bin`:
|
||||
This command installs the latest darwin Dapr CLI to `/usr/local/bin`:
|
||||
```bash
|
||||
curl -fsSL https://raw.githubusercontent.com/dapr/cli/master/install/install.sh | /bin/bash -s 1.0.0-rc.2
|
||||
```
|
||||
|
@ -57,6 +57,6 @@ Each release of Dapr CLI includes various OSes and architectures. These binary v
|
|||
Learn more about the CLI and available commands in the [CLI docs]( {{< ref cli >}}).
|
||||
|
||||
## Next steps
|
||||
- [Init Dapr locally]({{< ref install-dapr.md >}})
|
||||
- [Init Dapr locally]({{< ref install-dapr-selfhost.md >}})
|
||||
- [Init Dapr on Kubernetes]({{< ref install-dapr-kubernetes.md >}})
|
||||
- [Try a Dapr Quickstart]({{< ref quickstarts.md >}})
|
||||
|
||||
|
|
|
@ -8,14 +8,20 @@ description: "Install Dapr in a Kubernetes cluster"
|
|||
|
||||
When setting up Kubernetes you can use either the Dapr CLI or Helm.
|
||||
|
||||
The following pods will be installed:
|
||||
As part of the Dapr initialization the following pods are installed:
|
||||
|
||||
- dapr-operator: Manages component updates and Kubernetes services endpoints for Dapr (state stores, pub/subs, etc.)
|
||||
- dapr-sidecar-injector: Injects Dapr into annotated deployment pods
|
||||
- dapr-placement: Used for actors only. Creates mapping tables that map actor instances to pods
|
||||
- dapr-sentry: Manages mTLS between services and acts as a certificate authority
|
||||
- **dapr-operator:** Manages component updates and Kubernetes services endpoints for Dapr (state stores, pub/subs, etc.)
|
||||
- **dapr-sidecar-injector:** Injects Dapr into annotated deployment pods
|
||||
- **dapr-placement:** Used for actors only. Creates mapping tables that map actor instances to pods
|
||||
- **dapr-sentry:** Manages mTLS between services and acts as a certificate authority
|
||||
|
||||
## Setup cluster
|
||||
## Prerequisites
|
||||
|
||||
- Install [Dapr CLI]({{< ref install-dapr-cli.md >}})
|
||||
- Install [kubectl](https://kubernetes.io/docs/tasks/tools/install-kubectl/)
|
||||
- Kubernetes cluster (see below if needed)
|
||||
|
||||
### Create cluster
|
||||
|
||||
You can install Dapr on any Kubernetes cluster. Here are some helpful links:
|
||||
|
||||
|
@ -24,8 +30,8 @@ You can install Dapr on any Kubernetes cluster. Here are some helpful links:
|
|||
- [Setup Google Cloud Kubernetes Engine](https://cloud.google.com/kubernetes-engine/docs/quickstart)
|
||||
- [Setup Amazon Elastic Kubernetes Service](https://docs.aws.amazon.com/eks/latest/userguide/getting-started.html)
|
||||
|
||||
{{% alert title="Note" color="primary" %}}
|
||||
Both the Dapr CLI and the Dapr Helm chart automatically deploy with affinity for nodes with the label `kubernetes.io/os=linux`. You can deploy Dapr to Windows nodes, but most users should not need to. For more information see [Deploying to a hybrid Linux/Windows Kubernetes cluster]({{<ref kubernetes-hybrid-clusters>}}).
|
||||
{{% alert title="Hybrid clusters" color="primary" %}}
|
||||
Both the Dapr CLI and the Dapr Helm chart automatically deploy with affinity for nodes with the label `kubernetes.io/os=linux`. You can deploy Dapr to Windows nodes if your application requires it. For more information see [Deploying to a hybrid Linux/Windows Kubernetes cluster]({{<ref kubernetes-hybrid-clusters>}}).
|
||||
{{% /alert %}}
|
||||
|
||||
|
||||
|
@ -33,13 +39,19 @@ Both the Dapr CLI and the Dapr Helm chart automatically deploy with affinity for
|
|||
|
||||
You can install Dapr to a Kubernetes cluster using the [Dapr CLI]({{< ref install-dapr-cli.md >}}).
|
||||
|
||||
{{% alert title="Note" color="warning" %}}
|
||||
This command will download and install Dapr runtime v1.0-rc.1. To install v0.11, the latest release prior to the release candidates for the [upcoming v1.0 release](https://blog.dapr.io/posts/2020/10/20/the-path-to-v.1.0-production-ready-dapr/), please visit the [v0.11 docs](https://docs.dapr.io).
|
||||
{{% alert title="Release candidate" color="warning" %}}
|
||||
This command downloads and install Dapr runtime v1.0-rc.1. To install v0.11, the latest release prior to the release candidates for the [upcoming v1.0 release](https://blog.dapr.io/posts/2020/10/20/the-path-to-v.1.0-production-ready-dapr/), please visit the [v0.11 docs](https://docs.dapr.io).
|
||||
{{% /alert %}}
|
||||
|
||||
### Install Dapr
|
||||
|
||||
The `-k` flag will initialize Dapr on the Kuberentes cluster in your current context.
|
||||
The `-k` flag initializes Dapr on the Kubernetes cluster in your current context.
|
||||
|
||||
{{% alert title="Target cluster" color="primary" %}}
|
||||
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 --runtime-version 1.0.0-rc.1` on your local machine:
|
||||
|
||||
```bash
|
||||
$ dapr init -k --runtime-version 1.0.0-rc.1
|
||||
|
@ -51,14 +63,15 @@ $ dapr init -k --runtime-version 1.0.0-rc.1
|
|||
✅ Success! Dapr has been installed to namespace dapr-system. To verify, run "dapr status -k" in your terminal. To get started, go here: https://aka.ms/dapr-getting-started
|
||||
```
|
||||
|
||||
### Install to a custom namespace:
|
||||
### Install in custom namespace
|
||||
|
||||
The default namespace when initializeing Dapr is `dapr-system`. You can override this with the `-n` flag.
|
||||
The default namespace when initializing Dapr is `dapr-system`. You can override this with the `-n` flag.
|
||||
|
||||
```
|
||||
dapr init -k -n mynamespace --runtime-version 1.0.0-rc.1
|
||||
```
|
||||
|
||||
|
||||
### Install in highly available mode:
|
||||
|
||||
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 >}}).
|
||||
|
@ -67,7 +80,7 @@ You can run Dapr with 3 replicas of each control plane pod with the exception of
|
|||
dapr init -k --enable-ha=true --runtime-version 1.0.0-rc.1
|
||||
```
|
||||
|
||||
### Disable mTLS:
|
||||
### Disable mTLS
|
||||
|
||||
Dapr is initialized by default with [mTLS]({{< ref "security-concept.md#sidecar-to-sidecar-communication" >}}). You can disable it with:
|
||||
|
||||
|
@ -75,7 +88,7 @@ Dapr is initialized by default with [mTLS]({{< ref "security-concept.md#sidecar-
|
|||
dapr init -k --enable-mtls=false --runtime-version 1.0.0-rc.1
|
||||
```
|
||||
|
||||
### Uninstall Dapr on Kubernetes
|
||||
### Uninstall Dapr on Kubernetes with CLI
|
||||
|
||||
```bash
|
||||
$ dapr uninstall --kubernetes
|
||||
|
@ -90,10 +103,10 @@ You can install Dapr to Kubernetes cluster using a Helm 3 chart.
|
|||
The latest Dapr helm chart no longer supports Helm v2. Please migrate from helm v2 to helm v3 by following [this guide](https://helm.sh/blog/migrate-from-helm-v2-to-helm-v3/).
|
||||
{{% /alert %}}
|
||||
|
||||
### Install Dapr on Kubernetes
|
||||
### Add and install Dapr helm chart
|
||||
|
||||
1. Make sure Helm 3 is installed on your machine
|
||||
2. Add Helm repo
|
||||
1. Make sure [Helm 3](https://github.com/helm/helm/releases) is installed on your machine
|
||||
2. Add Helm repo and update
|
||||
|
||||
```bash
|
||||
helm repo add dapr https://dapr.github.io/helm-charts/
|
||||
|
@ -114,7 +127,7 @@ The latest Dapr helm chart no longer supports Helm v2. Please migrate from helm
|
|||
|
||||
### Verify installation
|
||||
|
||||
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:
|
||||
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
|
||||
|
@ -133,8 +146,10 @@ dapr-sentry-9435776c7f-8f7yd 1/1 Running 0 40s
|
|||
helm uninstall dapr -n dapr-system
|
||||
```
|
||||
|
||||
> **Note:** See [this page](https://github.com/dapr/dapr/blob/master/charts/dapr/README.md) for details on Dapr helm charts.
|
||||
### More information
|
||||
|
||||
## Sidecar annotations
|
||||
See [this page](https://github.com/dapr/dapr/blob/master/charts/dapr/README.md) for details on Dapr helm charts.
|
||||
|
||||
To see all the supported annotations for the Dapr sidecar on Kubernetes, visit [this]({{<ref "kubernetes-annotations.md">}}) how to guide.
|
||||
## Next steps
|
||||
|
||||
- [Configure state store & pubsub message broker]({{< ref configure-state-pubsub.md >}})
|
||||
|
|
|
@ -4,6 +4,8 @@ title: "How-To: Install Dapr into 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
|
||||
|
@ -12,30 +14,37 @@ description: "Install Dapr in your local environment for testing and self-hostin
|
|||
- Install [Docker Desktop](https://docs.docker.com/install/)
|
||||
- Windows users ensure that `Docker Desktop For Windows` uses Linux containers.
|
||||
|
||||
By default Dapr will install with a developer environment using Docker containers to get you started easily. This getting started guide assumes Docker is installed to ensure the best experience. However, Dapr does not depend on Docker to run. Read [this page]({{< ref self-hosted-no-docker.md >}}) for instructions on installing Dapr locally without Docker using slim init.
|
||||
{{% alert title="Note" color="primary" %}}
|
||||
By default Dapr is installed with a developer environment using Docker containers to get you started easily. This getting started guide assumes Docker is installed to ensure the best experience. However, Dapr does not depend on Docker to run. Read [this page]({{< ref self-hosted-no-docker.md >}}) for instructions on installing Dapr locally without Docker using slim init.
|
||||
{{% /alert %}}
|
||||
|
||||
## Initialize Dapr using the CLI
|
||||
|
||||
This step will install the latest Dapr Docker containers and setup a developer environment to help you get started easily with Dapr.
|
||||
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 will download and install Dapr runtime v1.0-rc.1. To install v0.11, the latest release prior to the release candidates for the [upcoming v1.0 release](https://blog.dapr.io/posts/2020/10/20/the-path-to-v.1.0-production-ready-dapr/), please visit the [v0.11 docs](https://docs.dapr.io).
|
||||
This command downloads and installs Dapr runtime v1.0-rc.1. To install v0.11, the latest release prior to the release candidates for the [upcoming v1.0 release](https://blog.dapr.io/posts/2020/10/20/the-path-to-v.1.0-production-ready-dapr/), please visit the [v0.11 docs](https://docs.dapr.io).
|
||||
{{% /alert %}}
|
||||
|
||||
1. Ensure you are in an elevated terminal:
|
||||
- **Linux/MacOS:** if you run your docker cmds with sudo or the install path is `/usr/local/bin`(default install path), you need to use `sudo`
|
||||
- **Windows:** make sure that you run the cmd terminal in administrator mode
|
||||
- **Linux/MacOS:** if you run your docker commands with sudo or the install path is `/usr/local/bin`(default install path), you need to use `sudo`
|
||||
- **Windows:** make sure that you run the command prompt terminal in administrator mode (right click, run as administrator)
|
||||
|
||||
2. Run `dapr init --runtime-version 1.0.0-rc.1`
|
||||
|
||||
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
|
||||
$ dapr init --runtime-version 1.0.0-rc.1
|
||||
⌛ 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 installation
|
||||
3. Verify Dapr containers are running
|
||||
|
||||
From a command prompt run the `docker ps` command and check that the `daprio/dapr`, `openzipkin/zipkin`, and `redis` container images are running:
|
||||
|
||||
|
@ -47,25 +56,20 @@ This command will download and install Dapr runtime v1.0-rc.1. To install v0.11,
|
|||
71cccdce0e8f redis "docker-entrypoint.s…" About a minute ago Up About a minute 0.0.0.0:6379->6379/tcp dapr_redis
|
||||
```
|
||||
|
||||
4. Visit our [hello world quickstart](https://github.com/dapr/quickstarts/tree/master/hello-world) or dive into the [Dapr building blocks]({{< ref building-blocks >}})
|
||||
4. Verify Dapr directory has been initialized
|
||||
|
||||
## (optional) Install a specific runtime version
|
||||
|
||||
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
|
||||
# Install v0.11.3 runtime
|
||||
$ dapr init --runtime-version 0.11.3
|
||||
|
||||
# Check the versions of cli and runtime
|
||||
$ dapr --version
|
||||
cli version: v0.11.0
|
||||
runtime version: v0.11.2
|
||||
```
|
||||
- **Linux/MacOS:** Run `ls $HOME/.dapr`
|
||||
```bash
|
||||
$ ls $HOME/.dapr
|
||||
bin components config.yaml
|
||||
```
|
||||
- **Windows:** Open `%USERPROFILE%\.dapr\` in file explorer
|
||||
|
||||

|
||||
|
||||
## Uninstall Dapr in self-hosted mode
|
||||
|
||||
This command will remove the placement Dapr container:
|
||||
This cli command removes the placement Dapr container:
|
||||
|
||||
```bash
|
||||
$ dapr uninstall
|
||||
|
@ -79,8 +83,10 @@ $ dapr uninstall --all
|
|||
```
|
||||
{{% /alert %}}
|
||||
|
||||
> 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 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 %}}
|
||||
|
||||
## Configure Redis
|
||||
## Next steps
|
||||
- [Setup a state store and pub/sub message broker]({{< ref configure-state-pubsub.md >}})
|
||||
|
||||
Unlike Dapr self-hosted, redis is not pre-installed out of the box on Kubernetes. To install Redis as a state store or as a pub/sub message bus in your Kubernetes cluster see [How-To: Setup Redis]({{< ref configure-redis.md >}})
|
|
@ -2,20 +2,25 @@
|
|||
type: docs
|
||||
title: "Try out Dapr quickstarts to learn core concepts"
|
||||
linkTitle: "Dapr Quickstarts"
|
||||
weight: 50
|
||||
description: "Configure Redis for Dapr state management or Pub/Sub"
|
||||
weight: 60
|
||||
description: "Tutorials with code samples that are aimed to get you started quickly with Dapr"
|
||||
---
|
||||
|
||||
The [Dapr Quickstarts](https://github.com/dapr/quickstarts/tree/v1.0.0-rc.1) are a collection of tutorials with code samples that are aimed to get you started quickly with Dapr, each highlighting a different Dapr capability.
|
||||
|
||||
- A good place to start is the hello-world quickstart, it demonstrates how to run Dapr in standalone mode locally on your machine and demonstrates state management and service invocation in a simple application.
|
||||
- Next, if you are familiar with Kubernetes and want to see how to run the same application in a Kubernetes environment, look for the hello-kubernetes quickstart. Other quickstarts such as pub-sub, bindings and the distributed-calculator quickstart explore different Dapr capabilities include instructions for running both locally and on Kubernetes and can be completed in any order. A full list of the quickstarts can be found below.
|
||||
- At anytime, you can explore the Dapr documentation or SDK specific samples and come back to try additional quickstarts.
|
||||
- When you're done, consider exploring the [Dapr samples repository](https://github.com/dapr/samples) for additional code samples contributed by the community that show more advanced or specific usages of Dapr.
|
||||
|
||||
## Quickstarts
|
||||
|
||||
| Quickstart | Description |
|
||||
|--------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
||||
| [Hello-world](https://github.com/dapr/quickstarts/tree/v1.0.0-rc.1/hello-world) | Demonstrates how to run Dapr locally. Highlights service invocation and state management. |
|
||||
| [Hello-kubernetes](https://github.com/dapr/quickstarts/tree/v1.0.0-rc.1/hello-kubernetes) | Demonstrates how to run Dapr in Kubernetes. Highlights service invocation and state management. |
|
||||
| [Distributed-calculator](https://github.com/dapr/quickstarts/tree/v1.0.0-rc.1/distributed-calculator) | Demonstrates a distributed calculator application that uses Dapr services to power a React web app. Highlights polyglot (multi-language) programming, service invocation and state management. |
|
||||
| [Pub-sub](https://github.com/dapr/quickstarts/tree/v1.0.0-rc.1/pub-sub) | Demonstrates how to use Dapr to enable pub-sub applications. Uses Redis as a pub-sub component. |
|
||||
| [Hello World](https://github.com/dapr/quickstarts/tree/v1.0.0-rc.1/hello-world) | Demonstrates how to run Dapr locally. Highlights service invocation and state management. |
|
||||
| [Hello Kubernetes](https://github.com/dapr/quickstarts/tree/v1.0.0-rc.1/hello-kubernetes) | Demonstrates how to run Dapr in Kubernetes. Highlights service invocation and state management. |
|
||||
| [Distributed Calculator](https://github.com/dapr/quickstarts/tree/v1.0.0-rc.1/distributed-calculator) | Demonstrates a distributed calculator application that uses Dapr services to power a React web app. Highlights polyglot (multi-language) programming, service invocation and state management. |
|
||||
| [Pub/Sub](https://github.com/dapr/quickstarts/tree/v1.0.0-rc.1/pub-sub) | Demonstrates how to use Dapr to enable pub-sub applications. Uses Redis as a pub-sub component. |
|
||||
| [Bindings](https://github.com/dapr/quickstarts/tree/v1.0.0-rc.1/bindings) | Demonstrates how to use Dapr to create input and output bindings to other components. Uses bindings to Kafka. |
|
||||
| [Middleware](https://github.com/dapr/quickstarts/tree/v1.0.0-rc.1/middleware) | Demonstrates use of Dapr middleware to enable OAuth 2.0 authorization. |
|
||||
| [Observability](https://github.com/dapr/quickstarts/tree/v1.0.0-rc.1/observability) | Demonstrates Dapr tracing capabilities. Uses Zipkin as a tracing component. |
|
||||
|
|
|
@ -34,7 +34,7 @@ akswin000001 Ready agent 6d v1.17.9 10.240.0.
|
|||
## Installing the Dapr Control Plane
|
||||
|
||||
If you are installing using the Dapr CLI or via a helm chart, simply follow the normal deployment procedures:
|
||||
[Installing Dapr on a Kubernetes cluster]({{< ref "install-dapr.md#installing-Dapr-on-a-kubernetes-cluster" >}})
|
||||
[Installing Dapr on a Kubernetes cluster]({{< ref "install-dapr-selfhost.md#installing-Dapr-on-a-kubernetes-cluster" >}})
|
||||
|
||||
Affinity will be automatically set for kubernetes.io/os=linux. This will be sufficient for most users, as Kubernetes requires at least one Linux node pool.
|
||||
|
||||
|
|
|
@ -54,7 +54,7 @@ The CPU and memory limits above account for the fact that Dapr is intended to do
|
|||
## Deploying Dapr with Helm
|
||||
|
||||
When deploying to a production cluster, it's recommended to use Helm. The Dapr CLI installation into a Kubernetes cluster is for a development and test only setup.
|
||||
You can find information [here]({{< ref "install-dapr.md#using-helm-advanced" >}}) on how to deploy Dapr using Helm.
|
||||
You can find information [here]({{< ref "install-dapr-selfhost.md#using-helm-advanced" >}}) on how to deploy Dapr using Helm.
|
||||
|
||||
When deploying Dapr in a production-ready configuration, it's recommended to deploy with a highly available configuration of the control plane:
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ This article provides guidance on running Dapr in self-hosted mode without Docke
|
|||
|
||||
## Prerequisites
|
||||
|
||||
- [Dapr CLI]({{< ref "install-dapr.md#installing-dapr-cli" >}})
|
||||
- [Dapr CLI]({{< ref "install-dapr-selfhost.md#installing-dapr-cli" >}})
|
||||
|
||||
## Initialize Dapr without containers
|
||||
|
||||
|
@ -63,4 +63,4 @@ Update the state store configuration files to have the Redis host and password m
|
|||
|
||||
## Cleanup
|
||||
|
||||
Follow the uninstall [instructions]({{< ref "install-dapr.md#uninstall-dapr-in-a-self-hosted-mode" >}}) to remove the binaries.
|
||||
Follow the uninstall [instructions]({{< ref "install-dapr-selfhost.md#uninstall-dapr-in-a-self-hosted-mode" >}}) to remove the binaries.
|
||||
|
|
After Width: | Height: | Size: 9.2 KiB |
After Width: | Height: | Size: 239 KiB |
After Width: | Height: | Size: 256 KiB |
After Width: | Height: | Size: 124 KiB |
After Width: | Height: | Size: 317 KiB |
After Width: | Height: | Size: 26 KiB |
After Width: | Height: | Size: 50 KiB |
After Width: | Height: | Size: 34 KiB |