Skip to content

Commit

Permalink
Add Application.Dapr/ConfigurationStores related docs (#1235)
Browse files Browse the repository at this point in the history
* Add Application.Dapr/ConfigurationStores related docs

Signed-off-by: SoTrx <[email protected]>
Signed-off-by: SoTrxII <[email protected]>

* Add "daprConfigurationStores", "configurationStore" and "configurationStores" to custom english dict

Signed-off-by: SoTrx <[email protected]>
Signed-off-by: SoTrxII <[email protected]>

* Adding "configurationStore" and "configurationStores" to the custom english dictionnary

Signed-off-by: SoTrx <[email protected]>
Signed-off-by: SoTrxII <[email protected]>

* Name change in dapr configuration store recipe

Signed-off-by: SoTrxII <[email protected]>

* chore(dapr-configuration) : Changing sample recipe names for a more explicit name

Signed-off-by: SoTrxII <[email protected]>

---------

Signed-off-by: SoTrx <[email protected]>
Signed-off-by: SoTrxII <[email protected]>
  • Loading branch information
SoTrx authored Oct 4, 2024
1 parent b47c77d commit 9c94c92
Show file tree
Hide file tree
Showing 7 changed files with 187 additions and 9 deletions.
5 changes: 5 additions & 0 deletions .github/config/en-custom.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ CLI
CLIs
CMD
CNCF
configurationStore
configurationStores
ConfigurationStore
ConfigurationStores
CQRS
CRDs
CRUDL
Expand Down Expand Up @@ -166,6 +170,7 @@ cosmosAccount
cosmosdb
customizations
dapr
daprConfigurationStores
daprPubSubBrokers
daprSecretStores
daprStateStores
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
type: api
title: "Applications.Dapr/configurationStores API reference"
linkTitle: "configurationStores"
description: "Detailed reference documentation on the Applications.Dapr/configurationStores API"
slug: "configurationStores"
---

{{< redoc "swagger/specification/applications/resource-manager/Applications.Dapr/preview/2023-10-01-preview/openapi.json" >}}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
type: api
title: "Applications.Dapr/pubSubBrokers API reference"
linkTitle: "pubSubBrokers"
description: "Detailed reference documentation on the Applications.Dapr/mongoDatabases API"
description: "Detailed reference documentation on the Applications.Dapr/pubSubBrokers API"
slug: "pubSubBrokers"
---

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
---
type: docs
title: "Dapr Configuration Store resource"
linkTitle: "Configuration Store"
description: "Learn how to use Dapr Configuration Store in Radius"
weight: 300
slug: "configurationStore"
---

## Overview

An `Applications.Dapr/configurationStores` resource represents a [Dapr configuration](https://docs.dapr.io/operations/configuration/configuration-overview/) store.

## Resource format

{{< tabs Recipe Manual >}}

{{< codetab >}}

{{< rad file="snippets/dapr-configuration-recipe.bicep" embed=true marker="//SAMPLE" >}}

{{< /codetab >}}

{{< codetab >}}

{{< rad file="snippets/dapr-configuration-manual.bicep" embed=true marker="//SAMPLE" >}}

{{< /codetab >}}

{{< /tabs >}}

### Top-level

| Key | Required | Description | Example |
|------|:--------:|-------------|---------|
| name | y | The name of the configuration store. Names must contain at most 63 characters, contain only lowercase alphanumeric characters, '-', or '.', start with an alphanumeric character, and end with an alphanumeric character. | `my-config` |
| location | y | The location of your resource. See [common values]({{< ref "resource-schema.md#common-values" >}}) for more information. | `global`
| [properties](#properties) | y | Properties of the resource. | [See below](#properties)

### Properties

| Key | Required | Description | Example |
|------|:--------:|-------------|---------|
| application | n | The ID of the application resource this resource belongs to. | `app.id`
| environment | y | The ID of the environment resource this resource belongs to. | `env.id`
| [resourceProvisioning](#resource-provisioning) | n | Specifies how the underlying service/resource is provisioned and managed. Options are to provision automatically via 'recipe' or provision manually via 'manual'. Selection determines which set of fields to additionally require. Defaults to 'recipe'. | `manual`
| [recipe](#recipe) | n | Configuration for the Recipe which will deploy the backing infrastructure. | [See below](#recipe)
| [resources](#resources) | n | An array of resources which underlay this resource. For example, an Azure Redis Cache ID if the Dapr Configuration Store resource is leveraging Azure Redis Cache. | [See below](#resources)
| type | n | The Dapr component type. Set only when resourceProvisioning is 'manual'. | `configuration.redis` |
| metadata | n | Metadata object for the Dapr component. Schema must match [Dapr component](https://docs.dapr.io/reference/components-reference/supported-configuration-stores/). Set only when resourceProvisioning is 'manual'. | `{ redisHost: 'localhost:6379' }` |
| version | n | The version of the Dapr component. See [Dapr components](https://docs.dapr.io/reference/components-reference/supported-configuration-stores/) for available versions. Set only when resourceProvisioning is 'manual'. | `v1` |
| componentName | n | _(read-only)_ The name of the Dapr component that is generated and applied to the underlying system. Used by the Dapr SDKs or APIs to access the Dapr component. | `myconfig` |

#### Recipe

| Property | Required | Description | Example(s) |
|------|:--------:|-------------|---------|
| name | n | Specifies the name of the Recipe that should be deployed. If not set, the name defaults to `default`. | `name: 'azure-prod'`
| parameters | n | An object that contains a list of parameters to set on the Recipe. | `{ size: 'large' }`

#### Resources

| Property | Required | Description | Example(s) |
|----------|:--------:|-------------|------------|
| id | n | Resource ID of the supporting resource. | `account.id`

## Resource provisioning

### Provision with a Recipe

[Recipes]({{< ref "guides/recipes/overview" >}}) automate infrastructure provisioning using approved templates.

You can specify a Recipe name that is registered in the environment or omit the name and use the "default" Recipe.

Parameters can also optionally be specified for the Recipe.

### Provision manually

If you want to manually manage your infrastructure provisioning outside of Recipes, you can set `resourceProvisioning` to `'manual'` and specify `type`, `metadata`, and `version` for the Dapr component. These values must match the schema of the intended [Dapr component](https://docs.dapr.io/reference/components-reference/supported-configuration-stores/).

## Environment variables for connections

Other Radius resources, such as [containers]({{< ref "guides/author-apps/containers" >}}), may connect to a Dapr configuration store resource via [connections]({{< ref "application-graph#connections-and-injected-values" >}}). When a connection to Dapr configuration store named, for example, `myconnection` is declared, Radius injects values into environment variables that are then used to access the connected Dapr configuration store resource:

| Environment variable | Example(s) |
|----------------------|------------|
| CONNECTION_MYCONNECTION_COMPONENTNAME | `myconfig` |
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
extension radius

@description('The ID of your Radius Environment. Automatically injected by the rad CLI.')
param environment string

resource app 'Applications.Core/applications@2023-10-01-preview' = {
name: 'dapr-config'
properties: {
environment: environment
}
}

resource myapp 'Applications.Core/containers@2023-10-01-preview' = {
name: 'myapp'
properties: {
application: app.id
connections: {
daprconfig: {
source: config.id
}
}
container: {
image: 'ghcr.io/radius-project/magpiego:latest'
}
}
}

//SAMPLE
resource config 'Applications.Dapr/configurationStores@2023-10-01-preview' = {
name: 'configstore'
properties: {
environment: environment
application: app.id
resourceProvisioning: 'manual'
type: 'configuration.redis'
metadata: {
redisHost: {
value: '<REDIS-URL>'
}
redisPassword: {
value: ''
}
}
version: 'v1'
}
}
//SAMPLE
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
extension radius

@description('The ID of your Radius Environment. Automatically injected by the rad CLI.')
param environment string

resource app 'Applications.Core/applications@2023-10-01-preview' = {
name: 'dapr-configstore'
properties: {
environment: environment
}
}

//SAMPLE
resource configStore 'Applications.Dapr/configurationStores@2023-10-01-preview' = {
name: 'configstore'
properties: {
environment: environment
application: app.id
recipe: {
// Name a specific recipe to use
name: 'azure-redis-with-config'
// Set optional/required parameters (specific to the Recipe)
parameters: {
size: 'large'
}
}
}
}
//SAMPLE
17 changes: 9 additions & 8 deletions docs/content/tutorials/tutorial-recipe/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,14 +61,15 @@ Developers don't need to specify what cloud resources they're using in their app
You should see a table of available Recipes:

```
NAME TYPE TEMPLATE KIND TEMPLATE VERSION TEMPLATE
default Applications.Datastores/sqlDatabases bicep ghcr.io/radius-project/recipes/local-dev/sqldatabases:latest
default Applications.Messaging/rabbitMQQueues bicep ghcr.io/radius-project/recipes/local-dev/rabbitmqqueues:latest
default Applications.Dapr/pubSubBrokers bicep ghcr.io/radius-project/recipes/local-dev/pubsubbrokers:latest
default Applications.Dapr/secretStores bicep ghcr.io/radius-project/recipes/local-dev/secretstores:latest
default Applications.Dapr/stateStores bicep ghcr.io/radius-project/recipes/local-dev/statestores:latest
default Applications.Datastores/mongoDatabases bicep ghcr.io/radius-project/recipes/local-dev/mongodatabases:latest
default Applications.Datastores/redisCaches bicep ghcr.io/radius-project/recipes/local-dev/rediscaches:latest
NAME TYPE TEMPLATE KIND TEMPLATE VERSION TEMPLATE
default Applications.Datastores/sqlDatabases bicep ghcr.io/radius-project/recipes/local-dev/sqldatabases:latest
default Applications.Messaging/rabbitMQQueues bicep ghcr.io/radius-project/recipes/local-dev/rabbitmqqueues:latest
default Applications.Dapr/pubSubBrokers bicep ghcr.io/radius-project/recipes/local-dev/pubsubbrokers:latest
default Applications.Dapr/secretStores bicep ghcr.io/radius-project/recipes/local-dev/secretstores:latest
default Applications.Dapr/stateStores bicep ghcr.io/radius-project/recipes/local-dev/statestores:latest
default Applications.Datastores/mongoDatabases bicep ghcr.io/radius-project/recipes/local-dev/mongodatabases:latest
default Applications.Datastores/redisCaches bicep ghcr.io/radius-project/recipes/local-dev/rediscaches:latest
default Applications.Datastores/configurationStores bicep ghcr.io/radius-project/recipes/local-dev/configurationStores:latest
```

{{< alert title="💡 local-dev Recipes" color="info" >}}
Expand Down

0 comments on commit 9c94c92

Please sign in to comment.