aspire icon indicating copy to clipboard operation
aspire copied to clipboard

WithRedisInsight and ContainerLifetime.Persistent causes multiple instances to show up

Open eerhardt opened this issue 1 year ago • 2 comments

If I have the following:

var builder = DistributedApplication.CreateBuilder(args);

var redis = builder.AddRedis("redis")
    .WithDataVolume()
    .WithRedisInsight(c => c.WithLifetime(ContainerLifetime.Persistent));

builder.AddProject<Projects.Redis_ApiService>("apiservice")
    .WithReference(redis).WaitFor(redis);

builder.Build().Run();

When I run multiple times, the RedisInights container stays running, but each time I run a new Redis instance shows up in it:

image

We should fix this so the same redis instance isn't added on re-run.

eerhardt avatar Oct 04 '24 18:10 eerhardt

What happens for RedisComander, Pgweb, Pgadmin, and other dashboards when using ContainerLifetime.Persistent?

Alirexaa avatar Oct 04 '24 18:10 Alirexaa

What happens for RedisComander, Pgweb, Pgadmin, and other dashboards when using ContainerLifetime.Persistent?

Unsure. It needs to be tested.


Here's another way to get the same results:

var redis = builder.AddRedis("redis")
    .WithRedisInsight(c => c.WithVolume("insights", "/data"));

Since the data will be persisted, each time you run it creates a new entry.

eerhardt avatar Oct 04 '24 18:10 eerhardt

OK so the fix here is to make the API call see if it is already registered.

mitchdenny avatar Oct 18 '24 23:10 mitchdenny

Yep

davidfowl avatar Oct 19 '24 03:10 davidfowl

@Alirexaa can you get to this change this week? It's our last week to make 9.x fixes.

davidfowl avatar Oct 21 '24 19:10 davidfowl

@Alirexaa can you get to this change this week? It's our last week to make 9.x fixes.

I want to fix this with https://github.com/dotnet/aspire/issues/6299 but mitchdenny already started.

Alirexaa avatar Oct 22 '24 05:10 Alirexaa