Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
5 changes: 5 additions & 0 deletions CommunityToolkit.Aspire.slnx
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,9 @@
<Project Path="examples/rust/CommunityToolkit.Aspire.Hosting.Rust.AppHost/CommunityToolkit.Aspire.Hosting.Rust.AppHost.csproj" />
<Project Path="examples/rust/CommunityToolkit.Aspire.Hosting.Rust.ServiceDefaults/CommunityToolkit.Aspire.Hosting.Rust.ServiceDefaults.csproj" />
</Folder>
<Folder Name="/examples/rustfs/">
<Project Path="examples/rustfs/CommunityToolkit.Aspire.Hosting.RustFs.AppHost/CommunityToolkit.Aspire.Hosting.RustFs.AppHost.csproj" />
</Folder>
<Folder Name="/examples/sftp/">
<Project Path="examples/sftp/CommunityToolkit.Aspire.Hosting.Sftp.ApiService/CommunityToolkit.Aspire.Hosting.Sftp.ApiService.csproj" />
<Project Path="examples/sftp/CommunityToolkit.Aspire.Hosting.Sftp.AppHost/CommunityToolkit.Aspire.Hosting.Sftp.AppHost.csproj" />
Expand Down Expand Up @@ -236,6 +239,7 @@
<Project Path="src/CommunityToolkit.Aspire.Hosting.RavenDB/CommunityToolkit.Aspire.Hosting.RavenDB.csproj" />
<Project Path="src/CommunityToolkit.Aspire.Hosting.Redis.Extensions/CommunityToolkit.Aspire.Hosting.Redis.Extensions.csproj" />
<Project Path="src/CommunityToolkit.Aspire.Hosting.Rust/CommunityToolkit.Aspire.Hosting.Rust.csproj" />
<Project Path="src/CommunityToolkit.Aspire.Hosting.RustFs/CommunityToolkit.Aspire.Hosting.RustFs.csproj" />
<Project Path="src/CommunityToolkit.Aspire.Hosting.Sftp/CommunityToolkit.Aspire.Hosting.Sftp.csproj" />
<Project Path="src/CommunityToolkit.Aspire.Hosting.Solr/CommunityToolkit.Aspire.Hosting.Solr.csproj" />
<Project Path="src/CommunityToolkit.Aspire.Hosting.SqlDatabaseProjects/CommunityToolkit.Aspire.Hosting.SqlDatabaseProjects.csproj" />
Expand Down Expand Up @@ -299,6 +303,7 @@
<Project Path="tests/CommunityToolkit.Aspire.Hosting.RavenDB.Tests/CommunityToolkit.Aspire.Hosting.RavenDB.Tests.csproj" />
<Project Path="tests/CommunityToolkit.Aspire.Hosting.Redis.Extensions.Tests/CommunityToolkit.Aspire.Hosting.Redis.Extensions.Tests.csproj" />
<Project Path="tests/CommunityToolkit.Aspire.Hosting.Rust.Tests/CommunityToolkit.Aspire.Hosting.Rust.Tests.csproj" />
<Project Path="tests/CommunityToolkit.Aspire.Hosting.RustFs.Tests/CommunityToolkit.Aspire.Hosting.RustFs.Tests.csproj" />
<Project Path="tests/CommunityToolkit.Aspire.Hosting.Sftp.Tests/CommunityToolkit.Aspire.Hosting.Sftp.Tests.csproj" />
<Project Path="tests/CommunityToolkit.Aspire.Hosting.Solr.Tests/CommunityToolkit.Aspire.Hosting.Solr.Tests.csproj" />
<Project Path="tests/CommunityToolkit.Aspire.Hosting.SqlDatabaseProjects.Tests/CommunityToolkit.Aspire.Hosting.SqlDatabaseProjects.Tests.csproj" />
Expand Down
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ This repository contains the source code for the Aspire Community Toolkit, a col
| - **Learn More**: [`Hosting.MySql.Extensions`][mysql-ext-integration-docs] <br /> - Stable 📦: [![CommunityToolkit.Aspire.MySql.Extensions][mysql-ext-shields]][mysql-ext-nuget] <br /> - Preview 📦: [![CommunityToolkit.Aspire.Hosting.MySql.Extensions][mysql-ext-shields-preview]][mysql-ext-nuget-preview] | An integration that contains some additional extensions for hosting MySql container. |
| - **Learn More**: [`Hosting.MinIO`][minio-integration-docs] <br /> - Stable 📦: [![CommunityToolkit.Aspire.Hosting.Minio][minio-hosting-shields]][minio-hosting-nuget] <br /> - Preview 📦: [![CommunityToolkit.Aspire.Hosting.Minio][minio-hosting-shields-preview]][minio-hosting-nuget-preview] | An Aspire hosting integration to setup a [MinIO S3](https://min.io/) storage. |
| - **Learn More**: [`MinIO.Client`][minio-integration-docs] <br /> - Stable 📦: [![CommunityToolkit.Aspire.Minio.Client][minio-client-shields]][minio-client-nuget] <br /> - Preview 📦: [![CommunityToolkit.Aspire.Client.Minio][minio-client-shields-preview]][minio-client-nuget-preview] | An Aspire client integration for the [MinIO](https://github.com/minio/minio-dotnet) package. |
| - **Learn More**: [`Hosting.RustFs`][rustfs-integration-docs] <br /> - Stable 📦: [![CommunityToolkit.Aspire.Hosting.RustFs][rustfs-hosting-shields]][rustfs-hosting-nuget] <br /> - Preview 📦: [![CommunityToolkit.Aspire.Hosting.RustFs][rustfs-hosting-shields-preview]][rustfs-hosting-nuget-preview] | An Aspire hosting integration to setup a [RustFs](https://github.com/rustfs/rustfs) S3-compatible storage. |
| - **Learn More**: [`Hosting.SurrealDb`][surrealdb-integration-docs] <br /> - Stable 📦: [![CommunityToolkit.Aspire.Hosting.SurrealDb][surrealdb-shields]][surrealdb-nuget] <br /> - Preview 📦: [![CommunityToolkit.Aspire.Hosting.SurrealDb][surrealdb-shields-preview]][surrealdb-nuget-preview] | An Aspire hosting integration leveraging the [SurrealDB](https://surrealdb.com/) container. |
| - **Learn More**: [`SurrealDb`][surrealdb-integration-docs] <br /> - Stable 📦: [![CommunityToolkit.Aspire.SurrealDb][surrealdb-client-shields]][surrealdb-client-nuget] <br /> - Preview 📦: [![CommunityToolkit.Aspire.SurrealDb][surrealdb-client-shields-preview]][surrealdb-client-nuget-preview] | An Aspire client integration for the [SurrealDB](https://github.com/surrealdb/surrealdb.net/) package. |
| - **Learn More**: [`Hosting.Elasticsearch.Extensions`][elasticsearch-ext-integration-docs] <br /> - Stable 📦: [![CommunityToolkit.Aspire.Hosting.Elasticsearch.Extensions][elasticsearch-ext-shields]][elasticsearch-ext-nuget] <br /> - Preview 📦: [![CommunityToolkit.Aspire.Hosting.Elasticsearch.Extensions][elasticsearch-ext-shields-preview]][elasticsearch-ext-nuget-preview] | An integration that contains some additional extensions for hosting Elasticsearch container. |
Expand Down Expand Up @@ -274,6 +275,11 @@ This project is supported by the [.NET Foundation](https://dotnetfoundation.org)
[minio-client-nuget]: https://nuget.org/packages/CommunityToolkit.Aspire.Minio.Client/
[minio-client-shields-preview]: https://img.shields.io/nuget/vpre/CommunityToolkit.Aspire.Minio.Client?label=nuget%20(preview)
[minio-client-nuget-preview]: https://nuget.org/packages/CommunityToolkit.Aspire.Minio.Client/absoluteLatest
[rustfs-integration-docs]: https://learn.microsoft.com/dotnet/aspire/community-toolkit/hosting-rustfs
[rustfs-hosting-shields]: https://img.shields.io/nuget/v/CommunityToolkit.Aspire.Hosting.RustFs
[rustfs-hosting-nuget]: https://nuget.org/packages/CommunityToolkit.Aspire.Hosting.RustFs/
[rustfs-hosting-shields-preview]: https://img.shields.io/nuget/vpre/CommunityToolkit.Aspire.Hosting.RustFs?label=nuget%20(preview)
[rustfs-hosting-nuget-preview]: https://nuget.org/packages/CommunityToolkit.Aspire.Hosting.RustFs/absoluteLatest
[surrealdb-integration-docs]: https://learn.microsoft.com/dotnet/aspire/community-toolkit/hosting-surrealdb
[surrealdb-shields]: https://img.shields.io/nuget/v/CommunityToolkit.Aspire.Hosting.SurrealDb
[surrealdb-nuget]: https://nuget.org/packages/CommunityToolkit.Aspire.Hosting.SurrealDb/
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<Project Sdk="Aspire.AppHost.Sdk/13.3.0">

<PropertyGroup>
<OutputType>Exe</OutputType>
<UserSecretsId>d1a3e2c4-5b6f-7890-abcd-ef1234567890</UserSecretsId>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\..\..\src\CommunityToolkit.Aspire.Hosting.RustFs\CommunityToolkit.Aspire.Hosting.RustFs.csproj" IsAspireProjectResource="false" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
var builder = DistributedApplication.CreateBuilder(args);

var accessKey = builder.AddParameter("accessKey", "rustfsadmin");
var secretKey = builder.AddParameter("secretKey", "rustfsadmin", secret: true);

var rustfs = builder.AddRustFs("rustfs", accessKey, secretKey)
.WithDataVolume()
.AddBucket("mybucket");

builder.Build().Run();
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"$schema": "https://json.schemastore.org/launchsettings.json",
"profiles": {
"https": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": true,
"applicationUrl": "https://localhost:18130;http://localhost:12048",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development",
"DOTNET_ENVIRONMENT": "Development",
"DOTNET_DASHBOARD_OTLP_ENDPOINT_URL": "https://localhost:32486",
"DOTNET_RESOURCE_SERVICE_ENDPOINT_URL": "https://localhost:12810"
}
},
"http": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": true,
"applicationUrl": "http://localhost:15183",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development",
"DOTNET_ENVIRONMENT": "Development",
"DOTNET_DASHBOARD_OTLP_ENDPOINT_URL": "http://localhost:19197",
"DOTNET_RESOURCE_SERVICE_ENDPOINT_URL": "http://localhost:21262"
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning",
"Aspire.Hosting.Dcp": "Warning"
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<AdditionalPackageTags>hosting rustfs storage s3-compatible</AdditionalPackageTags>
<Description>An Aspire hosting integration for RustFs</Description>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Aspire.Hosting" />
</ItemGroup>

</Project>
42 changes: 42 additions & 0 deletions src/CommunityToolkit.Aspire.Hosting.RustFs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# CommunityToolkit.Aspire.Hosting.RustFs library

Provides extension methods and resource definitions for the Aspire AppHost to support running [RustFs](https://github.com/rustfs/rustfs) containers.

## Getting Started

### Install the package

In your AppHost project, install the package using the following command:

```dotnetcli
dotnet add package CommunityToolkit.Aspire.Hosting.RustFs
```

### Example usage

Then, in the _Program.cs_ file of `AppHost`, add a RustFs resource and consume the connection using the following methods:

```csharp
var builder = DistributedApplication.CreateBuilder(args);

var rustfs = builder.AddRustFs("rustfs")
.WithDataVolume()
.AddBucket("mybucket");

builder.Build().Run();
```

### Buckets

`AddBucket` registers each bucket as a child `RustFsBucketResource` so it appears in
the Aspire Dashboard. After the RustFs server becomes healthy, the integration issues
a signed S3 `PUT /{bucket}` request from the AppHost process to provision the bucket;
there is no `minio/mc` sidecar container.

Multiple buckets can be added at once via `AddBucket(IReadOnlyList<string>)`:

```csharp
builder.AddRustFs("rustfs")
.AddBucket(["images", "documents", "audit-log"]);
```

52 changes: 52 additions & 0 deletions src/CommunityToolkit.Aspire.Hosting.RustFs/RustFsBucketResource.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
namespace Aspire.Hosting.ApplicationModel;

/// <summary>
/// A resource that represents an S3 bucket created on a RustFs container resource.
/// </summary>
public sealed class RustFsBucketResource : Resource, IResourceWithParent<RustFsResource>, IResourceWithConnectionString
{
/// <summary>
/// Gets the parent <see cref="RustFsResource"/> that hosts this bucket.
/// </summary>
public RustFsResource Parent { get; }

/// <summary>
/// Gets the S3 bucket name as it exists on the RustFs server.
/// </summary>
/// <remarks>
/// This is the actual name used on the wire; it may differ from <see cref="Resource.Name"/>,
/// which is the Aspire resource identifier.
/// </remarks>
public string BucketName { get; }

/// <summary>
/// Initializes a new instance of the <see cref="RustFsBucketResource"/> class.
/// </summary>
/// <param name="name">The Aspire resource name.</param>
/// <param name="bucketName">The S3 bucket name on RustFs.</param>
/// <param name="parent">The parent RustFs resource.</param>
public RustFsBucketResource([ResourceName] string name, string bucketName, RustFsResource parent)
: base(name)
{
ArgumentException.ThrowIfNullOrWhiteSpace(bucketName);
ArgumentNullException.ThrowIfNull(parent);

BucketName = bucketName;
Parent = parent;
}

/// <summary>
/// Gets the connection string expression for the bucket.
/// </summary>
/// <remarks>
/// Format: <c>Endpoint=http://host:port;AccessKey=key;SecretKey=secret;Bucket=bucket</c>.
/// </remarks>
public ReferenceExpression ConnectionStringExpression =>
ReferenceExpression.Create($"{Parent};Bucket={BucketName}");

/// <inheritdoc/>
IEnumerable<KeyValuePair<string, ReferenceExpression>> IResourceWithConnectionString.GetConnectionProperties() =>
Parent.CombineProperties([
new("Bucket", ReferenceExpression.Create($"{BucketName}"))
]);
}
Loading