Skip to content

Commit

Permalink
Address feedbcak
Browse files Browse the repository at this point in the history
  • Loading branch information
Reshrahim committed Sep 18, 2023
1 parent f082c5f commit d09aa27
Show file tree
Hide file tree
Showing 27 changed files with 537 additions and 275 deletions.
2 changes: 1 addition & 1 deletion docs/content/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ Radius extends strong existing tools to further streamline the app developer exp
<a href="{{< ref getting-started >}}"><img src="vscode-logo.png" alt="Visual Studio Code logo" style="width:80%"></a>
</td>
<td style="width:50%;text-align:center">
<a href="{https://learn.microsoft.com/azure/azure-resource-manager/bicep/}" target="_blank"><img src="bicep-logo.png" alt="Bicep logo" style="width:70%"></a>
<a href="{{< ref bicep >}}" target="_blank"><img src="bicep-logo.png" alt="Bicep logo" style="width:70%"></a>
</td>
</tr>
</table>
Expand Down
2 changes: 1 addition & 1 deletion docs/content/concepts/overview/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ With the Radius app model, teams can easily codify and share pieces of an applic

{{< /tabs >}}

Radius uses the [Bicep language](https://learn.microsoft.com/en-us/azure/azure-resource-manager/bicep/) as its file-format and structure. It offers:
Radius uses the [Bicep language]({{< ref bicep >}}) as its file-format and structure. It offers:

- A high quality authoring experience with modules, loops, parametrization, and templating
- ARM Deployment Stacks as the declarative deployment/rollback mechanism
Expand Down
2 changes: 1 addition & 1 deletion docs/content/getting-started/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ iwr -useb "https://get.radapp.dev/tools/rad/install.ps1" | iex

{{< /tabs >}}

Visit the [rad CLI]({{< ref "installation/overview#install-the-rad-cli" >}}) page for troubleshooting or additional options.
Visit the [rad CLI]({{< ref howto-rad-cli >}}) page for troubleshooting or additional options.

Verify the rad CLI is installed correctly by running `rad version`.

Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
32 changes: 13 additions & 19 deletions docs/content/guides/author-apps/application/overview/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,44 +2,38 @@
type: docs
title: "Overview: Radius applications"
linkTitle: "Overview"
description: "Learn about Radius applications and how they bring all of your services, dependencies, and relationships together."
description: "Learn about Radius applications"
weight: 100
categories: "Overview"
tags: ["applications"]
---

<img src="application.png" alt="Diagram of an application" width=350px >
## Overview

A Radius application is the primary resource that brings all your "stuff" together. This can include services, dependencies, and relationships. Radius apps give you a single description and view into your entire application, and allow you to deploy and manage it easily.
An [application]({{< ref application-graph>}}) is the primary resource that contains all of your services and relationships.

## Add portability to your application
Because Radius has all the relationships and requirements of an application, deployments and configurations are simplified. Developers no longer need to specify all the identity, networking, or other configuration that is normally required, and operators don't need to write custom deployment scripts.

Radius applications are designed to be cloud and platform agnostic. This means that you can define your application once, and deploy it to any cloud or platform that Radius supports. This allows you to easily move your application between clouds, or even between cloud and on-premises environments. Developers can define their requirements and dependencies (_Redis, SQL, Dapr, etc._) and operators can define the [environments]({{< ref "guides/deploy-apps/environments/overview" >}}) and [Recipes]({{< ref "guides/recipes/overview" >}}) that bind those requirements to the appropriate cloud resources.
For example, if you want a container to read from an Azure Storage Account without using Radius, this normally requires creating managed identities, RBAC roles, identity federation, Kubernetes service accounts, and more. With Radius, developers can define a single [connection]({{< ref "guides/author-apps/containers/overview#connections" >}}) from their container to a Storage Account, and Radius sets up all the required configuration automatically.

<img src="portable-resources.png" alt="Diagram of portable resources binding to different clouds" width=600px >
<img src="graph-automation.png" alt="A diagram showing a connection from a Radius container to an Azure storage account resulting in managed identities, role-based access control, and CSI drivers." width=600px >

Learn more about portable resources in the [portable resources docs]({{< ref "guides/author-apps/portable-resources/overview" >}}) and [Dapr docs]({{< ref "guides/author-apps/dapr/overview" >}})

## Customize your application with extensions
## Extensions

Extensions allow you to customize how resources are generated or customized as part of deployment.

### Kubernetes Namespace extension

The Kubernetes namespace extension allows you to customize how all of the resources within your application generate Kubernetes resources. See the [Kubernetes mapping guide]({{< ref kubernetes-mapping >}}) for more information on namespace mapping behavior.
The Kubernetes namespace extension allows you to customize how all of the resources within your application generate Kubernetes resources. See the [Kubernetes mapping guide]({{< ref kubernetes-mapping >}}) for more information on namespace mapping behavior

### Kubernetes Metadata extension

The [Kubernetes Metadata extension]({{< ref "guides/operations/kubernetes/kubernetes-metadata">}}) enables you set and cascade Kubernetes metadata such as labels and Annotations on all the Kubernetes resources defined with in your Radius application.

## Query and understand your application with the Radius Application Graph

Radius applications are more than just client-side configuration and automation, they also provide a server-side graph of your application. This graph can be queried and used to understand your application, and can be used to power other Radius features and custom tooling. Refer to the [API concept docs]({{< ref "api-concept" >}}) and [Postman How-To guide]({{< ref "guides/operations/control-plane/howto-postman" >}}) for more information on how to query the application graph.

<img src="app-graph.png" alt="Diagram of the application graph" width=500px >
The [Kubernetes Metadata extension]({{< ref "guides/operations/kubernetes/kubernetes-metadata">}}) enables you set and cascade Kubernetes metadata such as labels and Annotations on all the Kubernetes resources defined with in your Radius application

## Resource schema

Refer to the [application schema docs]({{< ref application-schema >}}) for more information on how to define an application.
- [Application schema]({{< ref application-schema >}})

## Further reading

{{< button text="📄 Application schema" page="application-schema" >}}
Refer to the [applications]({{< ref "/tags/applications" >}}) tag for more guides on the application resource.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
82 changes: 82 additions & 0 deletions docs/content/guides/author-apps/dapr/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
---
type: docs
title: "Dapr building blocks"
linkTitle: "Dapr"
description: "Easily leverage Dapr building blocks in your application for code and infrastructure portability"
weight: 500
slug: "dapr"
categories: "Concept"
tags: ["Dapr"]
---

Radius offers first-class support for the [Dapr](https://dapr.io) runtime and building blocks to make it easy to make your code fully portable across code and infrastructure. Simply drop in your Dapr building blocks as resources and Radius will automatically configure and apply the accompanying Dapr configuration.

## Installation

Follow the [Dapr installation instructions](https://docs.dapr.io/operations/hosting/kubernetes/kubernetes-deploy/) to install Dapr in your Kubernetes cluster. Once installed, you can begin adding Dapr sidecars and building blocks.

{{< button text="Setup Dapr" link="https://docs.dapr.io/operations/hosting/kubernetes/kubernetes-deploy/" newtab="true" >}}

## Sidecar

A [Dapr sidecar](https://docs.dapr.io/concepts/dapr-services/sidecar/) allows your services to interact with Dapr building blocks. It is required if your service leverages Dapr.

<img src="dapr-sidecar.png" style="width:600px" alt="Diagram of the Dapr sidecar" /><br />

You can easily add the Dapr sidecar to your [Containers]({{< ref "guides/author-apps/containers" >}}) using a Dapr sidecar extension:

{{< tabs Bicep >}}

{{% codetab %}}
{{< rad file="snippets/sidecar.bicep" embed=true marker="//CONTAINER" >}}
{{% /codetab %}}

{{< /tabs >}}

Your container can now interact with the sidecar using the Dapr [building block APIs](https://docs.dapr.io/concepts/building-blocks-concept/) or the [Dapr SDKs](https://docs.dapr.io/developing-applications/sdks/).

## Building blocks

Dapr resources make it easy to model and configure [Dapr building block APIs](https://docs.dapr.io/developing-applications/building-blocks/). Simply specify the building block and the backing resource, and Radius will apply the accompanying Dapr component configuration.

<img src="dapr-buildingblocks.png" style="width:1000px" alt="Diagram of all the Dapr building blocks" /><br />

Model your building blocks as resources:

{{< tabs Bicep >}}

{{< codetab >}}
{{< rad file="snippets/statestore.bicep" embed=true marker="//STATESTORE" >}}
{{< /codetab >}}

{{< /tabs >}}

### Component naming

To interact with a Dapr building block, you need to know the name of the [Dapr component](https://docs.dapr.io/concepts/components-concept/). This name is the same as the name of the building block resource.

For example, if you have a `Applications.Dapr/stateStores` resource named `mystatestore` the Dapr component name will be `mystatestore`. Your code will then interact with this component via `http://localhost:3500/v1.0/state/mystatestore`, or via the Dapr SDKs through the `mystatestore` component name.

### Connecting to Dapr building blocks

You can connect to a Dapr building block by manually referencing the resource name or by adding a connection. Connections automatically inject environment variables into your container with the resource name prefixed.

{{< rad file="snippets/dapr-componentname.bicep" embed=true marker="//MARKER" replace-key-ss="//STATESTORE" replace-value-ss="resource statestore 'Applications.Dapr/stateStores@2022-03-15-privatepreview' = {...}" >}}

### Service invocation

Dapr [service invocation](https://docs.dapr.io/developing-applications/building-blocks/service-invocation/service-invocation-overview/) allows your services to discover and call each other.

One container in an application can invoke another using the `AppId`.

{{< tabs Bicep >}}

{{< codetab >}}
{{< rad file="snippets/service-invocation.bicep" embed=true marker="//INVOKE" >}}
{{< /codetab >}}

{{< /tabs >}}

## Resource schema

Refer to the [schema reference docs]({{< ref dapr-schema >}}) for more information on how to model Dapr resources.
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
import radius as rad

param environment string

resource account 'Microsoft.Storage/storageAccounts@2019-06-01' existing = {
name: 'myaccount'

resource tableServices 'tableServices' existing = {
name: 'default'

resource table 'tables' existing = {
name: 'mytable'
}
}
}

resource app 'Applications.Core/applications@2022-03-15-privatepreview' = {
name: 'myapp'
properties: {
environment: environment
}
}

//MARKER
resource container 'Applications.Core/containers@2022-03-15-privatepreview' = {
name: 'mycontainer'
properties: {
application: app.id
container: {
image: 'myimage'
env: {
// Option 1: Manually set component name as an environment variable
DAPR_COMPONENTNAME: statestore.name
}
}
connections: {
// Option 2 (preferred): Automatically set environment variable with component name
c1: {
source: statestore.id // Results in CONNECTION_C1_COMPONENTNAME
}
}
}
}

//STATESTORE
resource statestore 'Applications.Dapr/stateStores@2022-03-15-privatepreview' = {
name: 'mystatestore'
properties: {
environment: environment
application: app.id
resourceProvisioning: 'manual'
resources: [
{ id: account.id }
{ id: account::tableServices::table.id }
]
metadata: {
accountName: account.name
accountKey: account.listKeys().keys[0].value
tableName: account::tableServices::table.name
}
type: 'state.azure.tablestorage'
version: 'v1'
}
}
//STATESTORE
//MARKER
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import radius as rad


resource app 'Applications.Core/applications@2022-03-15-privatepreview' existing = {
name: 'myapp'
}

// Backend is being invoked through service invocation
resource backend 'Applications.Core/containers@2022-03-15-privatepreview' = {
name: 'backend'
properties: {
application: app.id
container: {
image: 'backend:latest'
}
extensions: [
{
kind: 'daprSidecar'
appId: 'backend'
}
]
}
}


// Frontend invokes backend
resource frontend 'Applications.Core/containers@2022-03-15-privatepreview' = {
name: 'frontend'
properties: {
application: app.id
container: {
image: 'frontend:latest'
env: {
// Configures the appID of the backend service.
CONNECTION_BACKEND_APPID: 'backend'
}
}
extensions: [
{
kind: 'daprSidecar'
appId: 'frontend'
}
]
}
}
29 changes: 29 additions & 0 deletions docs/content/guides/author-apps/dapr/snippets/sidecar.bicep
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import radius as radius

param environment string

resource app 'Applications.Core/applications@2022-03-15-privatepreview' = {
name: 'myapp'
properties: {
environment: environment
}
}

//CONTAINER
resource container 'Applications.Core/containers@2022-03-15-privatepreview' = {
name: 'mycontainer'
properties: {
application: app.id
container: {
image: 'myimage'
}
extensions: [
{
kind: 'daprSidecar'
appId: 'mycontainer'
appPort: 3500
}
]
}
}
//CONTAINER
46 changes: 46 additions & 0 deletions docs/content/guides/author-apps/dapr/snippets/statestore.bicep
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
import radius as radius

param environment string


resource app 'Applications.Core/applications@2022-03-15-privatepreview' = {
name: 'myapp'
properties: {
environment: environment
}
}

//STATESTORE
resource account 'Microsoft.Storage/storageAccounts@2019-06-01' existing = {
name: 'myaccount'

resource tableServices 'tableServices' existing = {
name: 'default'

resource table 'tables' existing = {
name: 'mytable'
}
}
}

// The accompanying Dapr component resource is automatically created for you
resource stateStore 'Applications.Dapr/stateStores@2022-03-15-privatepreview' = {
name: 'mystatestore'
properties: {
environment: environment
application: app.id
resourceProvisioning: 'manual'
resources: [
{ id: account.id }
{ id: account::tableServices::table.id }
]
metadata: {
accountName: account.name
accountKey: account.listKeys().keys[0].value
tableName: account::tableServices::table.name
}
type: 'state.azure.tablestorage'
version: 'v1'
}
}
//STATESTORE
Loading

0 comments on commit d09aa27

Please sign in to comment.