Couchbase Index Manager support for Aspire.
Install
| Product | Versions |
|---|---|
| .NET |
README
Couchbase.Aspire.Hosting.Indices library
Provides extension methods and resource definitions to add index management to a Couchbase cluster resource in an Aspire AppHost.
Getting Started
Install the package
dotnet add package Couchbase.Aspire.Hosting.Indices
Usage example
In the AppHost.cs file of your AppHost, add indices to a Couchbase bucket resource using the following methods:
var couchbase = builder.AddCouchbase("couchbase");
var bucket = couchbase.AddBucket("mybucket")
.WithIndices("../indices");
var myService = builder.AddProject<Projects.MyService>()
.WithReference(bucket)
.WaitFor(bucket);
Waiting for indices to be ready
It is also possible to wait for the indices to be applied before starting your application:
var couchbase = builder.AddCouchbase("couchbase");
var bucket = couchbase.AddBucket("mybucket");
var bucketIndices = bucket.AddIndexManager("mybucket-indices")
.WithIndices("../indices");
var myService = builder.AddProject<Projects.MyService>()
.WithReference(bucket)
.WaitFor(bucket)
.WaitForCompletion(bucketIndices);
Index definition files
Index definition files are JSON or YAML files that define the indexes to be created on a Couchbase bucket. They may be referenced by directory or by individual file. See couchbase-index-manager Documentation for details on the file format.
Using with a secure Couchbase cluster
If your Couchbase cluster uses TLS/SSL, you may need to configure the index manager to trust the cluster's certificate.
var certAuthorityCollection = builder.AddCertificateAuthorityCollection("couchbase-cert-authority")
.WithCertificate(certificateWithPrivateKey);
var couchbase = builder.AddCouchbase("couchbase");
var bucket = couchbase.AddBucket("mybucket")
.WithRootCertificateAuthority(certAuthorityCollection); // Use the certificate for the Couchbase cluster
var bucketIndices = bucket.AddIndexManager("mybucket-indices")
.WithIndices("../indices")
.WithCertificateAuthorityCollection(certAuthorityCollection); // Trust the certificate for index management
var myService = builder.AddProject<Projects.MyService>()
.WithReference(bucket)
.WaitFor(bucket)
.WaitForCompletion(bucketIndices);
Feedback & contributing
Changes from Previous Version
Adoption Assessment
A verified publisher signal is available. Assess fit from the package's supported frameworks, license and dependency graph rather than popularity alone.
Related Guides & Workflows
Learn how to evaluate, integrate, or audit this package in your .NET project.