add couchbase how-to (#331)

This commit is contained in:
Yaron Schneider 2020-02-07 14:01:32 -08:00 committed by GitHub
parent 78e0b0f0ae
commit b3c90d6678
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 65 additions and 0 deletions

View File

@ -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)

View File

@ -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: <name>
spec:
type: state.couchbase
metadata:
- name: couchbaseURL
value: <REPLACE-WITH-URL> # Required. Example: "http://localhost:8091"
- name: username
value: <REPLACE-WITH-USERNAME> # Required.
- name: password
value: <REPLACE-WITH-PASSWORD> # Required.
- name: bucketName
value: <REPLACE-WITH-BUCKET> # 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.

View File

@ -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: |