From 0e4e903e7cc8a9864249a7b260df2fc47dc8d5be Mon Sep 17 00:00:00 2001 From: jasonviviano <83607984+jasonviviano@users.noreply.github.com> Date: Mon, 27 Nov 2023 18:52:58 +0000 Subject: [PATCH] Added the steps to deploy the app with the sidecar to the docs based on the tutorial guide. Signed-off-by: jasonviviano <83607984+jasonviviano@users.noreply.github.com> --- .../dapr/how-to-dapr-sidecar/index.md | 27 +++++++++++++---- .../snippets/app-sidecar.bicep | 30 ++++++++++--------- .../how-to-dapr-sidecar/snippets/app.bicep | 26 ---------------- 3 files changed, 38 insertions(+), 45 deletions(-) delete mode 100644 docs/content/guides/author-apps/dapr/how-to-dapr-sidecar/snippets/app.bicep diff --git a/docs/content/guides/author-apps/dapr/how-to-dapr-sidecar/index.md b/docs/content/guides/author-apps/dapr/how-to-dapr-sidecar/index.md index ff5f99d8e..300208157 100644 --- a/docs/content/guides/author-apps/dapr/how-to-dapr-sidecar/index.md +++ b/docs/content/guides/author-apps/dapr/how-to-dapr-sidecar/index.md @@ -21,9 +21,7 @@ This how-to guide will provide an overview of how to: ## Step 1: Define a container -Begin by creating a file named `app.bicep` with a Radius [container]({{< ref "guides/author-apps/containers" >}}): - -{{< rad file="snippets/app.bicep" embed=true >}} +Begin by creating a file named `app.bicep` with a Radius [container]({{< ref "guides/author-apps/containers" >}}) ## Step 2: Define the Dapr sidecar extension @@ -42,18 +40,37 @@ You'll need the following information `appId`, `appPort` and any additional `con 1. Deploy and run your app: ```bash - rad run ./app.bicep -a demo + rad deploy ./app.bicep -a demo + ``` + + Your console output should look similar to: + + ``` + Building ./app.bicep... + Deploying template './app.bicep' for application 'demo' and environment 'default' from workspace 'default'... + + Deployment In Progress... + + ... backend Applications.Core/containers + + Deployment Complete + + Resources: + backend Applications.Core/containers ``` +You've now deployed a Radius container with an extension connection to a Dapr sidecar! + ## Cleanup Run the following command to [delete]({{< ref "guides/deploy-apps/howto-delete" >}}) your app and container: ```bash - rad app delete demo + rad app delete -a demo ``` ## Further reading +- [Radius Dapr tutorial]({{< ref "tutorials/tutorial-dapr" >}}) - [Dapr in Radius containers]({{< ref "guides/author-apps/containers/overview#kubernetes" >}}) - [Dapr sidecar schema]({{< ref "reference/resource-schema/dapr-schema/extension/" >}}) \ No newline at end of file diff --git a/docs/content/guides/author-apps/dapr/how-to-dapr-sidecar/snippets/app-sidecar.bicep b/docs/content/guides/author-apps/dapr/how-to-dapr-sidecar/snippets/app-sidecar.bicep index 7d321f06a..4d0c1c77f 100644 --- a/docs/content/guides/author-apps/dapr/how-to-dapr-sidecar/snippets/app-sidecar.bicep +++ b/docs/content/guides/author-apps/dapr/how-to-dapr-sidecar/snippets/app-sidecar.bicep @@ -1,24 +1,26 @@ import radius as radius -@description('Specifies the environment for resources.') -param environment string +@description('The ID of your Radius Application. Automatically injected by the rad CLI.') +param application string -resource app 'Applications.Core/applications@2023-10-01-preview' = { - name: 'demo' +// The backend container that runs the Dapr sidecar +resource backend 'Applications.Core/containers@2023-10-01-preview' = { + name: 'backend' properties: { - environment: environment - } -} - -resource demo 'Applications.Core/containers@2023-10-01-preview' = { - name: 'demo' - properties: { - application: app.id - container: {...} + application: application + container: { + // This image is where the app's backend code lives + image: 'ghcr.io/radius-project/samples/dapr-backend:latest' + ports: { + orders: { + containerPort: 3000 + } + } + } extensions: [ { kind: 'daprSidecar' - appId: 'demo' + appId: 'backend' appPort: 3000 } ] diff --git a/docs/content/guides/author-apps/dapr/how-to-dapr-sidecar/snippets/app.bicep b/docs/content/guides/author-apps/dapr/how-to-dapr-sidecar/snippets/app.bicep deleted file mode 100644 index cf50f3d4b..000000000 --- a/docs/content/guides/author-apps/dapr/how-to-dapr-sidecar/snippets/app.bicep +++ /dev/null @@ -1,26 +0,0 @@ -import radius as radius - -@description('Specifies the environment for resources.') -param environment string - -resource app 'Applications.Core/applications@2023-10-01-preview' = { - name: 'demo' - properties: { - environment: environment - } -} - -resource demo 'Applications.Core/containers@2023-10-01-preview' = { - name: 'demo' - properties: { - application: app.id - container: { - image: 'ghcr.io/radius-project/samples/demo:latest' - ports: { - web: { - containerPort: 3000 - } - } - } - } -}