Aspire and PgAdmin

Hi I'm trying to run PgAdmin but it is failing to connect and I am unsure why.
IResourceBuilder<ParameterResource>? postgresPassword = builder.AddParameter("postgresspassword", secret: true);

var db = builder.AddPostgres(ServiceNames.LINK_DATABASE.SERVER_NAME, postgresPassword)
.WithDataVolume()
.WithPgAdmin()
.AddDatabase(ServiceNames.LINK_DATABASE.NAME);
IResourceBuilder<ParameterResource>? postgresPassword = builder.AddParameter("postgresspassword", secret: true);

var db = builder.AddPostgres(ServiceNames.LINK_DATABASE.SERVER_NAME, postgresPassword)
.WithDataVolume()
.WithPgAdmin()
.AddDatabase(ServiceNames.LINK_DATABASE.NAME);
No description
2 Replies
nathanAjacobs
nathanAjacobsOP2mo ago
I'm using Docker Desktop and tried both with and without WSL
kurumi
kurumi2mo ago
I thinks it's better to ask in https://discord.com/channels/732297728826277939/759125320505884752 - https://aka.ms/dotnet-discord for more specific information about Aspire. I also was in this problem. The solution for me was specifying a user and password:
var username = builder.AddParameter("username", secret: true);
var password = builder.AddParameter("password", secret: true);

var db = builder
.AddPostgres("postgresdbserver", username, password)
.WithPgAdmin()
.WithDataVolume("postgresdb")
.AddDatabase("postgresdb");
var username = builder.AddParameter("username", secret: true);
var password = builder.AddParameter("password", secret: true);

var db = builder
.AddPostgres("postgresdbserver", username, password)
.WithPgAdmin()
.WithDataVolume("postgresdb")
.AddDatabase("postgresdb");
and changed connection user in PgAdmin settings from postgres to my actual user. It solves the problem. My guesses are for PgAdmin you need to specify default user as argument for container and some other information to help PgAdmin find connection.
Discord
Tritt dem DotNetEvolution-Discord-Server bei!
Sieh dir die DotNetEvolution-Community auf Discord an – häng mit 14563 anderen Mitgliedern ab und freu dich über kostenlose Sprach- und Textchats.
Want results from more Discord servers?
Add your server