Skip to content

Commit

Permalink
address feedback
Browse files Browse the repository at this point in the history
Signed-off-by: Will Tsai <[email protected]>
  • Loading branch information
willtsai committed Aug 8, 2023
1 parent e7440a4 commit 27771d8
Show file tree
Hide file tree
Showing 8 changed files with 80 additions and 43 deletions.
6 changes: 4 additions & 2 deletions docs/content/concepts/application-graph/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,11 @@ For example, if you want a container to read from an Azure Storage Account witho

### Connections and injected values

The mechanism behind this automated application deployment is injected values into environment variables. When a connection between two resources is declared, Radius injects resource related information into environment variables that are then used to access the respective resource without having to hard code URIs, connection strings, access keys, or anything that application code needs to successfully communicate. Refer to the [reference documentation]({{< ref resource-schema >}}) of each resource for more information.
When a connection between two resources is declared, Radius injects resource related information into environment variables that are then used to access the respective resource without having to hard code URIs, connection strings, access keys, or anything that application code needs to successfully communicate.

These environment variables follow a naming convention that makes their use predictable. The naming pattern is derived from the connection name and resource type, which determines what values are required. This way the code that needs to read the values gets to define how they are named. For example, adding a connection called `myconnection` that connects to a MongoDB resource would result in the following environment variables being injected:
These environment variables follow a naming convention that makes their use predictable. The naming pattern is derived from the connection name and resource type, which determines what values are required. This way the code that needs to read the values gets to define how they are named. Refer to the [reference documentation]({{< ref resource-schema >}}) of each resource for more information.

For example, adding a connection called `myconnection` that connects to a MongoDB resource would result in the following environment variables being injected:

```sh
# the connection string to the resource
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ The `redislabs.com/Redis` link is a [portable link]({{< ref links-resources >}})

| Property | Required | Description | Example(s) |
|----------|:--------:|-------------|------------|
| connectionString | n | The connection string for the Redis cache. Write only. | `https://mycache.redis.cache.windows.net,password=*****,....`
| connectionString | n | The connection string for the Redis cache. Write only. | `contoso5.redis.cache.windows.net,ssl=true,password=...`
| password | n | The password for the Redis cache. Write only. | `mypassword`
| url | n | The connection URL for the Redis cache. Set automatically based on the values provided for `host`, `port`, `username`, and `password`. Can be explicitly set to override default behavior. Write only. | `redis://username:password@localhost:6380/0?ssl=true` |

Expand All @@ -94,10 +94,14 @@ If you want to manually manage your infrastructure provisioning without the use

## Environment variables for connections

Other Radius resources, such as [containers]({{< ref "container" >}}), may connect to a Redis resource via [connections]({{< ref "application-graph#connections-and-injected-values" >}}). When a connection to Redis is declared, Radius injects values into environment variables that are then used to access the connected Redis resource:

| Environment variable | Description | Example(s) |
|----------------------|-------------|------------|
| CONNECTION_MYCONNECTION_USERNAME | The username for the Redis cache. | `admin` |
| CONNECTION_MYCONNECTION_CONNECTIONSTRING | The connection string for the Redis cache. | `https://mycache.redis.cache.windows.net,password=*****,....` |
| CONNECTION_MYCONNECTION_PASSWORD | The password for the Redis cache. | `mypassword` |
Other Radius resources, such as [containers]({{< ref "container" >}}), may connect to a Redis resource via [connections]({{< ref "application-graph#connections-and-injected-values" >}}). When a connection to Redis named, for example, `myconnection` is declared, Radius injects values into environment variables that are then used to access the connected Redis resource:

| Environment variable | Example(s) |
|----------------------|------------|
| CONNECTION_MYCONNECTION_HOST | `mycache.redis.cache.windows.net` |
| CONNECTION_MYCONNECTION_PORT | `6379` |
| CONNECTION_MYCONNECTION_TLS | `true` |
| CONNECTION_MYCONNECTION_USERNAME | `admin` |
| CONNECTION_MYCONNECTION_CONNECTIONSTRING | `contoso5.redis.cache.windows.net,ssl=true,password=...` |
| CONNECTION_MYCONNECTION_PASSWORD | `mypassword` |
| CONNECTION_MYCONNECTION_URL | `redis://username:password@localhost:6380/0?ssl=true` |
Original file line number Diff line number Diff line change
Expand Up @@ -76,4 +76,12 @@ 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-pubsub/).
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-pubsub/).

## Environment variables for connections

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

| Environment variable | Example(s) |
|----------------------|------------|
| CONNECTION_MYCONNECTION_COMPONENTNAME | `myapp-mypubsub` |
Original file line number Diff line number Diff line change
Expand Up @@ -74,4 +74,12 @@ When no Recipe configuration is set Radius will use the Recipe registered as the

### Provision manually

If you want to manually manage your infrastructure provisioning outside of Recipes, you can set `resourceProvisioning` to `'manual'` and provide all necessary parameters and values the enable Radius to deploy or connect to the desired infrastructure.
If you want to manually manage your infrastructure provisioning outside of Recipes, you can set `resourceProvisioning` to `'manual'` and provide all necessary parameters and values the enable Radius to deploy or connect to the desired infrastructure.

## Environment variables for connections

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

| Environment variable | Example(s) |
|----------------------|------------|
| CONNECTION_MYCONNECTION_COMPONENTNAME | `mysecretstore` |
Original file line number Diff line number Diff line change
Expand Up @@ -76,4 +76,12 @@ When no Recipe configuration is set Radius will use the Recipe registered as the

### Provision manually

If you want to manually manage your infrastructure provisioning outside of Recipes, you can set `resourceProvisioning` to `'manual'` and provide all necessary parameters and values and values that enable Radius to deploy or connect to the desired infrastructure.
If you want to manually manage your infrastructure provisioning outside of Recipes, you can set `resourceProvisioning` to `'manual'` and provide all necessary parameters and values and values that enable Radius to deploy or connect to the desired infrastructure.

## Environment variables for connections

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

| Environment variable | Example(s) |
|----------------------|------------|
| CONNECTION_MYCONNECTION_COMPONENTNAME | `mystatestore` |
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ This application showcases how Radius can use a user-manged Azure SQL Database.
| [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 IDs of the underlying resources for the link. | [See below](#resources)
| server | n | The fully qualified domain name of the SQL server. | `sql.hello.com`
| database | n | The name of the SQL database. | `5000`
| server | n | The fully qualified domain name of the SQL server. | `mydatabase.database.windows.net`
| database | n | The name of the SQL database. | `mydatabase`
| port | n | The SQL database port. | `1433`
| username | n | The username for the SQL database. | `'myusername'`
| [secrets](#secrets) | n | Secrets used when building the link from values. | [See below](#secrets)
Expand All @@ -55,8 +55,8 @@ This application showcases how Radius can use a user-manged Azure SQL Database.

| Property | Required | Description | Example(s) |
|----------|:--------:|-------------|------------|
| connectionString | n | The connection string for the SQL database. Write only. | `'https://mysqlserver.cluster.svc.local,password=*****,....'`
| password | n | The password for the SQL database. Write only. | `'mypassword'`
| connectionString | n | The connection string for the SQL database. Write only. | `Server=<server>.mysql.database.azure.com;Port=<port>;Database=<database>;UID=<username>;PWD=<password>`
| password | n | The password for the SQL database. Write only. | `mypassword`

#### Recipe

Expand Down Expand Up @@ -84,12 +84,13 @@ If you want to manually manage your infrastructure provisioning outside of Recip

## Environment variables for connections

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

| Environment variable | Description | Example(s) |
|----------------------|-------------|------------|
| CONNECTION_MYCONNECTION_DATABASE | The name of the target Azure SQL database. | `mydatabase` |
| CONNECTION_MYCONNECTION_SERVER | The fully qualified domain name of the target Azure SQL server. | `sql.hello.com` |
| CONNECTION_MYCONNECTION_USERNAME | The username for the target Azure SQL database. | `admin` |
| CONNECTION_MYCONNECTION_PASSWORD | The password for the target Azure SQL database. | `mypassword` |
| CONNECTION_MYCONNECTION_CONNECTIONSTRING | The connection string for the target Azure SQL database. | `https://mysqlserver.cluster.svc.local,password=*****,....` |
| Environment variable | Example(s) |
|----------------------|------------|
| CONNECTION_MYCONNECTION_DATABASE | `mydatabase` |
| CONNECTION_MYCONNECTION_SERVER | `mydatabase.database.windows.net` |
| CONNECTION_MYCONNECTION_PORT | `1433` |
| CONNECTION_MYCONNECTION_USERNAME | `myusername` |
| CONNECTION_MYCONNECTION_PASSWORD | `mypassword` |
| CONNECTION_MYCONNECTION_CONNECTIONSTRING | `Server=<server>.mysql.database.azure.com;Port=<port>;Database=<database>;UID=<username>;PWD=<password>` |
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ The `mongodb.com/MongoDatabase` link is a [portable link]({{< ref links-resource
| [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 CosmosDB database ID if the MongoDB resource is leveraging CosmosDB. | [See below](#resources)
| database | n | Database name of the target MongoDB | `mongodb-prod`
| host | n | The MongoDB host name. | `mongo.hello.com`
| host | n | The MongoDB host name. | `mongodb://mongodb0.example.com:4242`
| port | n | The MongoDB port. | `4242`
| username | n | The username for the MongoDB. | `'myusername'`
| [secrets](#secrets) | n | Secrets used when building the link from values. | [See below](#secrets)
Expand All @@ -67,8 +67,8 @@ The `mongodb.com/MongoDatabase` link is a [portable link]({{< ref links-resource

| Property | Required | Description | Example(s) |
|----------|:--------:|-------------|------------|
| connectionString | n | The connection string for the MongoDb. Write only. | `'https://mymongo.cluster.svc.local,password=*****,....'`
| password | n | The password for the MongoDB. Write only. | `'mypassword'`
| connectionString | n | The connection string for the MongoDb. Write only. | `mongodb://[username:password@]host1[:port1][,...hostN[:portN]][/[defaultauthdb][?options]]`
| password | n | The password for the MongoDB. Write only. | `mypassword`

### Methods

Expand All @@ -95,11 +95,13 @@ If you want to manually manage your infrastructure provisioning outside of Recip

## Environment variables for connections

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

| Environment variable | Description | Example(s) |
|----------------------|-------------|------------|
| CONNECTION_MYCONNECTION_DATABASE | Name of the target Mongo database | `mongodb-prod` |
| CONNECTION_MYCONNECTION_USERNAME | Username for the target Mongo database | `myusername` |
| CONNECTION_MYCONNECTION_PASSWORD | Password for the target Mongo database | `mypassword` |
| CONNECTION_MYCONNECTION_CONNECTIONSTRING | Connection string for the target Mongo database | `https://mymongo.cluster.svc.local,password=*****,....` |
| Environment variable | Example(s) |
|----------------------|------------|
| CONNECTION_MYCONNECTION_HOST | `mongodb://mongodb0.example.com:4242` |
| CONNECTION_MYCONNECTION_PORT | `4242` |
| CONNECTION_MYCONNECTION_DATABASE | `mongodb-prod` |
| CONNECTION_MYCONNECTION_USERNAME | `myusername` |
| CONNECTION_MYCONNECTION_PASSWORD | `mypassword` |
| CONNECTION_MYCONNECTION_CONNECTIONSTRING | `mongodb://[username:password@]host1[:port1][,...hostN[:portN]][/[defaultauthdb][?options]]` |
Original file line number Diff line number Diff line change
Expand Up @@ -88,11 +88,15 @@ If you want to manually manage your infrastructure provisioning outside of Recip

## Environment variables for connections

Other Radius resources, such as [containers]({{< ref "container" >}}), may connect to a RabbitMQ resource via [connections]({{< ref "application-graph#connections-and-injected-values" >}}). When a connection to RabbitMQ is declared, Radius injects values into environment variables that are then used to access the connected RabbitMQ resource:

| Environment variable | Description | Example(s) |
|----------------------|-------------|------------|
| CONNECTION_MYCONNECTION_QUEUE | The name of the target RabbitMQ queue. | `'orders'` |
| CONNECTION_MYCONNECTION_USERNAME | The username for the target RabbitMQ queue. | `'guest'` |
| CONNECTION_MYCONNECTION_CONNECTIONSTRING | The connection string to the target RabbitMQ queue. | `'amqp://guest:***@rabbitmq.svc.local.cluster:5672'` |
| CONNECTION_MYCONNECTION_PASSWORD | The password for the target RabbitMQ queue. | `'password'` |
Other Radius resources, such as [containers]({{< ref "container" >}}), may connect to a RabbitMQ resource via [connections]({{< ref "application-graph#connections-and-injected-values" >}}). When a connection to RabbitMQ named, for example, `myconnection` is declared, Radius injects values into environment variables that are then used to access the connected RabbitMQ resource:

| Environment variable | Example(s) |
|----------------------|------------|
| CONNECTION_MYCONNECTION_QUEUE | `'orders'` |
| CONNECTION_MYCONNECTION_HOST | `'rabbitmq.svc.local.cluster'` |
| CONNECTION_MYCONNECTION_PORT | `'5672'` |
| CONNECTION_MYCONNECTION_VHOST | `'qa1'` | <!-- [Title](https://www.rabbitmq.com/vhosts.html) -->
| CONNECTION_MYCONNECTION_USERNAME | `'guest'` |
| CONNECTION_MYCONNECTION_TLS | `'true'` |
| CONNECTION_MYCONNECTION_CONNECTIONSTRING | `'amqp://${username}:${password}@${rmqContainer.properties.hostname}:${rmqContainer.properties.port}'` |
| CONNECTION_MYCONNECTION_PASSWORD | `'password'` |

0 comments on commit 27771d8

Please sign in to comment.