Ir al contenido

Seq hosting integration

Esta página aún no está disponible en tu idioma.

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 — Añadir paquete Aspire.Hosting.Seq
aspire add seq

La CLI de Aspire es interactiva; asegúrate de seleccionar el resultado adecuado cuando se te pida:

Aspire CLI — Ejemplo de salida
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.