aspire
aspire copied to clipboard
#3332 add devcontainer
This PR adds the first try to enable DevContainers for the Aspire project. Currently, the functionality in the codespaces of GitHub is very limited. It's enough to write tests and debug them. But to run the playground examples it's not enough because something with the dashboard is wrong there. For DevContainers on a local installation, it works quite well, if you can provide enough memory.
Currently what takes quite long when you first start the DevContainer are two things:
- creating all the base layers that will add docker / powershell / dapr
- the restore of all the projects in the repository after the devcontainer is up and running
Microsoft Reviewers: Open in CodeFlow
There is also the issue, that for the playground things to work, you need to set in the launch.json the ASPNETCORE_URLS. I don't know if this is currently a bug in all playground samples or if this should be working.
@eerhardt you did the codespaces for dotnet/runtime. Does this look reasonable?
As far as prebuild, I think (?) after this goes in I just go switch it on?
Overall this looks good. To allow for debugging of playground apps additional considerations would need to be applied :
- version of C# dev kit > 1.5.10
Its currently in pre-release
This version has some changes to debug/run in C# dev kit that would help the dev inner loop for aspire apps and we are yet to push the changes to release
- currently while running the TestShop app in codespaces : System.AggregateException: One or more errors occurred. (Unable to configure HTTPS endpoint. No server certificate was specified, and the default developer certificate could not be found or is out of date. Since current launch behavior is defaulted to https. Here is some documentation on how to configure : https://hub.docker.com/_/microsoft-devcontainers-dotnet
- To default to http, environment variable : ALLOW_UNSECURED_TRANSPORT (not recommended) would need to be set.
Rest looks good to me.
CC: @baronfel for additional review.
Overall this looks good. To allow for debugging of playground apps additional considerations would need to be applied :
- version of C# dev kit > 1.5.10 Its currently in pre-release
This version has some changes to debug/run in C# dev kit that would help the dev inner loop for aspire apps and we are yet to push the changes to release
- currently while running the TestShop app in codespaces : System.AggregateException: One or more errors occurred. (Unable to configure HTTPS endpoint. No server certificate was specified, and the default developer certificate could not be found or is out of date. Since current launch behavior is defaulted to https. Here is some documentation on how to configure : https://hub.docker.com/_/microsoft-devcontainers-dotnet
- To default to http, environment variable : ALLOW_UNSECURED_TRANSPORT (not recommended) would need to be set.
Rest looks good to me.
CC: @baronfel for additional review.
@kvenkatrajan for your issue with the HTTPS endpoint then you could run dotnet dev-certs https. That should generate the missing certificate.
In your browser you will still get a certificate warning, because your local machine is not knowing / trusting the certificate root. But the CLI can export the generated cert. (dotnet dev-certs https --export-path ~/mydevcert.pfx --password "securePassword") This can be then applied as a trusted root on your OS. (depends on your local OS how)
Overall this looks good. To allow for debugging of playground apps additional considerations would need to be applied :
- version of C# dev kit > 1.5.10 Its currently in pre-release
This version has some changes to debug/run in C# dev kit that would help the dev inner loop for aspire apps and we are yet to push the changes to release
The problem there is, that I currently don't see a way to specify the use of prerelease version of extensions in devcontainers. If you take a look into the spec of devcontianers, the extensions property is a list of extension ids without version numbers.
The problem there is, that I currently don't see a way to specify the use of prerelease version of extensions in devcontainers. If you take a look into the spec of devcontianers, the extensions property is a list of extension ids without version numbers.
I think this should be fine but just giving a headsup that debugging might not work for playground apps in codespaces till this version is live. Maybe worth specifying that in the machine-requirements.md
@danmoseley @timheuer Is there anything missing from this? It would be great to have this merged.
ping @danmoseley and @timheuer :)
Okay I will close this PR because I saw on twitter that someone else added dev container support. :/ A bit sad about the not existing communication at the end...
#6491
mea culpa @paule96, we should have integrated this PR! There were other changes that included making this aspire work in codespaces that were done as well but that's not an excuse.
@davidfowl yes but probably a new pullrequest would be better, because merging this now is I guess a bit wrong. Let me see if I find the time today to reopen a new PR with just the changes that are left. My quick analysis is:
- migrate the docs
- add the dapr init post command
- maybe change the base image to the Ubuntu version (has only benefits on windows as far as I know, in combination with the SshD service)
- add the intellicode extension
- add the editorconfig extension
@paule96 sorry I didn't see your PR here when I merged mine. I did the work on improving the codespaces support so that the dashboard would show the port forwarded URLs. If you do put up another PR with these changes feel free to tag me in it so we can do a quick review.
This version has some changes to debug/run in C# dev kit that would help the dev inner loop for aspire apps and we are yet to push the changes to release