इसे छोड़कर कंटेंट पर जाएं

KurrentDB Hosting integration reference

यह कंटेंट अभी तक आपकी भाषा में उपलब्ध नहीं है।

⭐ Community Toolkit KurrentDB logo

To get started with the Aspire KurrentDB integrations, follow the Get started with KurrentDB integrations guide.

This article includes full details about the Aspire KurrentDB Hosting integration.

To install the 📦 CommunityToolkit.Aspire.Hosting.KurrentDB NuGet package in the AppHost project:

Aspire CLI — CommunityToolkit.Aspire.Hosting.KurrentDB पैकेज जोड़ें
aspire add communitytoolkit-kurrentdb

Aspire CLI इंटरैक्टिव है; प्रॉम्प्ट पर उपयुक्त परिणाम चुनें:

Aspire CLI — उदाहरण आउटपुट
Select an integration to add:
> communitytoolkit-kurrentdb (CommunityToolkit.Aspire.Hosting.KurrentDB)
> Other results listed as selectable options...

In the AppHost project, register and consume the KurrentDB integration using the AddKurrentDB extension method to add the KurrentDB container to the application builder.

C# — AppHost.cs
var builder = DistributedApplication.CreateBuilder(args);
var kurrentdb = builder.AddKurrentDB("kurrentdb");
builder.AddProject<Projects.ExampleProject>()
.WithReference(kurrentdb);
// After adding all resources, run the app...

To add a data volume to the KurrentDB resource, call the WithDataVolume method:

C# — AppHost.cs
var builder = DistributedApplication.CreateBuilder(args);
var kurrentdb = builder.AddKurrentDB("kurrentdb")
.WithDataVolume();
builder.AddProject<Projects.ExampleProject>()
.WithReference(kurrentdb);
// After adding all resources, run the app...

The data volume is used to persist the KurrentDB data outside the lifecycle of its container. The data volume is mounted at the /var/lib/kurrentdb path in the KurrentDB container.

Add KurrentDB resource with data bind mount

Section titled “Add KurrentDB resource with data bind mount”

To add a data bind mount to the KurrentDB resource, call the WithDataBindMount method:

C# — AppHost.cs
var builder = DistributedApplication.CreateBuilder(args);
var kurrentdb = builder.AddKurrentDB("kurrentdb")
.WithDataBindMount(source: @"C:\KurrentDB\Data");
builder.AddProject<Projects.ExampleProject>()
.WithReference(kurrentdb);
// After adding all resources, run the app...

The KurrentDB hosting integration automatically adds a health check for the KurrentDB resource. The health check verifies that the KurrentDB instance is running and that a connection can be established to it.