Merge branch 'master' into youngp/lf

This commit is contained in:
Aman Bhardwaj 2020-03-19 20:28:45 -07:00 committed by GitHub
commit f379f89e83
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 112 additions and 0 deletions

View File

@ -46,3 +46,4 @@ kubectl apply -f pubsub.yaml
- [Setup NATS](./setup-nats.md)
- [Setup Azure Service bus](./setup-azure-servicebus.md)
- [Setup RabbitMQ](./setup-rabbitmq.md)
- [Setup GCP Pubsub](./setup-gcp.md)

View File

@ -0,0 +1,72 @@
# Setup GCP Pubsub
Follow the instructions [here](https://cloud.google.com/pubsub/docs/quickstart-console) on setting up Google Cloud Pub/Sub system.
## Create a Dapr component
The next step is to create a Dapr component for Google Cloud Pub/Sub
Create the following YAML file named `messagebus.yaml`:
```yml
apiVersion: dapr.io/v1alpha1
kind: Component
metadata:
name: <NAME>
spec:
type: pubsub.gcp.pubsub
metadata:
- name: topic
value: <TOPIC_NAME>
- name: type
value: service_account
- name: project_id
value: <PROJECT_ID> # replace
- name: private_key_id
value: <PRIVATE_KEY_ID> #replace
- name: client_email
value: <CLIENT_EMAIL> #replace
- name: client_id
value: <CLIENT_ID> # replace
- name: auth_uri
value: https://accounts.google.com/o/oauth2/auth
- name: token_uri
value: https://oauth2.googleapis.com/token
- name: auth_provider_x509_cert_url
value: https://www.googleapis.com/oauth2/v1/certs
- name: client_x509_cert_url
value: https://www.googleapis.com/robot/v1/metadata/x509/<PROJECT_NAME>.iam.gserviceaccount.com
- name: private_key
value: <PRIVATE_KEY> # replace x509 cert here
- name: disableEntityManagement
value: <REPLACE-WITH-DISABLE-ENTITY-MANAGEMENT> # Optional. Default: false. When set to true, topics and subscriptions do not get created automatically.
```
- `topic` is the Pub/Sub topic name.
- `type` is the GCP credentials type.
- `project_id` is the GCP project id.
- `private_key_id` is the GCP private key id.
- `client_email` is the GCP client email.
- `client_id` is the GCP client id.
- `auth_uri` is Google account OAuth endpoint.
- `token_uri` is Google account token uri.
- `auth_provider_x509_cert_url` is the GCP credentials cert url.
- `client_x509_cert_url` is the GCP credentials project x509 cert url.
- `private_key` is the GCP credentials private key.
- `disableEntityManagement` Optional. Default: false. When set to true, topics and subscriptions do not get created automatically.
The above example uses secrets as plain strings. It is recommended to use a secret store for the secrets as described [here](../../concepts/secrets/README.md)
## Apply the configuration
### In Kubernetes
To apply the Google Cloud pub/sub to Kubernetes, use the `kubectl` CLI:
```bash
kubectl apply -f messagebus.yaml
```
### Running locally
The Dapr CLI will automatically create a directory named `components` in your current working directory. To use Cloud Pubsub, replace the contents of `messagebus.yaml` file with the contents of yaml above.

View File

@ -8,5 +8,6 @@
- [Secrets](./api/secrets_api.md)
- [Service Invocation](./api/service_invocation_api.md)
- [State Management](./api/state_api.md)
- [Error Codes](./api/error_codes.md) returned by Dapr APIs.
- **[Dapr Binding Specs](./specs/bindings)**: Bindings provide triggers and interactions with external resources and services
- **[Monitoring Dashboard templates](./dashboard/README.md)**: Monitoring dashboard templates help Dapr user to monitor Dapr services by importing templates to their monitoring tools

View File

@ -0,0 +1,38 @@
# Error Codes returned by APIs
For http calls made to Dapr runtime, when an error is encountered, an error json is returned in http response body. The json contains an error code and an descriptive error message, e.g.
```
{
"errorCode": "ERR_STATE_GET",
"message": "Requested state key does not exist in state store."
}
```
Following table lists the error codes returned by Dapr runtime:
Error Code | Description
--------- | -----------
ERR_ACTOR_INSTANCE_MISSING | Error getting an actor instance. This means that actor is now hosted in some other service replica.
ERR_ACTOR_RUNTIME_NOT_FOUND | Error getting the actor instance.
ERR_ACTOR_REMINDER_CREATE | Error creating a reminder for an actor.
ERR_ACTOR_REMINDER_DELETE | Error deleting a reminder for an actor.
ERR_ACTOR_TIMER_CREATE | Error creating a timer for an actor.
ERR_ACTOR_TIMER_DELETE | Error deleting a timer for an actor.
ERR_ACTOR_REMINDER_GET | Error getting a reminder for an actor.
ERR_ACTOR_INVOKE_METHOD | Error invoking a method on an actor.
ERR_ACTOR_STATE_DELETE | Error deleting the state for an actor.
ERR_ACTOR_STATE_GET | Error getting the state for an actor.
ERR_ACTOR_STATE_TRANSACTION_SAVE | Error storing actor state transactionally.
ERR_PUBSUB_NOT_FOUND | Error referencing the Pub/Sub component in Dapr runtime.
ERR_PUBSUB_PUBLISH_MESSAGE | Error publishing a message.
ERR_PUBSUB_CLOUD_EVENTS_SER | Error serializing Pub/Sub event envelope.
ERR_STATE_STORE_NOT_FOUND | Error referencing a state store not found.
ERR_STATE_GET | Error getting a state for state store.
ERR_STATE_DELETE | Error deleting a state from state store.
ERR_STATE_SAVE | Error saving a state in state store.
ERR_INVOKE_OUTPUT_BINDING | Error invoking an output binding.
ERR_MALFORMED_REQUEST | Error with a malformed request.
ERR_DIRECT_INVOKE | Error in direct invocation.
ERR_DESERIALIZE_HTTP_BODY | Error deserializing an HTTP request body.
ERR_SECRET_STORE_NOT_CONFIGURED| Error that no secret store is configured.
ERR_SECRET_STORE_NOT_FOUND | Error that specified secret store is not found.