Watch Aspire live streamsBelgelerAspire'ı deneyin

Get started with the SeaweedFS integration

Bu içerik henüz dilinizde mevcut değil.

⭐ Community Toolkit

SeaweedFS is a distributed storage system with native Master, Volume, and Filer APIs and an optional S3-compatible gateway. The Community Toolkit provides an AppHost integration and a .NET client package for its S3 and Filer APIs.

  • Enable only the APIs your application uses.
  • Reference a SeaweedFS resource to pass dynamically assigned endpoints and S3 credentials to dependent projects.
  • Persist cluster files in a Docker volume or a host bind mount.
  • Register typed .NET clients with configuration and health checks.
  • The Aspire CLI and the other Aspire prerequisites.
  • Docker to run the SeaweedFS container.
  • .NET 10 or later for the Community Toolkit client package.

The hosting package starts a SeaweedFS container with the Master and Volume services. Add WithFiler for the native Filer API, or WithS3 for the S3-compatible gateway. The S3 gateway also enables the Filer API because it depends on it. The client package reads endpoint and credential values from Aspire configuration and registers the matching .NET client.

architecture-beta
  group apphost(server)[AppHost]
  group seaweed(server)[SeaweedFS container]
  service hosting(server)[SeaweedFS hosting integration] in apphost
  service resource(disk)[SeaweedFS resource] in apphost
  service master(server)[Master and Volume APIs] in seaweed
  service filer(server)[Native Filer API] in seaweed
  service s3(api)[S3 gateway] in seaweed
  service client(server)[.NET application]
  hosting:R --> L:resource
  resource:R --> L:master
  resource:R --> L:filer
  resource:R --> L:s3
  client:L --> R:s3
  1. Install the hosting package in the AppHost.

    Aspire CLI — CommunityToolkit.Aspire.Hosting.SeaweedFS paketi ekle
    aspire add seaweedfs

    Aspire CLI etkileşimlidir; istendiğinde uygun sonucu seçin:

    Aspire CLI — Örnek çıktı
    Select an integration to add:
    > seaweedfs (CommunityToolkit.Aspire.Hosting.SeaweedFS)
    > Other results listed as selectable options...
  2. Add the resource and opt in to either the native Filer API, the S3 gateway, or both. See Host SeaweedFS in the AppHost for endpoint, security, and persistence options.

  3. Install the client package in a .NET project and register the client for the same resource name used in the AppHost. See Connect to SeaweedFS for S3 and Filer client examples.

The S3 gateway uses target port 8333 by default and enables the Filer API at target port 8888. Aspire assigns host ports unless you configure them:

apphost.mts
import {
function createBuilder(): IDistributedApplicationBuilder

Creates a new distributed application builder

createBuilder
} from './.aspire/modules/aspire.mjs';
const
const builder: IDistributedApplicationBuilder
builder
= await
function createBuilder(): IDistributedApplicationBuilder

Creates a new distributed application builder

createBuilder
();
const
const seaweedfs: SeaweedFSContainerResource
seaweedfs
= await
const builder: IDistributedApplicationBuilder
builder
.
IDistributedApplicationBuilder.addSeaweedFS(name: string): SeaweedFSContainerResource

Adds a base SeaweedFS container (Master and Volume APIs) to the application model. Chain with .WithS3() or .WithFiler() to enable additional APIs.

addSeaweedFS
('seaweedfs');
await
const seaweedfs: SeaweedFSContainerResource
seaweedfs
.
SeaweedFSContainerResource.withS3(options?: {
s3Port?: number;
}): SeaweedFSContainerResource (+1 overload)

Enables the SeaweedFS S3-Compatible API Gateway.

withS3
();
await
const seaweedfs: SeaweedFSContainerResource
seaweedfs
.
SeaweedFSContainerResource.withDataVolume(options?: {
name?: string;
isReadOnly?: boolean;
}): SeaweedFSContainerResource (+1 overload)

Adds a named volume for the SeaweedFS data folder.

withDataVolume
();
const
const api: ProjectResource
api
= await
const builder: IDistributedApplicationBuilder
builder
.
IDistributedApplicationBuilder.addProject(name: string, projectPath: string, options?: {
launchProfileOrOptions?: string | ProjectResourceOptions;
}): ProjectResource (+1 overload)

Adds a .NET project resource

addProject
('api', '../Api/Api.csproj');
await
const api: ProjectResource
api
.
ProjectResource.withReference(source: IResource | EndpointReference | string | uri, options?: {
connectionName?: string;
optional?: boolean;
name?: string;
} | undefined): ProjectResource (+1 overload)

Adds a reference to another resource

withReference
(
const seaweedfs: SeaweedFSContainerResource
seaweedfs
);
await
const builder: IDistributedApplicationBuilder
builder
.
IDistributedApplicationBuilder.build(): DistributedApplication

Builds the distributed application

build
().
DistributedApplication.run(cancellationToken?: cancellationToken): void

Runs the distributed application

run
();