Skip to content

Commit

Permalink
use CLI-injected app IDs in dapr tutorial
Browse files Browse the repository at this point in the history
Signed-off-by: Will Tsai <[email protected]>
  • Loading branch information
willtsai committed Oct 25, 2023
1 parent c4d3992 commit ce7bf4f
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 13 deletions.
25 changes: 21 additions & 4 deletions docs/content/tutorials/tutorial-dapr/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,26 @@ For more details on the app and access to the source code, visit the `tutorials/

- [rad CLI]({{< ref "installation#step-1-install-the-rad-cli" >}})
- [Radius Bicep VSCode extension]({{< ref "installation#step-2-install-the-vs-code-extension" >}})
- [Radius environment]({{< ref "installation#step-3-initialize-radius" >}})
- [Setup a supported Kubernetes cluster](https://docs.radapp.io/guides/operations/kubernetes/overview/#supported-clusters)
- [Dapr installed on your Kubernetes cluster](https://docs.dapr.io/operations/hosting/kubernetes/kubernetes-deploy/)

## Step 1: Initialize a Radius Environment

1. Begin in a new directory for your application:

```bash
mkdir rad-dapr
cd rad-dapr
```

2. Initialize a new dev environment:

*Select 'Yes' when prompted to create an application.*

```bash
rad init
```

## Step 1: Define the application, `backend` container, and Dapr state store

Begin by creating a new file named `dapr.bicep` with a Radius Application that consists of a `backend` container and Dapr state store with Redis:
Expand Down Expand Up @@ -102,12 +119,12 @@ In your browser, navigate to the endpoint (e.g. [http://localhost:8080](http://l

## Cleanup

1. Press CTRL+C to terminate the `rad run` log console
1. Press `CTRL`+`C` to terminate the log console

1. Run `rad app delete` to cleanup your Radius Application, containers, and Dapr statestore. The Recipe resources (_Redis container and Dapr component_) are also automatically cleaned up.
1. Run the following command to cleanup your Radius Application, containers, and Dapr statestore. The Recipe resources (_Redis container and Dapr component_) are also automatically cleaned up.

```bash
rad app delete -a dapr
rad app delete
```

## Next steps
Expand Down
14 changes: 5 additions & 9 deletions docs/content/tutorials/tutorial-dapr/snippets/dapr.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,14 @@ import radius as radius
@description('Specifies the environment for resources.')
param environment string

resource app 'Applications.Core/applications@2023-10-01-preview' = {
name: 'dapr'
properties: {
environment: environment
}
}
@description('The ID of your Radius Application. Automatically injected by the rad CLI.')
param application string

// The backend container that is connected to the Dapr state store
resource backend 'Applications.Core/containers@2023-10-01-preview' = {
name: 'backend'
properties: {
application: app.id
application: application
container: {
// This image is where the app's backend code lives
image: 'radius.azurecr.io/samples/dapr-backend:latest'
Expand Down Expand Up @@ -46,7 +42,7 @@ resource stateStore 'Applications.Dapr/stateStores@2023-10-01-preview' = {
properties: {
// Provision Redis Dapr state store automatically via the default Radius Recipe
environment: environment
application: app.id
application: application
}
}
//BACKEND
Expand All @@ -56,7 +52,7 @@ resource stateStore 'Applications.Dapr/stateStores@2023-10-01-preview' = {
resource frontend 'Applications.Core/containers@2023-10-01-preview' = {
name: 'frontend'
properties: {
application: app.id
application: application
container: {
// This image is where the app's frontend code lives
image: 'radius.azurecr.io/samples/dapr-frontend:latest'
Expand Down

0 comments on commit ce7bf4f

Please sign in to comment.