You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This example demonstrates how to integrate and consume a SeaweedFS cluster within a .NET Aspire distributed application. It showcases both the **S3-Compatible API** and the **Native Filer API** in a single cohesive setup.
4
+
5
+
## Project Structure
6
+
7
+
***SeaweedFS.AppHost:** The Aspire orchestrator. It spins up the SeaweedFS Docker container, enables the S3 Gateway and Data Volumes, and injects the dynamic connection strings into the API.
8
+
***SeaweedFS.ServiceDefaults:** Standard Aspire telemetry, resilience, and health check configurations.
9
+
***SeaweedFS.ApiService:** A minimal API application that registers both the `IAmazonS3` client and the `SeaweedFSFilerClient` to interact with the storage cluster.
10
+
11
+
## Running the Example
12
+
13
+
1. Ensure you have [Docker Desktop](https://www.docker.com/products/docker-desktop/) or Podman running on your machine.
14
+
2. Open a terminal in this directory (`aspire/seaweedfs/`).
15
+
3. Run the AppHost:
16
+
17
+
```dotnetcli
18
+
dotnet run --project SeaweedFS.AppHost
19
+
20
+
```
21
+
22
+
4. Open the **Aspire Dashboard** URL provided in the console output.
23
+
5. Wait for both the `seaweedfs` container and the `apiservice` to show as **Healthy**.
24
+
25
+
## Exploring the Endpoints
26
+
27
+
The `SeaweedFS.ApiService` exposes endpoints to test both storage approaches. You can trigger them using Swagger (if enabled) or using tools like `curl` or Postman.
28
+
29
+
### S3 Endpoints (AWS SDK Compatibility)
30
+
31
+
These endpoints use the injected `IAmazonS3` client.
These endpoints use the injected `SeaweedFSFilerClient` performing direct HTTP calls to the cluster.
44
+
45
+
***Upload a File to Root:**
46
+
`POST /filer/upload?fileName=native-file.txt`
47
+
*(Send raw text in the body)*
48
+
***List Directory Contents:**
49
+
`GET /filer/list`
50
+
*(Returns a JSON representation of the Filer's directory structure)*
51
+
52
+
## Viewing Data in SeaweedFS
53
+
54
+
Since `SeaweedFS.AppHost` maps a data volume using `.WithDataVolume()`, any file you upload using the endpoints above will be persisted in the Docker volume. If you stop the AppHost and run it again, your data will still be accessible.
0 commit comments