|
| 1 | +# Workspace Scheduling |
| 2 | + |
| 3 | +You can configure a template to control how workspaces are started and stopped. |
| 4 | +You can also manage the lifecycle of failed or inactive workspaces. |
| 5 | + |
| 6 | + |
| 7 | + |
| 8 | +## Schedule |
| 9 | + |
| 10 | +Template [admins](../../users/README.md) may define these default values: |
| 11 | + |
| 12 | +- [**Default autostop**](../workspaces.md#autostart-and-autostop): How long a |
| 13 | + workspace runs without user activity before Coder automatically stops it. |
| 14 | +- [**Autostop requirement**](#autostop-requirement-enterprise-premium): Enforce |
| 15 | + mandatory workspace restarts to apply template updates regardless of user |
| 16 | + activity. |
| 17 | +- **Activity bump**: The duration of inactivity that must pass before a worksace |
| 18 | + is automatically stopped. |
| 19 | +- **Dormancy**: This allows automatic deletion of unused workspaces to reduce |
| 20 | + spend on idle resources. |
| 21 | + |
| 22 | +## Allow users scheduling |
| 23 | + |
| 24 | +For templates where a uniform autostop duration is not appropriate, admins may |
| 25 | +allow users to define their own autostart and autostop schedules. Admins can |
| 26 | +restrict the days of the week a workspace should automatically start to help |
| 27 | +manage infrastructure costs. |
| 28 | + |
| 29 | +## Failure cleanup (enterprise) |
| 30 | + |
| 31 | +Failure cleanup defines how long a workspace is permitted to remain in the |
| 32 | +failed state prior to being automatically stopped. Failure cleanup is an |
| 33 | +enterprise-only feature. |
| 34 | + |
| 35 | +## Dormancy threshold (enterprise) |
| 36 | + |
| 37 | +Dormancy Threshold defines how long Coder allows a workspace to remain inactive |
| 38 | +before being moved into a dormant state. A workspace's inactivity is determined |
| 39 | +by the time elapsed since a user last accessed the workspace. A workspace in the |
| 40 | +dormant state is not eligible for autostart and must be manually activated by |
| 41 | +the user before being accessible. Coder stops workspaces during their transition |
| 42 | +to the dormant state if they are detected to be running. Dormancy Threshold is |
| 43 | +an enterprise-only feature. |
| 44 | + |
| 45 | +## Dormancy auto-deletion (enterprise) |
| 46 | + |
| 47 | +Dormancy Auto-Deletion allows a template admin to dictate how long a workspace |
| 48 | +is permitted to remain dormant before it is automatically deleted. Dormancy |
| 49 | +Auto-Deletion is an enterprise-only feature. |
| 50 | + |
| 51 | +## Autostop requirement (enterprise) (premium) |
| 52 | + |
| 53 | +Autostop requirement is a template setting that determines how often workspaces |
| 54 | +using the template must automatically stop. Autostop requirement ignores any |
| 55 | +active connections, and ensures that workspaces do not run in perpetuity when |
| 56 | +connections are left open inadvertently. |
| 57 | + |
| 58 | +Workspaces will apply the template autostop requirement on the given day in the |
| 59 | +user's timezone and specified quiet hours (see below). This ensures that |
| 60 | +workspaces will not be stopped during work hours. |
| 61 | + |
| 62 | +The available options are "Days", which can be set to "Daily", "Saturday" or |
| 63 | +"Sunday", and "Weeks", which can be set to any number from 1 to 16. |
| 64 | + |
| 65 | +"Days" governs which days of the week workspaces must stop. If you select |
| 66 | +"daily", workspaces must be automatically stopped every day at the start of the |
| 67 | +user's defined quiet hours. When using "Saturday" or "Sunday", workspaces will |
| 68 | +be automatically stopped on Saturday or Sunday in the user's timezone and quiet |
| 69 | +hours. |
| 70 | + |
| 71 | +"Weeks" determines how many weeks between required stops. It cannot be changed |
| 72 | +from the default of 1 if you have selected "Daily" for "Days". When using a |
| 73 | +value greater than 1, workspaces will be automatically stopped every N weeks on |
| 74 | +the day specified by "Days" and the user's quiet hours. The autostop week is |
| 75 | +synchronized for all workspaces on the same template. |
| 76 | + |
| 77 | +Autostop requirement is disabled when the template is using the deprecated max |
| 78 | +lifetime feature. Templates can choose to use a max lifetime or an autostop |
| 79 | +requirement during the deprecation period, but only one can be used at a time. |
| 80 | + |
| 81 | +## User quiet hours (enterprise) (premium) |
| 82 | + |
| 83 | +User quiet hours can be configured in the user's schedule settings page. |
| 84 | +Workspaces on templates with an autostop requirement will only be forcibly |
| 85 | +stopped due to the policy at the start of the user's quiet hours. |
| 86 | + |
| 87 | + |
| 88 | + |
| 89 | +Admins can define the default quiet hours for all users with the |
| 90 | +`--default-quiet-hours-schedule` flag or `CODER_DEFAULT_QUIET_HOURS_SCHEDULE` |
| 91 | +environment variable. The value should be a cron expression such as |
| 92 | +`CRON_TZ=America/Chicago 30 2 * * *` which would set the default quiet hours to |
| 93 | +2:30 AM in the America/Chicago timezone. The cron schedule can only have a |
| 94 | +minute and hour component. The default schedule is UTC 00:00. It is recommended |
| 95 | +to set the default quiet hours to a time when most users are not expected to be |
| 96 | +using Coder. |
| 97 | + |
| 98 | +Admins can force users to use the default quiet hours with the |
| 99 | +[CODER_ALLOW_CUSTOM_QUIET_HOURS](../../../reference/cli/server.md#allow-custom-quiet-hours) |
| 100 | +environment variable. Users will still be able to see the page, but will be |
| 101 | +unable to set a custom time or timezone. If users have already set a custom |
| 102 | +quiet hours schedule, it will be ignored and the default will be used instead. |
0 commit comments