From b3c90d6678c8e0a2bd409389e09a734194e9171c Mon Sep 17 00:00:00 2001 From: Yaron Schneider Date: Fri, 7 Feb 2020 14:01:32 -0800 Subject: [PATCH] add couchbase how-to (#331) --- howto/setup-state-store/README.md | 1 + howto/setup-state-store/setup-couchbase.md | 63 +++++++++++++++++++ .../supported-state-stores.md | 1 + 3 files changed, 65 insertions(+) create mode 100644 howto/setup-state-store/setup-couchbase.md diff --git a/howto/setup-state-store/README.md b/howto/setup-state-store/README.md index 0ce047937..73ad990b4 100644 --- a/howto/setup-state-store/README.md +++ b/howto/setup-state-store/README.md @@ -54,4 +54,5 @@ kubectl apply -f statestore.yaml * [Setup Zookeeper](./setup-zookeeper.md) * [Setup Aerospike](./setup-aerospike.md) * [Setup Hazelcast](./setup-hazelcast.md) +* [Setup Couchbase](./setup-couchbase.md) * [Supported State Stores](./supported-state-stores.md) diff --git a/howto/setup-state-store/setup-couchbase.md b/howto/setup-state-store/setup-couchbase.md new file mode 100644 index 000000000..97b5b5cf7 --- /dev/null +++ b/howto/setup-state-store/setup-couchbase.md @@ -0,0 +1,63 @@ +# Setup Couchbase + +## Locally + +You can run Couchbase locally using Docker: + +``` +docker run -d --name db -p 8091-8094:8091-8094 -p 11210:11210 couchbase +``` + +You can then interact with the server using `localhost:8091` and start the server setup. + +## Kubernetes + +The easiest way to install Couchbase on Kubernetes is by using the [Helm chart](https://github.com/couchbase-partners/helm-charts#deploying-for-development-quick-start): + +``` +helm repo add couchbase https://couchbase-partners.github.io/helm-charts/ +helm install couchbase/couchbase-operator +helm install couchbase/couchbase-cluster +``` + +## Create a Dapr component + +The next step is to create a Dapr component for Couchbase. + +Create the following YAML file named `couchbase.yaml`: + +``` +apiVersion: dapr.io/v1alpha1 +kind: Component +metadata: + name: +spec: + type: state.couchbase + metadata: + - name: couchbaseURL + value: # Required. Example: "http://localhost:8091" + - name: username + value: # Required. + - name: password + value: # Required. + - name: bucketName + value: # Required. +``` + +The above example uses secrets as plain strings. It is recommended to use a secret store for the secrets as described [here](../../concepts/components/secrets.md) + + +## Apply the configuration + +### In Kubernetes + +To apply the Couchbase state store to Kubernetes, use the `kubectl` CLI: + +``` +kubectl apply -f couchbase.yaml +``` + +### Running locally + +The Dapr CLI will automatically create a directory named `components` in your current working directory with a Redis component. +To use Couchbase, replace the redis.yaml file with the couchbase.yaml above. diff --git a/howto/setup-state-store/supported-state-stores.md b/howto/setup-state-store/supported-state-stores.md index d95e3400f..480f5ad22 100644 --- a/howto/setup-state-store/supported-state-stores.md +++ b/howto/setup-state-store/supported-state-stores.md @@ -15,3 +15,4 @@ | SQL Server | :white_check_mark: | :white_check_mark: | | Aerospike | :white_check_mark: | :x: | | Hazelcast | :white_check_mark: | :x: | +| Couchbase | :white_check_mark: | :x: |