Skip to content

Standalone workspace directly on Coder host, no templates #2108

Closed

Description

@bpmct

For simple Coder deployments, it would be great to code directly on the Coder host (where you deployed Coder). Similar to cloud shells in AWS, GCP, Azure, or Proxmox.

  • deploy Coder and instantly have a workspace + web IDE
  • create/edit templates directly via the web terminal/code-server
    • deploy Coder on AWS with one-click, log in, add templates
  • use Coder in "single player mode" without having to create templates
    • quick time to IDE like code-server, but with support for desktop IDEs + JetBrains
  • install cloud CLIs for use with templates (aws-cli, terraform, gcloud, kubectl)

Since this poses a risk for large-scale deployments or IaC-only environments, a feature like this should be:

  • optional: enabled/disabled via an environment variable
  • role-restricted: only admins (or the "admin" user) can use it

Concepts:

"new workspace" screen

workspaces page

or (like cloud shell in GCP)

cloud shell concept

Activity

  1. ketang commented on Jun 7, 2022

    @ketang
    Contributor

    Absolutely positively disabled by default.

    Would something based on Docker or Docker Compose be appropriate here?

  2. bpmct commented on Jun 7, 2022

    @bpmct
    MemberAuthor

    Would something based on Docker or Docker Compose be appropriate here?

    I imagine this would be similar/equivalent to (pre)installing the Docker template on Coder and creating a workspace? I think this would work well in many cases. A "kitchensink" Dockerfile with aws-cli, gcloud, terraform, kubectl, and code-server can be provided. However, it's unclear to me how the user would add additional dependencies to an image, if they wanted to authenticate with more cloud CLIs or use the host as a single-user dev machine.

    Serving a workspace directly on the host achieves something closer to code-server's Install -> Add dependencies -> Start coding flow. There's no need to modify container images or templates. Just set up like any new computer. There are advantages and disadvantages to both 🤷🏼

    It's also worth mentioning that Proxmox and GitHub Enterprise give the "installer/admin account" direct access to the host through their product (for configuration/debug purposes). Because of this, I'm not convinced this feature request is an anti-pattern, but I see why it should be disabled in many deployments that prefer to use IaC/GitOps to the manage Coder host environment and templates.

  3. ketang commented on Jun 7, 2022

    @ketang
    Contributor

    I think @spikecurtis has ideas here that could solve this.

    I don't think it's wise to give what's basically a remote shell on a service host. Those others can do whatever they want; I see too much risk here. I'm surprised they get by security reviews with that; maybe being able to disable it suffices? I'm willing to force a small inconvenience on a customer to enable this in exchange for avoiding the chance that this capability exists and surprises them, potentially in a bad way.

  4. bpmct commented on Jun 7, 2022

    @bpmct
    MemberAuthor

    The more I think about it, it doesn't really matter if a container has aws-cli or gcloud, because it must be present on the host itself to work with Coder templates.

    Maybe some mounted home volume magic on a container could give us the best of both worlds

  5. jsjoeio commented on Jun 7, 2022

    @jsjoeio
    Contributor

    @bpmct for those who might not be familiar, can you explain what you mean by Coder host? Like is this a sandbox, is this a "trial provider" or something else?

    And also the motivation (maybe mention time to first workspace, reducing friction for trying out the product)

  6. bpmct commented on Jun 7, 2022

    @bpmct
    MemberAuthor

    A Coder host would be whatever machine you are hosting Coder on (laptop, AWS VM, container, etc) @khorne3 is working on a doc that should help us align on terminology ;)

    Added one sentence about time to first workspace

  7. jsjoeio commented on Jun 7, 2022

    @jsjoeio
    Contributor

    Re: "time to first workspace" - we discussed how this compares in v2 vs code-server. Hoping that using a Coder host would reduce this and make it easier to try out the product.

    image

  8. spikecurtis commented on Jun 7, 2022

    @spikecurtis
    Collaborator

    Calling direct, un-encapsulated access to the Coder host a "workspace" feels like a bad plan. After all, the person who deploys coder to a server almost certainly already has SSH (or similar) access to that machine. We are not providing any value by recreating that access.

    One other observation is that currently, the coder install just installs the coder binary, and so basically everything will fail because Terraform isn't installed. So, there is a whole pre-req that we need to include in our installer or document. We could include an optional step to get Docker installed, at which point we could get a Dockerized workspace running on the same host fairly easily.

  9. bpmct commented on Jun 7, 2022

    @bpmct
    MemberAuthor

    so basically everything will fail because Terraform isn't installed

    Terraform isn't required on the host to use Coder.

    After all, the person who deploys coder to a server almost certainly already has SSH (or similar) access to that machine. We are not providing any value by recreating that access.

    I think it would provide equal value as code-server (use web IDE) + additional value to connect to different web apps or IDEs. If we want to consider Coder a natural progression from using code-server, this "direct host" model starts to make a bit more sense, but I can see the downsides.

    We could include an optional step to get Docker installed, at which point we could get a Dockerized workspace running on the same host fairly easily.

    I do agree this is the best solution, if the home volume in the container shared with a host "coder" user. Then, for example, one could authenticate with AWS from the container and ~/.aws/config is used by the host. Same for kube context, google cloud, etc.

  10. ammario commented on Jun 7, 2022

    @ammario
    Member

    I'm in support of the proposal. We are adding value through convenience. Want to quickly manage your Coder deployment? Open it up in code-server.

    I think we can achieve this without additional configuration, too.

    The admin role as it stands is a misnomer. It should probably be "root" or "deployer". I prefer "root" since everyone knows you're not supposed to use "root" except transiently. Everyone also knows "root" is dangerous.

    Our "root" user already has full shell access to every workspace, letting them steal secrets and manipulate workspaces at will. We have clear instructions from our customer that this is a Big Bad. Our major deployments will disable the root user. Thus, we're only adding marginal risk by letting the root user shell into the box.

    Finally, this is a convenience feature so it's easily reversed. If the security costs outweigh the virality benefits, we remove it.

  11. ammario commented on Jun 7, 2022

    @ammario
    Member

    Here is some precedent from GitHub Enterprise for giving superadmins shell access to the deployment.

  12. spikecurtis commented on Jun 7, 2022

    @spikecurtis
    Collaborator

    Terraform isn't required on the host to use Coder.

    It's not required for coderd, but it is for provisionerd and today, these run in the same process. We have future plans to allow people to run a standalone provisionerd, but it is not yet supported. In any case, the scenario we're discussing here is a single-machine deployment of Coder and so terraform needs to be installed. Ignore me here, wasn't aware that the provisioner downloads terraform if it isn't present.

  13. spikecurtis commented on Jun 7, 2022

    @spikecurtis
    Collaborator

    Want to quickly manage your Coder deployment? Open it up in code-server.

    This makes some sense to me for provisionerd, since we recommend that they run it with the environment authenticated with cloud providers.

    With the caveat that coderd and provisionerd are currently joined at the hip, I don't think it makes sense to configure coderd with a remote IDE, because other than very low level config required for coderd to function at all (postgres connect string, access URL, etc), coderd doesn't have persistent state on the host machine. Our goal is to allow all the configuration that matters for coderd to be configured via APIs (and by extension, the CLI and WebUI).

  14. 3 remaining items

  15. added this to the Community MVP milestone on Jun 8, 2022
  16. bpmct commented on Jun 8, 2022

    @bpmct
    MemberAuthor

    Some things discussed synchronously, still subject to change:

    • run directly on the host, primary purpose is editing templates
    • code-server button will be greyed out by default, pressing it will allow user to install via install script on the host
      • if code-server is in PATH (or running on specified port?), it will be launched
    • name idea: Coder Shell, a good place to manage templates without the installing the CLI
    • good candidate for README demo
  17. removed this from the Community MVP milestone on Jun 14, 2022
  18. unpinned this issue on Jul 25, 2022
  19. github-actions commented on Aug 17, 2022

    @github-actions
    Contributor

    This issue is becoming stale. In order to keep the tracker readable and actionable, I'm going close to this issue in 7 days if there isn't more activity.

  20. reopened this on Aug 23, 2022
  21. ammario commented on Aug 31, 2022

    @ammario
    Member

    #3331 moves us towards the goals of this issue in a simpler fashion.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    apiArea: HTTP APIstaleThis issue is like stale bread.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions