Add GCP Firestore How To (#238)

This commit is contained in:
Yaron Schneider 2019-11-11 10:55:19 -08:00 committed by GitHub
parent 1f461fa46f
commit 7e97ea536b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 69 additions and 0 deletions

View File

@ -48,6 +48,7 @@ kubectl apply -f statestore.yaml
* [Setup Consul](./setup-consul.md)
* [Setup Memcached](./setup-memcached.md)
* [Setup Azure CosmosDB](./setup-azure-cosmosdb.md)
* [Setup Google Cloud Firestore (Datastore mode)](./setup-firestore.md)
* [Setup MongoDB](./setup-mongodb.md)
* [Setup Zookeeper](./setup-zookeeper.md)
* [Supported State Stores](./supported-state-stores.md)

View File

@ -0,0 +1,67 @@
# Setup Google Cloud Firestore (Datastore mode)
## Locally
You can use the GCP Datastore emulator to run locally using the instructions [here](https://cloud.google.com/datastore/docs/tools/datastore-emulator).
You can then interact with the server using `localhost:8081`.
## Google Cloud
Follow the instructions [here](https://cloud.google.com/datastore/docs/quickstart) to get started with setting up Firestore in Google Cloud.
## Create a Dapr component
The next step is to create a Dapr component for Firestore.
Create the following YAML file named `firestore.yaml`:
```
apiVersion: dapr.io/v1alpha1
kind: Component
metadata:
name: <name>
spec:
type: state.gcp.firestore
metadata:
- name: type
value: <REPLACE-WITH-CREDENTIALS-TYPE> # Required. Example: "serviceaccount"
- name: project_id
value: <REPLACE-WITH-PROJECT-ID> # Required.
- name: private_key_id
value: <REPLACE-WITH-PRIVATE-KEY-ID> # Required.
- name: private_key
value: <REPLACE-WITH-PRIVATE-KEY> # Required.
- name: client_email
value: <REPLACE-WITH-CLIENT-EMAIL> # Required.
- name: client_id
value: <REPLACE-WITH-CLIENT-ID> # Required.
- name: auth_uri
value: <REPLACE-WITH-AUTH-URI> # Required.
- name: token_uri
value: <REPLACE-WITH-TOKEN-URI> # Required.
- name: auth_provider_x509_cert_url
value: <REPLACE-WITH-AUTH-X509-CERT-URL> # Required.
- name: client_x509_cert_url
value: <REPLACE-WITH-CLIENT-x509-CERT-URL> # Required.
- name: entity_kind
value: <REPLACE-WITH-ENTITY-KIND> # Optional. default: "DaprState"
```
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 Firestore state store to Kubernetes, use the `kubectl` CLI:
```
kubectl apply -f firestore.yaml
```
### Running locally
The Dapr CLI will automatically create a directory named `components` in your current working directory with a Redis component.
To use Firestore, replace the redis.yaml file with firestore.yaml above.

View File

@ -5,6 +5,7 @@
| ------------- | -------|------ |
| Redis | :white_check_mark: | :white_check_mark: |
| Azure CosmosDB | :white_check_mark: | :x: |
| Google Cloud Firestore | :white_check_mark: | :x: |
| Cassandra | :white_check_mark: | :x: |
| Hashicorp Consul | :white_check_mark: | :x: |
| etcd | :white_check_mark: | :x: |