diff --git a/docs/images/workspaces/approaching-stop.png b/docs/images/workspaces/approaching-stop.png new file mode 100644 index 0000000000000..b786edc4c7fc0 Binary files /dev/null and b/docs/images/workspaces/approaching-stop.png differ diff --git a/docs/images/workspaces/quiet-hours.png b/docs/images/workspaces/quiet-hours.png new file mode 100644 index 0000000000000..03bfeec5065e6 Binary files /dev/null and b/docs/images/workspaces/quiet-hours.png differ diff --git a/docs/images/workspaces/stops-after-3-hours.png b/docs/images/workspaces/stops-after-3-hours.png new file mode 100644 index 0000000000000..b7ae72f198a56 Binary files /dev/null and b/docs/images/workspaces/stops-after-3-hours.png differ diff --git a/docs/templates/index.md b/docs/templates/index.md index c9a3a455be064..401eeaa19bc4c 100644 --- a/docs/templates/index.md +++ b/docs/templates/index.md @@ -69,14 +69,37 @@ coder templates create > [examples/](https://github.com/coder/coder/tree/main/examples/templates) > directory in the repo. -## Configure Max Workspace Autostop +## Template policies (enterprise) -To control cost, specify a maximum time to live flag for a template in hours or -minutes. +By default, developers have unlimited workspace usage and can use any template version. Template policies allows you to: -```sh -coder templates create my-template --default-ttl 4h -``` +- Auto-stop workspaces after 3 hours of inactivity. +- Require workspaces to be restarted frequently to ensure they use the most recent template version. +- Disable workspace auto-start. + +### Stop policy + +Stop policies require workspaces be stopped (or restarted), regardless of activity: + +- Daily (Restart on next quiet hours) +- Weekly (Restart on weekends) +- Custom (Every 2 weeks) + + ```text + Every [2] [Weeks] on [Friday] + or + Every [2] [Days] + or + Every [4] [Weeks] on [Saturday] + ``` + +- Never + +Stops occur during a user's [quiet hours](../workspaces.md#quiet-hours), which prevent interruptions. If a user is still using their workspace, they can postpone a restart up to 3 hours. + +Learn more about [workspace auto-stop](../workspaces.md#workspace-auto-stop) + + ## Customize templates diff --git a/docs/workspaces.md b/docs/workspaces.md index 43b61f595b305..47e207ebb5530 100644 --- a/docs/workspaces.md +++ b/docs/workspaces.md @@ -37,27 +37,50 @@ information, see [Resource Persistence](./templates/resource-persistence.md). When a workspace is deleted, all of the workspace's resources are deleted. -## Workspace scheduling +## Workspace auto-stop -By default, workspaces are manually turned on/off by the user. However, a schedule -can be defined on a per-workspace basis to automate the workspace start/stop. +In Coder, workspaces can auto-stop when the user is not actively using the workspace. By default, Coder recognizes the following actions as activity and will keep the workspace online: -![Scheduling UI](./images/schedule.png) +- Open SSH connections (VS Code Extension, JetBrains Gateway, `coder ssh`) +- Open tunnels (`coder port-forward`) +- Open WebSockets (web terminal, [web IDEs](./ides/web-ides.md) such as code-server and JupyterLab) -### Autostart +> [Custom activity](#TODO) can be registered via Coder's REST API, such as an ongoing data science pipeline. -The autostart feature automates the workspace build at a user-specified time -and day(s) of the week. In addition, users can select their preferred timezone. + -![Autostart UI](./images/autostart.png) +Your workspace's auto-stop behavior can be seen in the dashboard. Template settings in Coder determine if users can alter their workspace schedules. -### Autostop +![TODO: use real screenshot](./images/workspaces/stops-after-3-hours.png) -The autostop feature shuts off workspaces after given number of hours in the "on" -state. If Coder detects workspace connection activity, the autostop timer is bumped up -one hour. IDE, SSH, Port Forwarding, and coder_app activity trigger this bump. +### Max workspace lifetime (enterprise) -![autostop UI](./images/autostop.png) +Workspaces may also have a max lifetime, which enforces a stop or restart even if you are actively using your workspace. + +![TODO: use real screenshot](./images/workspaces/approaching-stop.png) + +#### Quiet hours + +To avoid interruptions, users can establish their "quiet hours", which are by default set from midnight to 4 AM, during which these actions occur. Users can also extend the deadline by up to 3 hours if they are in the middle of important work. + +Example: + +```text +Quiet hours: 12- 4:00 AM +11:30AM: User is notified their workspace is about to stop + +user bumps +user bumps +user bumps + +4 AM: workspace stops +``` + +![TODO: use real screenshot](./images/workspaces/quiet-hours.png) + + + +Admin controls around workspace auto-stop are an enterprise feature. [Learn more here](./admin/template) ## Updating workspaces