Skip to content
Open
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import ollamaIcon from '@assets/icons/ollama-icon.png';
alt="Ollama logo"
width={100}
height={100}
fit="contain"
class:list={'float-inline-left icon'}
data-zoom-off
/>
Expand Down Expand Up @@ -104,8 +105,8 @@ public class ExampleService(IOllamaApiClient ollama)
To register multiple `IOllamaApiClient` instances with different connection names, use `AddKeyedOllamaApiClient`:

```csharp title="Program.cs"
builder.AddKeyedOllamaApiClient(name: "chat");
builder.AddKeyedOllamaApiClient(name: "embeddings");
builder.AddKeyedOllamaApiClient(connectionName: "chat");
builder.AddKeyedOllamaApiClient(connectionName: "embeddings");
```

Then resolve each instance by key:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import ollamaIcon from '@assets/icons/ollama-icon.png';
alt="Ollama logo"
width={100}
height={100}
fit="contain"
class:list={'float-inline-left icon'}
data-zoom-off
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import ollamaIcon from '@assets/icons/ollama-icon.png';
alt="Ollama logo"
width={100}
height={100}
fit="contain"
class:list={'float-inline-left icon'}
data-zoom-off
/>
Expand Down Expand Up @@ -277,20 +278,20 @@ await ollama.addModel("llama3");
**AMD:**

```typescript title="apphost.mts"
import { createBuilder } from './.aspire/modules/aspire.mjs';
import { createBuilder, OllamaGpuVendor } from './.aspire/modules/aspire.mjs';

const builder = await createBuilder();

const ollama = await builder.addOllama("ollama");
await ollama.withGPUSupport({ vendor: "AMD" });
await ollama.withGPUSupport({ vendor: OllamaGpuVendor.AMD });

await ollama.addModel("llama3");

// After adding all resources, run the app...
```

<Aside type="note">
The TypeScript `withGPUSupport` API shape for vendor selection may differ from the C# overload. Refer to the generated `.aspire/modules/aspire.mjs` in your project for the exact parameter structure.
In TypeScript, select the GPU vendor with the `OllamaGpuVendor` enum imported from the generated `.aspire/modules/aspire.mjs` for example, `OllamaGpuVendor.AMD` or `OllamaGpuVendor.Nvidia`.
</Aside>

</TabItem>
Expand Down Expand Up @@ -339,7 +340,7 @@ await builder.addNodeApp("api", "./api", "index.js")
</TabItem>
</Tabs>

Only models in GGUF format are supported. Ollama automatically prefixes `hf.co/` if the model name doesn't already start with `hf.co/` or `huggingface.co/`.
Only models in GGUF format are supported. The integration automatically prefixes `hf.co/` to the model name if it doesn't already start with `hf.co/` or `huggingface.co/`, so Ollama can resolve it from Hugging Face.

## Add Ollama resource with parameters

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,22 @@ seoTitle: "Connect to KurrentDB from Aspire apps (C#, Node.js)"
description: Learn how to connect to KurrentDB from C#, Go, Python, and TypeScript consuming apps in an Aspire solution.
---

import { Image } from 'astro:assets';
import { Aside, Badge, Tabs, TabItem } from '@astrojs/starlight/components';
import InstallDotNetPackage from '@components/InstallDotNetPackage.astro';
import ThemeImage from '@components/ThemeImage.astro';
import kurrentIcon from '@assets/icons/kurrent-icon.png';
import kurrentLightIcon from '@assets/icons/kurrent-light-icon.png';

<Badge text="⭐ Community Toolkit" variant="tip" size="large" />

<Image
src={kurrentIcon}
<ThemeImage
light={kurrentLightIcon}
dark={kurrentIcon}
alt="KurrentDB logo"
width={100}
height={100}
class:list={'float-inline-left icon'}
data-zoom-off
zoomable={false}
classOverride="float-inline-left icon"
/>

This page describes how consuming apps connect to a KurrentDB resource that's already modeled in your AppHost. For the AppHost API surface — adding a KurrentDB resource, data volumes, data bind mounts, and more — see [KurrentDB Hosting integration](../kurrentdb-host/).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,21 @@ title: Get started with the KurrentDB integrations
description: Learn how the Aspire KurrentDB integrations host a KurrentDB event store resource and connect the .NET client to your Aspire AppHost projects.
---

import { Image } from 'astro:assets';
import { Badge, LinkButton, Steps } from '@astrojs/starlight/components';
import ThemeImage from '@components/ThemeImage.astro';
import kurrentIcon from '@assets/icons/kurrent-icon.png';
import kurrentLightIcon from '@assets/icons/kurrent-light-icon.png';

<Badge text="⭐ Community Toolkit" variant="tip" size="large" />

<Image
src={kurrentIcon}
<ThemeImage
light={kurrentLightIcon}
dark={kurrentIcon}
alt="KurrentDB logo"
width={100}
height={100}
class:list={'float-inline-left icon'}
data-zoom-off
zoomable={false}
classOverride="float-inline-left icon"
/>

[KurrentDB](https://kurrent.io/) is an open-source event-sourcing database (formerly EventStoreDB) purpose-built for storing events as an immutable, append-only log. It delivers high availability and reliability for event-driven and event-sourcing architectures. The Aspire KurrentDB integration lets you model a KurrentDB server as a first-class resource in your AppHost, then hand the connection information to any consuming app — regardless of language.
Expand All @@ -24,7 +26,7 @@ import kurrentIcon from '@assets/icons/kurrent-icon.png';

Adding KurrentDB through Aspire — rather than wiring up containers and connection strings by hand — gives you:

- **Zero-config local development.** Aspire runs KurrentDB from the [`docker.io/eventstore/eventstore`](https://hub.docker.com/r/eventstore/eventstore) container image with configuration generated automatically for you.
- **Zero-config local development.** Aspire runs KurrentDB from the [`docker.kurrent.io/kurrent-latest/kurrentdb`](https://docker.kurrent.io) container image with configuration generated automatically for you.
- **Consistent connection info across languages.** Once you reference the KurrentDB resource from a consuming app, Aspire injects connection properties as environment variables in a predictable format that works from C#, TypeScript, Python, Go, or any other language.
- **Built-in health checks.** The hosting integration automatically registers a health check so the dashboard and your orchestrator can tell when KurrentDB is ready.
- **Dashboard observability.** The KurrentDB resource shows up in the Aspire dashboard with logs, status, and telemetry alongside your other services.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,34 +4,36 @@ seoTitle: "Set up KurrentDB in the Aspire AppHost: hosting integration"
description: Learn how to use the Aspire KurrentDB Hosting integration to orchestrate and configure a KurrentDB resource in an Aspire solution.
---

import { Image } from 'astro:assets';
import { Aside, Badge, Steps } from '@astrojs/starlight/components';
import { Aside, Badge, Steps, Tabs, TabItem } from '@astrojs/starlight/components';
import InstallPackage from '@components/InstallPackage.astro';
import LearnMore from '@components/LearnMore.astro';
import ThemeImage from '@components/ThemeImage.astro';
import kurrentIcon from '@assets/icons/kurrent-icon.png';
import kurrentLightIcon from '@assets/icons/kurrent-light-icon.png';

<Badge text="⭐ Community Toolkit" variant="tip" size="large" />

<Image
src={kurrentIcon}
<ThemeImage
Comment thread
IEvangelist marked this conversation as resolved.
light={kurrentLightIcon}
dark={kurrentIcon}
alt="KurrentDB logo"
width={100}
height={100}
class:list={'float-inline-left icon'}
data-zoom-off
zoomable={false}
classOverride="float-inline-left icon"
/>

This article is the reference for the Aspire KurrentDB Hosting integration. It enumerates the AppHost C# APIs that you use to model a KurrentDB resource in your [`AppHost`](/get-started/app-host/) project.
This article is the reference for the Aspire KurrentDB Hosting integration. It enumerates the AppHost APIs that you use to model a KurrentDB resource in your [`AppHost`](/get-started/app-host/) project.

If you're new to the KurrentDB integration, start with the [Get started with KurrentDB integrations](/integrations/databases/kurrentdb/kurrentdb-get-started/) guide. For how consuming apps read the connection information this page exposes, see [Connect to KurrentDB](../kurrentdb-connect/).

<Aside type="note">
TypeScript AppHost support (`addKurrentDB` and related APIs) is not yet available in the generated `./.aspire/modules/aspire.mjs` SDK. All examples on this page are C# only.
</Aside>

## Installation

To start building an Aspire app that uses KurrentDB, install the [📦 CommunityToolkit.Aspire.Hosting.KurrentDB](https://nuget.org/packages/CommunityToolkit.Aspire.Hosting.KurrentDB) NuGet package:

<Tabs syncKey="aspire-lang">
<TabItem id="csharp" label="C#">

<InstallPackage packageName="CommunityToolkit.Aspire.Hosting.KurrentDB" />

Or, choose a manual installation approach:
Expand All @@ -44,10 +46,37 @@ Or, choose a manual installation approach:
<PackageReference Include="CommunityToolkit.Aspire.Hosting.KurrentDB" Version="*" />
```

</TabItem>
<TabItem id="typescript" label="TypeScript">

```bash title="Terminal"
aspire add CommunityToolkit.Aspire.Hosting.KurrentDB
```

<LearnMore>
Learn more about [`aspire add`](/reference/cli/commands/aspire-add/) in the command reference.
</LearnMore>

This updates your `aspire.config.json` with the KurrentDB hosting integration package:

```json title="aspire.config.json" ins={3}
{
"packages": {
"CommunityToolkit.Aspire.Hosting.KurrentDB": "*"
}
}
```

</TabItem>
</Tabs>

## Add KurrentDB resource

Once you've installed the hosting integration in your AppHost project, you can add a KurrentDB resource as shown in the following example:

<Tabs syncKey="aspire-lang">
<TabItem id="csharp" label="C#">

```csharp title="AppHost.cs"
var builder = DistributedApplication.CreateBuilder(args);

Expand All @@ -56,12 +85,31 @@ var kurrentdb = builder.AddKurrentDB("kurrentdb");
var exampleProject = builder.AddProject<Projects.ExampleProject>("apiservice")
.WithReference(kurrentdb);

// After adding all resources, run the app...
builder.Build().Run();
```

</TabItem>
<TabItem id="typescript" label="TypeScript">

```typescript title="apphost.mts"
import { createBuilder } from './.aspire/modules/aspire.mjs';

const builder = await createBuilder();

const kurrentdb = await builder.addKurrentDB("kurrentdb");

const exampleProject = await builder.addProject("apiservice", "../ExampleProject/ExampleProject.csproj");
await exampleProject.withReference(kurrentdb);

await builder.build().run();
```

</TabItem>
</Tabs>

<Steps>

1. When Aspire adds a container image to the AppHost, as shown in the preceding example with the `docker.io/eventstore/eventstore` image, it creates a new KurrentDB instance on your local machine.
1. When Aspire adds a container image to the AppHost, as shown in the preceding example with the `docker.kurrent.io/kurrent-latest/kurrentdb` image, it creates a new KurrentDB instance on your local machine.

1. The AppHost reference call configures a connection in the consuming project named after the referenced KurrentDB resource, such as `kurrentdb` in the preceding example.

Expand All @@ -75,6 +123,9 @@ var exampleProject = builder.AddProject<Projects.ExampleProject>("apiservice")

Add a data volume to the KurrentDB resource as shown in the following example:

<Tabs syncKey="aspire-lang">
<TabItem id="csharp" label="C#">

```csharp title="AppHost.cs"
var builder = DistributedApplication.CreateBuilder(args);

Expand All @@ -84,15 +135,38 @@ var kurrentdb = builder.AddKurrentDB("kurrentdb")
var exampleProject = builder.AddProject<Projects.ExampleProject>("apiservice")
.WithReference(kurrentdb);

// After adding all resources, run the app...
builder.Build().Run();
```

</TabItem>
<TabItem id="typescript" label="TypeScript">

```typescript title="apphost.mts"
import { createBuilder } from './.aspire/modules/aspire.mjs';

const builder = await createBuilder();

const kurrentdb = await builder.addKurrentDB("kurrentdb");
await kurrentdb.withDataVolume();

const exampleProject = await builder.addProject("apiservice", "../ExampleProject/ExampleProject.csproj");
await exampleProject.withReference(kurrentdb);

await builder.build().run();
```

</TabItem>
</Tabs>

The data volume is used to persist KurrentDB data outside the lifecycle of its container. The data volume is mounted at the `/var/lib/kurrentdb` path in the KurrentDB container, and when a `name` parameter isn't provided, the name is generated at random. For more information on data volumes and details on why they're preferred over [bind mounts](#add-kurrentdb-resource-with-data-bind-mount), see [Docker docs: Volumes](https://docs.docker.com/engine/storage/volumes).

## Add KurrentDB resource with data bind mount

Add a data bind mount to the KurrentDB resource as shown in the following example:

<Tabs syncKey="aspire-lang">
<TabItem id="csharp" label="C#">

```csharp title="AppHost.cs"
var builder = DistributedApplication.CreateBuilder(args);

Expand All @@ -102,9 +176,29 @@ var kurrentdb = builder.AddKurrentDB("kurrentdb")
var exampleProject = builder.AddProject<Projects.ExampleProject>("apiservice")
.WithReference(kurrentdb);

// After adding all resources, run the app...
builder.Build().Run();
```

</TabItem>
<TabItem id="typescript" label="TypeScript">

```typescript title="apphost.mts"
import { createBuilder } from './.aspire/modules/aspire.mjs';

const builder = await createBuilder();

const kurrentdb = await builder.addKurrentDB("kurrentdb");
await kurrentdb.withDataBindMount("C:\\KurrentDB\\Data");

const exampleProject = await builder.addProject("apiservice", "../ExampleProject/ExampleProject.csproj");
await exampleProject.withReference(kurrentdb);

await builder.build().run();
```

</TabItem>
</Tabs>

<Aside type="note">
Data [bind mounts](https://docs.docker.com/engine/storage/bind-mounts/) have limited functionality compared to [volumes](https://docs.docker.com/engine/storage/volumes/), which offer better performance, portability, and security, making them more suitable for production environments. However, bind mounts allow direct access and modification of files on the host system, ideal for development and testing where real-time changes are needed.
</Aside>
Expand Down
Loading
Loading