coder / coder

Provision remote development environments via Terraform
https://coder.com
GNU Affero General Public License v3.0
8.06k stars 677 forks source link

Add `coder_app` at runtime from within the workspace #3808

Open phorcys420 opened 2 years ago

phorcys420 commented 2 years ago

it would be a nice-to-have for temporary dev environments, e.g do npm run serve in your project dir and it would automatically add a "My App" application in the apps list.

I was thinking it'd also be a good thing to have a timeout, e.g the app would delete itself after 30 minutes with no requests.

@mafredri suggested that you could define apps with YAML and also mentionned that there should be a way to "lock this down or control the available apps" for the template authors.

On the other hand, I was more thinking of a thing like coderagent application add [..] but YAML is fine-ish too, even though it'd remove the "on-the-fly" capacities of it.

bpmct commented 2 years ago

We're doing this with #4167! :)

bpmct commented 2 years ago

Well, not the auto-detection logic but that can be a next step

phorcys420 commented 1 year ago

We're doing this with #4167! :)

I guess this works too but I was thinking about adding app buttons, I think this is a start though.

I could make an URL "generator" based on the workspace name and author passed to the workspace with env variables so it reduces the user workflow and the program just spits out a premade URL.

kylecarbs commented 1 year ago

@phorcys420 I'm going to close this for now because the abstraction gets a bit funky if we combine the pre-defined and dynamic ideas. Maybe we introduce a difference concept of port-naming that can be done dynamically?

phorcys420 commented 3 months ago

Hey @kylecarbs, could you reopen this issue?

Back when I first requested this there wasn't really a reason for that feature to exist except for better Developer Experience when the project you're working on is aware of Coder.

But now that Devcontainers are becoming mainline with v1 of envbuilder I think we need a way for templates/devcontainer administrators to define coder_apps dynamically from within the devcontainer. Another option would be to modify the count attribute of a coder_app based on the devcontainer but that has limits and doesn't scale really well.

Let's say I use a devcontainer that uses the desktop-lite feature, well I'd still like to have a first-party user experience like if I was using "regular" noVNC in a Docker container. Sure, you could define the coder_app manually but if a workspace doesn't have it then you have a useless button on the screen, and the opposite is also true, if I don't define a coder_app but there's an app that would deserve a button, then there's none.


I'm not sold on whether making it truly dynamic is the best way but I think something would need to be done anyways :-)