GCP Firestore (Datastore mode)

Detailed information on the GCP Firestore state store component

配置

To setup GCP Firestore state store create a component of type state.gcp.firestore. 请参阅本指南,了解如何创建和应用状态存储配置。

  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

以上示例将密钥明文存储, It is recommended to use a secret store for the secrets as described here.

元数据字段规范

字段必填详情Example
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 Firestone

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

然后您可以使用 localhost:8081 与服务器交互。

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

相关链接