Couchbase

Detailed information on the Couchbase state store component

Create a Couchbase state store

You can run Couchbase locally using Docker:

  1. 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.

The easiest way to install Couchbase on Kubernetes is by using the Helm chart:

  1. helm repo add couchbase https://couchbase-partners.github.io/helm-charts/
  2. helm install couchbase/couchbase-operator
  3. 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:

  1. apiVersion: dapr.io/v1alpha1
  2. kind: Component
  3. metadata:
  4. name: <NAME>
  5. namespace: <NAMESPACE>
  6. spec:
  7. type: state.couchbase
  8. version: v1
  9. metadata:
  10. - name: couchbaseURL
  11. value: <REPLACE-WITH-URL> # Required. Example: "http://localhost:8091"
  12. - name: username
  13. value: <REPLACE-WITH-USERNAME> # Required.
  14. - name: password
  15. value: <REPLACE-WITH-PASSWORD> # Required.
  16. - name: bucketName
  17. value: <REPLACE-WITH-BUCKET> # Required.

Warning

The above example uses secrets as plain strings. It is recommended to use a secret store for the secrets as described here.

Apply the configuration

In Kubernetes

To apply the Couchbase state store to Kubernetes, use the kubectl CLI:

  1. kubectl apply -f couchbase.yaml

Running locally

To run locally, create a components dir containing the YAML file and provide the path to the dapr run command with the flag --components-path.

Last modified February 16, 2021: Merge pull request #1235 from dapr/update-v0.11 (b4e9fbb)