dotnet / aspire

Tools, templates, and packages to accelerate building observable, production-ready apps
https://learn.microsoft.com/dotnet/aspire
MIT License
3.87k stars 465 forks source link

[CodeSpaces] Dashboard URIs is looking for a URL that may not work #1297

Closed timheuer closed 1 month ago

timheuer commented 11 months ago

The dashboard page literally seeks for http://localhost:<port_number> - It makes sense as long as it's on my local machine, but not on Codespaces. When it is running on GitHub Codespaces, it should open https://xxxxx-<port>.app.github.dev.

timheuer commented 11 months ago

@justinyoo On this one did you try to load the localhost URI? Codespaces should be doing port forwarding and take care of this so you don't have to know of the github.dev URI.

For example clicking the localhost:18888 link in my codespace properly launched the dashboard using portforwarding:

image

timheuer commented 11 months ago

I see what you are saying now -- misinterpreted as "the dashboard URI" -- you mean the endpoints of any apps listed in the dashboard are not going to 'just work' launched from the dashboard

timheuer commented 11 months ago

FWIW, when running in a codespace there are some env vars that may help build up the clickable URI:

image

and thus the localhost:port portion of the scheme could be translated as {env.CODESPACE_NAME}-{port}.app.github.dev

justinyoo commented 11 months ago

I see what you are saying now -- misinterpreted as "the dashboard URI" -- you mean the endpoints of any apps listed in the dashboard are not going to 'just work' launched from the dashboard

That's correct. For example, the dashboard shows web app with http://localhost:5000, within GitHub Codespaces, it should launch {env.CODESPACE_NAME}-5000.app.github.dev.

davidfowl commented 8 months ago

Do any of you have a repository with aspire that is codespace ready that I can try?

timheuer commented 7 months ago

@davidfowl Here's one https://github.com/timheuer/SimpleAspireStarterCodespace (has the devcontainer definition to install Aspire workloads)

davidfowl commented 7 months ago

Excellent! IT seems that after the vs code work lands one of the remaining pieces will be how we make the dashboard urls show the proxied addresses.

timheuer commented 7 months ago

@davidfowl if you see a few comments up (https://github.com/dotnet/aspire/issues/1297#issuecomment-1847976960) the env vars will be written when in a codespace environment so Dashboard could check for existence of that and replace localhost.

mitchdenny commented 1 month ago

Closing this in favor of #1178. In a comment I've left some code that works to remap the localhost addreses on the dashboard to proxied addreses.