Skip to content

Commit 8fb0295

Browse files
committed
notes about dev containers and scheduling
1 parent 00ba027 commit 8fb0295

File tree

1 file changed

+32
-16
lines changed

1 file changed

+32
-16
lines changed

docs/admin/templates/extending-templates/prebuilt-workspaces.md

Lines changed: 32 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,6 @@
11
# Prebuilt workspaces
22

3-
> [!WARNING]
4-
> Prebuilds Compatibility Limitations:
5-
> Prebuilt workspaces currently do not work reliably with [DevContainers feature](../managing-templates/devcontainers/index.md).
6-
> If your project relies on DevContainer configuration, we recommend disabling prebuilds or carefully testing behavior before enabling them.
7-
>
8-
> We’re actively working to improve compatibility, but for now, please avoid using prebuilds with this feature to ensure stability and expected behavior.
9-
10-
Prebuilt workspaces allow template administrators to improve the developer experience by reducing workspace
3+
Prebuilt workspaces (prebuilds) allow template administrators to improve the developer experience by reducing workspace
114
creation time with an automatically maintained pool of ready-to-use workspaces for specific parameter presets.
125

136
The template administrator configures a template to provision prebuilt workspaces in the background, and then when a developer creates
@@ -21,6 +14,9 @@ Prebuilt workspaces are:
2114
- Monitored and replaced automatically to maintain your desired pool size.
2215
- Automatically scaled based on time-based schedules to optimize resource usage.
2316

17+
Currently, Prebuilt workspaces are not fully compatible with the
18+
[dev containers integration](../extending-templates/devcontainers.md) or with [workspace scheduling features](../../../user-guides/workspace-scheduling.md) like autostart and autostop.
19+
2420
## Relationship to workspace presets
2521

2622
Prebuilt workspaces are tightly integrated with [workspace presets](./parameters.md#workspace-presets):
@@ -52,7 +48,7 @@ instances your Coder deployment should maintain, and optionally configure a `exp
5248
prebuilds {
5349
instances = 3 # Number of prebuilt workspaces to maintain
5450
expiration_policy {
55-
ttl = 86400 # Time (in seconds) after which unclaimed prebuilds are expired (1 day)
51+
ttl = 86400 # Time (in seconds) after which unclaimed prebuilds are expired (86400 = 1 day)
5652
}
5753
}
5854
}
@@ -123,6 +119,10 @@ New prebuilt workspaces are only created to maintain the desired count if needed
123119
Prebuilt workspaces support time-based scheduling to scale the number of instances up or down.
124120
This allows you to reduce resource costs during off-hours while maintaining availability during peak usage times.
125121

122+
> [!IMPORTANT]
123+
> Use scheduling for prebuilt workspaces instead of
124+
> [workspace scheduling features](../../../user-guides/workspace-scheduling.md).
125+
126126
Configure scheduling by adding a `scheduling` block within your `prebuilds` configuration:
127127

128128
```tf
@@ -158,17 +158,17 @@ data "coder_workspace_preset" "goland" {
158158

159159
**Scheduling configuration:**
160160

161-
- **`timezone`**: The timezone for all cron expressions (required). Only a single timezone is supported per scheduling configuration.
162-
- **`schedule`**: One or more schedule blocks defining when to scale to specific instance counts.
163-
- **`cron`**: Cron expression interpreted as continuous time ranges (required).
164-
- **`instances`**: Number of prebuilt workspaces to maintain during this schedule (required).
161+
- `timezone`: (Required) The timezone for all cron expressions. Only a single timezone is supported per scheduling configuration.
162+
- `schedule`: One or more schedule blocks defining when to scale to specific instance counts.
163+
- `cron`: (Required) Cron expression interpreted as continuous time ranges.
164+
- `instances`: (Required) Number of prebuilt workspaces to maintain during this schedule.
165165

166166
**How scheduling works:**
167167

168168
1. The reconciliation loop evaluates all active schedules every reconciliation interval (`CODER_WORKSPACE_PREBUILDS_RECONCILIATION_INTERVAL`).
169-
2. The schedule that matches the current time becomes active. Overlapping schedules are disallowed by validation rules.
170-
3. If no schedules match the current time, the base `instances` count is used.
171-
4. The reconciliation loop automatically creates or destroys prebuilt workspaces to match the target count.
169+
1. The schedule that matches the current time becomes active. Overlapping schedules are disallowed by validation rules.
170+
1. If no schedules match the current time, the base `instances` count is used.
171+
1. The reconciliation loop automatically creates or destroys prebuilt workspaces to match the target count.
172172

173173
**Cron expression format:**
174174

@@ -301,6 +301,22 @@ The prebuilt workspaces feature has these current limitations:
301301

302302
[View issue](https://github.com/coder/internal/issues/364)
303303

304+
- **Dev containers**
305+
306+
Prebuilt workspaces do not work reliably with the [dev containers integration](../extending-templates/devcontainers.md).
307+
308+
If your project relies on a dev container configuration, we recommend disabling prebuilds or carefully testing behavior before enabling them.
309+
310+
- **Workspace autostart/autostop**
311+
312+
Disable any form of [workspace scheduling features](../../../user-guides/workspace-scheduling.md)
313+
like autostart and autostop for prebuilt workspaces.
314+
315+
Instead, use the [prebuilt-specific TTL and scheduling features](#scheduling).
316+
317+
Prebuilt workspaces with an active autostop configuration can lead to "zombie" workspaces that the Coder server
318+
will not automatically reconcile.
319+
304320
### Monitoring and observability
305321

306322
#### Available metrics

0 commit comments

Comments
 (0)