Salta ai contenuti

Seq hosting integration

Questi contenuti non sono ancora disponibili nella tua lingua.

Seq logo

The Seq hosting integration models a Seq resource as the SeqResource type. To access this type and APIs, add the 📦 Aspire.Hosting.Seq NuGet package in your AppHost project:

Aspire CLI — Aggiungi pacchetto Aspire.Hosting.Seq
aspire add seq

La CLI Aspire è interattiva; seleziona il risultato corretto quando richiesto:

Aspire CLI — Output di esempio
Select an integration to add:
> seq (Aspire.Hosting.Seq)
> Other results listed as selectable options...

In your AppHost project, call AddSeq to add and return a Seq resource builder:

C# — AppHost.cs
var builder = DistributedApplication.CreateBuilder(args);
var seq = builder.AddSeq("seq")
.ExcludeFromManifest()
.WithLifetime(ContainerLifetime.Persistent)
.WithEnvironment("ACCEPT_EULA", "Y");
var myService = builder.AddProject<Projects.ExampleProject>()
.WithReference(seq)
.WaitFor(seq);

Accept the Seq End User License Agreement (EULA)

Section titled “Accept the Seq End User License Agreement (EULA)”

You must accept the Seq EULA for Seq to start. To accept the agreement in code, pass the environment variable ACCEPT_EULA to the Seq container, and set its value to Y.

Seq shouldn’t be part of the Aspire deployment manifest, hence the chained call to ExcludeFromManifest. It’s recommended you set up a secure production Seq server outside of Aspire for your production environment.

To add a data volume to the Seq resource, call the WithDataVolume method:

C# — AppHost.cs
var builder = DistributedApplication.CreateBuilder(args);
var seq = builder.AddSeq("seq")
.WithDataVolume()
.ExcludeFromManifest()
.WithLifetime(ContainerLifetime.Persistent);
var myService = builder.AddProject<Projects.ExampleProject>()
.WithReference(seq)
.WaitFor(seq);

The data volume is used to persist the Seq data outside the lifecycle of its container.