Skip to content

[DRAFT] Dapr content #894

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
May 17, 2024
Merged

[DRAFT] Dapr content #894

merged 6 commits into from
May 17, 2024

Conversation

IEvangelist
Copy link
Member

@IEvangelist IEvangelist commented May 14, 2024

* add draft intro

Signed-off-by: Hannah Hunter <hannahhunter@microsoft.com>

* intro tweaks

Signed-off-by: Hannah Hunter <hannahhunter@microsoft.com>

* edits to the intro

Signed-off-by: Hannah Hunter <hannahhunter@microsoft.com>

* Apply suggestions from code review

---------

Signed-off-by: Hannah Hunter <hannahhunter@microsoft.com>
Co-authored-by: David Pine <david.pine@microsoft.com>
@IEvangelist IEvangelist changed the base branch from main to ga-build May 17, 2024 14:47
* adds .net aspire & dapr documentation

* add dapr init instructions

* Apply suggestions from code review

* Apply suggestions from code review

* Update docs/frameworks/dapr.md

* Update docs/frameworks/dapr.md

* Update dapr.md

* Update dapr.md

---------

Co-authored-by: Nico Vermeir <136470992+NVermeir@users.noreply.github.com>
Co-authored-by: David Pine <david.pine@microsoft.com>
@IEvangelist IEvangelist marked this pull request as ready for review May 17, 2024 14:57
@IEvangelist IEvangelist merged commit eef29ae into ga-build May 17, 2024
6 checks passed
@IEvangelist IEvangelist deleted the dapr-bits branch May 17, 2024 18:11
### [.NET CLI](#tab/dotnet-cli)

```dotnetcli
dotnet add package Aspire.Hosting.Dapr

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At least prior to GA, you'll need the prerelease flag too, I think?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@IEvangelist will this be published once this is GA?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, this goes live tomorrow morning, just before //build.


:::code language="csharp" source="snippets/Dapr/Dapr.AppHost/Program.cs" range="4":::

Dapr uses the Sidecar pattern to run alongside your application. The Dapr sidecar is a lightweight, portable, and stateless HTTP server that listens for incoming HTTP requests from your application. The sidecar is responsible for managing the lifecycle of your application, including service discovery, configuration, and secrets management. To add a sidecar to a .NET Aspire resource by using the `WithDaprSidecar(string appId)` method. The `appId` parameter is the unique identifier for the Dapr application.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Dapr sidecar doesn't start/stop your application, so I'm not sure I'd say that it manages its "lifecycle" so much as it serves as a conduit for interacting with other services and dependencies and abstracts the application from the specifics of those services and dependencies.

Copy link
Contributor

@hhunter-ms hhunter-ms May 20, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#939


:::code language="csharp" source="snippets/Dapr/Dapr.AppHost/Program.cs" range="4":::

Dapr uses the Sidecar pattern to run alongside your application. The Dapr sidecar is a lightweight, portable, and stateless HTTP server that listens for incoming HTTP requests from your application. The sidecar is responsible for managing the lifecycle of your application, including service discovery, configuration, and secrets management. To add a sidecar to a .NET Aspire resource by using the `WithDaprSidecar(string appId)` method. The `appId` parameter is the unique identifier for the Dapr application.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if we should lead with the WithDaprSidecar() overload as I believe that will infer the appId from the name given to the resource itself (which is probably what you'd want the appId to be as well).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@NicoVermeir Would you be able to update your code to reflect this?


For more information, see [dotnet add package](/dotnet/core/tools/dotnet-add-package) or [Manage package dependencies in .NET applications](/dotnet/core/tools/dependencies).

The Dapr resource is added to the .NET Aspire distributed application builder using the `AddDapr()` method.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is now implicit when calling WithDaprSidecar(), so it's needed only when the user needs non-default behavior (such as explicitly specifying the path to the Dapr CLI).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


## Adding the Dapr SDK

To use Dapr APIs from .NET Aspire resources you can use the [Dapr SDK for ASP.NET Core](https://www.nuget.org/packages/Dapr.AspNetCore/). The Dapr SDK provides a set of APIs to interact with Dapr sidecars.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A note that the Dapr.AspNetCore library is for when wanting to use some of the Dapr integration with ASP.NET (DI integration, registration of subscriptions, etc.); non-ASP.NET apps (e.g. console apps) can just use the Dapr.Client library if they just want to make calls through the Dapr sidecar.

Copy link
Contributor

@hhunter-ms hhunter-ms May 20, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#939


:::code language="csharp" source="snippets/Dapr/Dapr.Web/Components/Pages/Weather.razor" highlight="5,47":::

What actually happens when the Dapr SDK is used is that the Dapr sidecar is called over HTTP. The Dapr sidecar then forwards the request to the target service. The target service can be running in the same process as the Dapr sidecar or in a different process. The Dapr sidecar is responsible for service discovery and routing the request to the target service.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note: the target service typically isn't running in the same process as the sidecar. Or, rather, the component related to a service may run in the Dapr sidecar, but that will forward calls (e.g. pub-sub, output bindings, etc.) to some other service.

Copy link
Contributor

@hhunter-ms hhunter-ms May 20, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#939

IEvangelist added a commit that referenced this pull request May 21, 2024
* VS Code toolings bits (#886)

* Drop (Preview), let's go!

* Bump to GA versions, and drop --prerelease (#899)

* Bump to GA versions, and drop --prerelease

* Fix xref's and add cosmosdb w/ emulator

* Last xref issues

* Disabiguate hosting and components. Fixes #801

* Fix issue #820

* Fix issue #844

* Fix issue #924

* Fix issue #834

* Fix issue #814

* Wording clean up

* Troubleshooting bits (#900)

* Add troubleshooting content

* Add a few links

* Link to troubleshooting from setup and get started

* Update a bit of the text to add some clarification

* Add content based on new context

* Update a few words

* A few more bits of feedback

* Add link to SDK docs PR

* Fix issue #821

* Drop preview for VS

* Update some images

* Update login URL with v8

* Update theme images

* Update theme images correctly

* Update dashboard screen captures

* Update hub page

* remove more preview content, set vs version

* Correct vs screen capture version

* Several more updates

* Added training links

* Fix issue #721

* Updated init steps and up workflow (#930)

* Updated init steps and up workflow

* fix include

* refactor flow

* add links

* remove duplicate header

* Rework TOC (#928)

* Rework TOC

* Don't expand fundamentals by default

* Don't expand anything

* Nest real-time under Azure

* Move a few more bits

* Add how-tos node

* GA logo (#931)

* Add logo and test column

* Remove png

* Try a few different things here

* Try to resize

* [DRAFT] Dapr content (#894)

* Initial bits

* Intro to the Dapr/Aspire doc (#902)

* add draft intro

Signed-off-by: Hannah Hunter <hannahhunter@microsoft.com>

* intro tweaks

Signed-off-by: Hannah Hunter <hannahhunter@microsoft.com>

* edits to the intro

Signed-off-by: Hannah Hunter <hannahhunter@microsoft.com>

* Apply suggestions from code review

---------

Signed-off-by: Hannah Hunter <hannahhunter@microsoft.com>
Co-authored-by: David Pine <david.pine@microsoft.com>

* Dapr bits (#929)

* adds .net aspire & dapr documentation

* add dapr init instructions

* Apply suggestions from code review

* Apply suggestions from code review

* Update docs/frameworks/dapr.md

* Update docs/frameworks/dapr.md

* Update dapr.md

* Update dapr.md

---------

Co-authored-by: Nico Vermeir <136470992+NVermeir@users.noreply.github.com>
Co-authored-by: David Pine <david.pine@microsoft.com>

* Apply suggestions from code review

---------

Signed-off-by: Hannah Hunter <hannahhunter@microsoft.com>
Co-authored-by: Hannah Hunter <94493363+hhunter-ms@users.noreply.github.com>
Co-authored-by: NicoVermeir <nico_vermeir@hotmail.com>
Co-authored-by: Nico Vermeir <136470992+NVermeir@users.noreply.github.com>

* Let's try a few updates for the TOC (#932)

* Let's try a few updates for the TOC

* Try this now

* More revisions

* More feedback to address

* Relates to #757

* Correct azd casing

* Fix remaining TOC issue

* Nest frameworks and link to content from FAQ

* Add YouTube with .NET Aspire query

* Add next step links to flow user through dashboard content

* Added links to samples

* Add next steps for qs and tt

* Add .NET Aspire to link back to other docs

* Addresses considerations in #938

* Set type

* Locationization scopes

* Add no-loc bits, and correct TOC

* More no-loc

* Localization work

* Added more display names

* [Dapr] Small updates to content (#939)

* partial updates per Phillip review

Signed-off-by: Hannah Hunter <hannahhunter@microsoft.com>

* quick grammar pass

Signed-off-by: Hannah Hunter <hannahhunter@microsoft.com>

* add empty lines around lists

Signed-off-by: Hannah Hunter <hannahhunter@microsoft.com>

* Update docs/frameworks/dapr.md

---------

Signed-off-by: Hannah Hunter <hannahhunter@microsoft.com>
Co-authored-by: David Pine <david.pine@microsoft.com>

* no-loc

* Add a few more links

* More links

* Bump to zero-day patch: 8.0.1

* Touch date

---------

Signed-off-by: Hannah Hunter <hannahhunter@microsoft.com>
Co-authored-by: alexwolfmsft <93200798+alexwolfmsft@users.noreply.github.com>
Co-authored-by: Hannah Hunter <94493363+hhunter-ms@users.noreply.github.com>
Co-authored-by: NicoVermeir <nico_vermeir@hotmail.com>
Co-authored-by: Nico Vermeir <136470992+NVermeir@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants