GCP Firestore (Datastore mode)

Detailed information on the GCP Firestore state store component

Component format

To setup GCP Firestore state store create a component of type state.gcp.firestore. See this guide on how to create and apply a state store configuration.

  1. apiVersion: dapr.io/v1alpha1
  2. kind: Component
  3. metadata:
  4. name: <NAME>
  5. namespace: <NAMESPACE>
  6. spec:
  7. type: state.gcp.firestore
  8. version: v1
  9. metadata:
  10. - name: type
  11. value: <REPLACE-WITH-CREDENTIALS-TYPE> # Required. Example: "serviceaccount"
  12. - name: project_id
  13. value: <REPLACE-WITH-PROJECT-ID> # Required.
  14. - name: private_key_id
  15. value: <REPLACE-WITH-PRIVATE-KEY-ID> # Required.
  16. - name: private_key
  17. value: <REPLACE-WITH-PRIVATE-KEY> # Required.
  18. - name: client_email
  19. value: <REPLACE-WITH-CLIENT-EMAIL> # Required.
  20. - name: client_id
  21. value: <REPLACE-WITH-CLIENT-ID> # Required.
  22. - name: auth_uri
  23. value: <REPLACE-WITH-AUTH-URI> # Required.
  24. - name: token_uri
  25. value: <REPLACE-WITH-TOKEN-URI> # Required.
  26. - name: auth_provider_x509_cert_url
  27. value: <REPLACE-WITH-AUTH-X509-CERT-URL> # Required.
  28. - name: client_x509_cert_url
  29. value: <REPLACE-WITH-CLIENT-x509-CERT-URL> # Required.
  30. - name: entity_kind
  31. value: <REPLACE-WITH-ENTITY-KIND> # Optional. default: "DaprState"

Warning

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

Spec metadata fields

FieldRequiredDetailsExample
typeYThe credentials type“serviceaccount”
project_idYThe ID of the GCP project to use“project-id”
private_key_idYThe ID of the prvate key to use“private-key-id”
client_emailYThe email address for the client“eample@example.com”
client_idYThe client id value to use for authentication“client-id”
auth_uriYThe authentication URI to usehttps://accounts.google.com/o/oauth2/auth
token_uriYThe token URI to query for Auth tokenhttps://oauth2.googleapis.com/token
auth_provider_x509_cert_urlYThe auth provider certificate URLhttps://www.googleapis.com/oauth2/v1/certs
client_x509_cert_urlYThe client certificate URLhttps://www.googleapis.com/robot/v1/metadata/x509/x
entity_kindNThe entity name in Filestore. Defaults to “DaprState”“DaprState”

Setup GCP Firestore

You can use the GCP Datastore emulator to run locally using the instructions here.

You can then interact with the server using localhost:8081.

Follow the instructions here to get started with setting up Firestore in Google Cloud.

Last modified February 18, 2022: Update setup-jetstream.md (#2200) (428d8c2)