dotnet / aspire

An opinionated, cloud ready stack for building observable, production ready, distributed applications in .NET
https://learn.microsoft.com/dotnet/aspire
MIT License
3.6k stars 397 forks source link

Enhance Documentation/Tooling for Discovering Container Ports in Use #2171

Open Chcoflex opened 6 months ago

Chcoflex commented 6 months ago

Problem Description: When working with the eShop repository and its associated Docker containers, I encountered difficulty in determining which ports were being used by specific services, such as the Postgres database container. This information is crucial for connecting external tools (e.g., pgAdmin4) from the host OS for management and debugging purposes.

Example Case: I spent a significant amount of time trying to figure out the correct port to connect pgAdmin4 to the locally running instance of Postgres. The lack of clear documentation or tooling to quickly identify the port mappings for running containers added unnecessary overhead to my development and debugging process.

Rationale: Improving the accessibility of this information would significantly streamline the development and debugging process for new and existing contributors. It reduces the initial friction of setting up a local development environment and enhances the overall developer experience when interacting with the containers.

davidfowl commented 6 months ago

I think the obvious place to put this would be in the details view of the resource itself.

@drewnoakes is there a way to mark a property as a secret in the dashboard UI? I think we would need to do that for properties that could container information that we shouldn't show by default (passwords etc).

drewnoakes commented 6 months ago

We mask out environment variables by default and could extend this to resource properties by adding some metadata to identify maskable properties. Masking only prevents accidentally revealing the data on your screen to onlookers by requiring an extra click to unmask values.

The app host will need to plumb the postgres endpoint across the resource service too.

mitchdenny commented 4 months ago

@Chcoflex not a direct answer to your question, but did you know that you can do this?

builder.AddPostgres("pgsql").WithPgAdmin()

We'll spin up PG Admin in a container and preconfigure it to connect to the Postgres instance. You can then just click on the link in the Dashboard to take you to it.