Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Auto start workspace when I connect via SSH or visit an app #4973

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Tracked by #4978
bpmct opened this issue Nov 9, 2022 · 10 comments · Fixed by #11050
Closed
Tracked by #4978

Auto start workspace when I connect via SSH or visit an app #4973

bpmct opened this issue Nov 9, 2022 · 10 comments · Fixed by #11050
Assignees
Labels
networking Area: networking

Comments

@bpmct
Copy link
Member

bpmct commented Nov 9, 2022

I primarily interact with my workspace via VS Code Remote SSH by clicking my workspace in the sidebar. However, it's often off.

I'm proposing the following behavior:

  1. When I SSH into a stopped workspace (e.g. ssh coder.ben-stable), the workspace starts and streams the build log until it is finished. Then, the SSH connection starts. No need for the user to confirm. They clearly want to access their workspace.

    • Perhaps a configurable coder config-ssh --disable-auto-start flag could disable this behavior. Doesn't seem necessary though
  2. When I visit a URL for an app on an agent (e.g. https://dev.coder.com/@bpmct/ben-stable.dev/apps/code-server/?folder=/home/coder/coder), the workspace starts and I can follow along with the build log. Once complete, and the app health check passes, I am redirected to the app. Related: Support starting the workspace when launching a coder_app when it's off #2909

    • If the user does not own the workspace, but only has access to the app, perhaps it displays some generic "Starting workspace..." text?

To validate:

  • Will this work OK with VS Code Remote SSH (the primary way I connect to my workspace) or do we need VS Code Extension #3597?
@bpmct
Copy link
Member Author

bpmct commented Jan 11, 2023

We do this in our VS Code Extension now :)

@github-actions
Copy link

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.

@github-actions github-actions bot added the stale This issue is like stale bread. label Apr 26, 2023
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale May 3, 2023
@bpmct bpmct reopened this Jun 12, 2023
@github-actions github-actions bot removed the stale This issue is like stale bread. label Jun 13, 2023
@spikecurtis spikecurtis added feature networking Area: networking labels Sep 25, 2023
@spikecurtis
Copy link
Contributor

When I SSH into a stopped workspace (e.g. ssh coder.ben-stable), the workspace starts and streams the build log until it is finished. Then, the SSH connection starts. No need for the user to confirm. They clearly want to access their workspace.

It will be very challenging to achieve this flow with ssh (e.g. OpenSSH). I think we already support a lot of it with coder ssh.

The problem with OpenSSH is that it calls coder as a ProxyCommand, which is supposed to make a connection to the workspace.

  1. Anything we write to stdout is meant to be the SSH protocol, not random text like build logs. We could try writing to stderr instead; I'm not sure what OpenSSH will do with it. It might not do anything and the user is stuck with no feedback that a build is happening behind the scenes.
  2. OpenSSH likely sets a connection timeout on the ProxyCommand. If we are busy building the workspace, we are likely going to bump up against this timeout. Combined with the above issue, it might just look like a network problem instead of it being that the workspace was switched off.

@mafredri
Copy link
Member

@spikecurtis We already show provisioner/startup logs during SSH if the workspace is still starting, so I think it should work 🤔. Unless there's some scenarios in which it doesn't work. (The logs are indeed output to stderr for the ProxyCommand, and show up in the terminal.)

The config-ssh command also sets ConnectionTimeout to 0, so there's nothing to worry about there.

@Emyrk
Copy link
Member

Emyrk commented Nov 29, 2023

Do we necessarily always want to autostart? In v1 we had a command prompt ask if you wanted to start the workspace (only worked with coder ssh).

It feels a bit strange to me to assume the user always wants the workspace auto started.

@gtaylor
Copy link

gtaylor commented Nov 29, 2023

I don't want to assume that this would be the case for every user, but we lean on our workspace suspension TTLs to clean up idle workspaces. The cost of starting a workspace is lower for us than additional friction for our users. Users will "fire" us if there is too much friction vs their pre-Coder workflows and habits.

I'd suggest that we do the most intuitive thing by giving the user what they and/or their IDE has requested. The user doesn't care about the infrastructure (starting, stopping, etc), they just want to do their dev work.

You could then add an option if there's enough user feedback to warrant the investment.

@mafredri
Copy link
Member

@Emyrk I'm of the mind it should be a config-ssh option. It'd probably make sense to have it be the default (or use a deployment default) to auto-start given that if you're trying to SSH in, you're probably going to start it anyway. But admins may want to disallow this and users may not always want it happening.

@Emyrk
Copy link
Member

Emyrk commented Nov 29, 2023

@mafredri if it is some sort of "opt in", then I think we can have the coder proxy command run the start, and delay the initial ssh.

I do agree there is the problem of presenting feedback to the user that this is happening, but it sounds easier than the "prompt" problem.

@mafredri
Copy link
Member

mafredri commented Nov 30, 2023

@mafredri if it is some sort of "opt in", then I think we can have the coder proxy command run the start, and delay the initial ssh.

@Emyrk I'd lean towards opt-out, but essentially yes. Btw, we already delay the SSH command so everything should be in place except the autostart.

I do agree there is the problem of presenting feedback to the user that this is happening, but it sounds easier than the "prompt" problem.

What's the problem, exactly? Yes, we can't prompt, but we can display output and already do. See the following recording:

asciicast

@MaximeNoulin
Copy link

To give some feedbacks about our use cases, we're more interested in the auto-start when accessing an app. This would allow a friction-less experience to developers that use the online IDE. Also, this would make our review process a lot more easier.
A feature comparable to what it's already done on Github Codespaces or Gitpod would be perfect!
Thank you all for your amazing work!
Let me know if you need more info about our usecases.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
networking Area: networking
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants