dotnet / docs-aspire

This repository contains .NET Aspire documentation.
https://learn.microsoft.com/dotnet/aspire
MIT License
65 stars 75 forks source link

Development Containers (Hollistic Issue) #540

Open josephaw1022 opened 3 months ago

josephaw1022 commented 3 months ago

Describe the issue or suggestion

So, I noticed in the documentation and playground directory in the source code that there seems to be no mention or little mention of how to use aspire in dev container based workflow.

here is one that I have been using very frequently to spin up apps

{
  "name": "Aspire & Dapr",
  "image": "mcr.microsoft.com/devcontainers/dotnet:8.0-jammy",
  "workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}",
  "features": {
    "ghcr.io/devcontainers/features/docker-in-docker:2": {
      "version": "latest",
      "enableNonRootDocker": true,
      "moby": true
    },
    "ghcr.io/prom3theu5/aspirational-manifests/aspirate:latest": {},
    "ghcr.io/devcontainers/features/github-cli:1": {},
    "ghcr.io/azure/azure-dev/azd:0": {
      "version": "latest"
    },
    "ghcr.io/devcontainers/features/common-utils:2": {},
    "ghcr.io/dapr/cli/dapr-cli:0": {}
  },
  "runArgs": [
    "--sysctl",
    "net.ipv6.conf.all.disable_ipv6=0",
    "--sysctl",
    "net.ipv6.conf.default.forwarding=1",
    "--sysctl",
    "net.ipv6.conf.all.forwarding=1"
  ],
  "customizations": {
    "vscode": {
      "extensions": [
        "ms-dotnettools.csdevkit",
        "ms-azuretools.vscode-dapr",
        "ms-azuretools.vscode-docker",
        "redhat.vscode-yaml",
        "streetsidesoftware.code-spell-checker",
        "ms-azuretools.vscode-bicep",
        "eamodio.gitlens"
      ]
    }
  },
  "postCreateCommand": "dotnet workload update && dotnet workload install aspire && dotnet tool install -g aspirate --prerelease &&  docker compose up -d && dapr init",
  "remoteUser": "root"
}

while there are definitely better ways that something like this could be done, I do want to see if some mention and examples of dev containers could be added to the documentation.

New Section To Getting Started

For example, I think that a "dev container based" getting started guide would be really useful for those who are hesitant to download anything new or in preview to their laptop.

image

Adding Example Dev Containers Files To Project

There are many ways to work with Dotnet aspire and there's no one way to setup your dev container. For example, if your local workflow is just using aspire to spin up a .net api that is using a local sql server, then your dev container file is going to look very different to someone that is using dcp to orchestrate containers or integrate dapr. So I think a page with some example code block examples with example scenarios would be beneficial.

IEvangelist commented 3 months ago

I'm curious what @timheuer thinks about this?

timheuer commented 3 months ago

I think this would be great, but one thing we need to feel good about first is the 'simple' devcontainer scenario (e.g., Codespaces). We're working on validating some of that and until we feel good about that before we can be affirmitive about the other scenarios. Codespaces is on our path to validate some of the aspects of port forwarding, etc. and ensuring works with VS Code.

This is currently our tracking validation issue we are using: https://github.com/dotnet/aspire/issues/1178

CamSoper commented 3 months ago

@IEvangelist when we get the go-ahead, I want this one

IEvangelist commented 3 months ago

@IEvangelist when we get the go-ahead, I want this one

All yours!

IEvangelist commented 2 months ago

@CamSoper are you able to work on this for the GA timeline, by next week? 😬

CamSoper commented 2 months ago

@IEvangelist Yep, top priority

CamSoper commented 2 months ago

@timheuer I see https://github.com/dotnet/aspire/issues/1178 is still open. Do you want me to write up a "how to" with the caveat that Codespaces has certain limitations? Or are we still holding off on documenting this?

cc: @IEvangelist

timheuer commented 2 weeks ago

I think I'd wonder what it would look like with caveats -- I'm afraid the caveats might be long and confusing, thus feeling like the documentation is more of an explanation of incomplete work? I'd be open to reviewing what that might look like though...