|
| 1 | +--- |
| 2 | +type: docs |
| 3 | +title: "RavenDB" |
| 4 | +linkTitle: "RavenDB" |
| 5 | +description: Detailed information on the RavenDB state store component |
| 6 | +aliases: |
| 7 | + - "/operations/components/setup-state-store/supported-state-stores/setup-ravendb/" |
| 8 | +--- |
| 9 | + |
| 10 | +## Component format |
| 11 | + |
| 12 | +To setup RavenDB state store create a component of type `state.ravendb`. See [this guide]({{< ref "howto-get-save-state.md#step-1-setup-a-state-store" >}}) on how to create and apply a state store configuration. |
| 13 | + |
| 14 | + |
| 15 | +```yaml |
| 16 | +apiVersion: dapr.io/v1alpha1 |
| 17 | +kind: Component |
| 18 | +metadata: |
| 19 | + name: <NAME> |
| 20 | +spec: |
| 21 | + type: state.ravendb |
| 22 | + version: v1 |
| 23 | + metadata: |
| 24 | + - name: databaseName |
| 25 | + value: <REPLACE-WITH-DATABASE-NAME> # Optional. default: "daprStore" |
| 26 | + - name: serverURL |
| 27 | + value: <REPLACE-WITH-SERVER-URL> #Required Example: "server.example.com" |
| 28 | + - name: certPath |
| 29 | + value: <REPLACE-WITH-CERT-PATH> # Required unless server is insecure. |
| 30 | + - name: KeyPath |
| 31 | + value: <REPLACE-WITH-KEY-PATH> # Required unless server is insecure. |
| 32 | + - name: EnableTTL |
| 33 | + value: <REPLACE-WITH-ENABLE-TTL> # Optional. default: "true" |
| 34 | + - name: TTLFrequency |
| 35 | + value: <REPLACE-WITH-TTL:-FREQUENCY> # Optional. Example: "15" |
| 36 | +``` |
| 37 | +
|
| 38 | +{{% alert title="Warning" color="warning" %}} |
| 39 | +The above example uses secrets as plain strings. It is recommended to use a secret store for the secrets as described [here]({{< ref component-secrets.md >}}). |
| 40 | +{{% /alert %}} |
| 41 | +
|
| 42 | +## Spec metadata fields |
| 43 | +
|
| 44 | +| Field | Required | Details | Example | |
| 45 | +|--------------------|:--------:|---------|---------| |
| 46 | +| databaseName | N | The name of the database to use. Defaults to `"daprStore"` | `"daprStore"` |
| 47 | +| serverURL | Y | Url to RavenDB instance | `"http://localhost:8080"` |
| 48 | +| certPath | N<sup>1</sup> | Path to certificate file | `"majority"` |
| 49 | +| keyPath | N<sup>1</sup> | Path to key file | `"majority"`, `"local"`,`"available"`, `"linearizable"`, `"snapshot"` |
| 50 | +| EnableTTL | N | Boolean value to enable TTL capability. Defaults to `"true"` | `"5s"` |
| 51 | +| TTLFrequency | N | Additional parameters to use | `"?authSource=daprStore&ssl=true"` |
| 52 | +
|
| 53 | +> <sup>[1]</sup> The `certPath` and `keyPath` fields are not mandatory if server url is http, however if server url is https and no certPath and keyPath is present dapr returns an error. |
| 54 | + |
| 55 | +### TTLs and cleanups |
| 56 | + |
| 57 | +This state store supports [Time-To-Live (TTL)]({{< ref state-store-ttl.md >}}) for records stored with Dapr. When storing data using Dapr, you can set the `ttlInSeconds` metadata property to indicate when the data should be considered "expired". |
| 58 | + |
| 59 | +## Related links |
| 60 | + |
| 61 | +- [Basic schema for a Dapr component]({{< ref component-schema >}}) |
| 62 | +- Read [this guide]({{< ref "howto-get-save-state.md#step-2-save-and-retrieve-a-single-state" >}}) for instructions on configuring state store components |
| 63 | +- [State management building block]({{< ref state-management >}}) |
0 commit comments