Skip to content

docs concept: workspace activity auto-stop #3529

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
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added docs/images/add-bumper-terminal.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/auto-start.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/auto-stop.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
42 changes: 42 additions & 0 deletions docs/workspaces.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,48 @@ resources](./templates.md#persistent-and-ephemeral-resources).

When a workspace is deleted, all of the workspace's resources are deleted.

## Workspace Schedule

You can set a schedule for you workspace to automatically start at a given time (e.g. Monday - Friday at 9 AM).

![Auto start](./images/auto-start.png)

You can also set a "time until shutdown" to auto-stop your workspace (e.g "8" hours after stopped).

![Auto stop](./images/auto-stop.png)

In order to use your workspace past the "time until shutdown," you can use bumpers in the dashboard to keep the workspace alive:

![Dashboard bumpers](./images/add-bumper-terminal.png)

### Activity detection (alpha)

To keep your workspace running past the "time until shutdown," Coder can bump the workspace lifetime by 1 hour when it detects any of the following activities:

- Open tunnel (SSH connection)

If you have an open tunnel/SSH connection, the CLI will send keepalives to Coder, even if you are not typing.

Use `coder tunnel --disable-keep-alive` or `coder config-ssh --disable-keep-alive` to avoid send keepalives to Coder.

- HTTP (or websocket) request on `coder_app`

Coder's proxy will detect any traffic on apps (e.g. code-server)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For websockets, it is not clear to me whether we bump the lifetime only on the websocket request, or periodically while it is open like the SSH connection

Copy link
Member Author

@bpmct bpmct Aug 16, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Emyrk any thoughts here? I'd imagine websockets are more likely to be left open (vs SSH connections), but I'm admittedly not the expert here 🤷🏼

Copy link
Member Author

@bpmct bpmct Aug 16, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@spikecurtis would love your thoughts too. Happy to guess here and adjust from feedback 😝

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do know that Jupyter keeps a websocket open while you are interacting with a notebook. So, without periodic bumps, we would not consider a user "active" if they were working in a single Jupyter notebook. (opening new notebooks would cause a bump)

If we're going to do periodic bumps on an SSH connection, I think we should also do the same for any websockets open to coder_apps

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense to me!

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't any ide app have some sort of long lived connection? For sending keystrokes and whatnot?

I agree with Spike


- Typing in web terminal
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this be rolled up into apps?


- API Request (Manual/custom integrations)

```sh
curl https://coder.example.com/api/v2/workspaces/id/extend
```

> To prevent false positives, we are considering using VS Code and JetBrains plugins to detect activity, instead of examining network requests. [Let us know](https://github.com/coder/coder/needs-issue) if this feature interesting is to you.

If a template has a maximum lifetime (e.g. 16 hours), workspaces can no longer be bumped manually or by activity after that time.

> If you are a Coder admin and would like increased visibility and fine-grained controls on auto start/stop, [we'd like to hear from you](https://coder.com/contact)

## Updating workspaces

Use the following command to update a workspace to the latest template version.
Expand Down