8000 chore: add prebuild docs by dannykopping · Pull Request #17580 · coder/coder · GitHub
[go: up one dir, main page]

Skip to content

chore: add prebuild docs #17580

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

Merged
merged 22 commits into from
May 9, 2025
Merged
Changes from 1 commit
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
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
Prev Previous commit
Next Next commit
Apply suggestions from code review
Co-authored-by: Danny Kopping <danny@coder.com>
  • Loading branch information
< 10000 /div> EdwardAngert and dannykopping authored Apr 29, 2025
commit 684ef43e570be299cc99d7d8703d5c046bffa64c
25 changes: 10 additions & 15 deletions docs/admin/templates/extending-templates/prebuilt-workspaces.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,21 @@
# Prebuilt workspaces

Prebuilt workspaces (Prebuilds) allow template administrators to improve the developer experience by reducing workspace
Prebuilt workspaces allow template administrators to improve the developer experience by reducing workspace
creation time with an automatically maintained pool of ready-to-use workspaces for specific parameter presets.

The template administrator configures a template to be available with prebuilt workspaces, and then when a developer creates
The template administrator configures a template to provision prebuilt workspaces in the background, and then when a developer creates
a new workspace with matching parameters, Coder assigns them an existing prebuilt instance.
Prebuilt workspaces significantly reduce wait times, especially for templates with complex provisioning or lengthy startup procedures.

Prebuilt workspaces are:

- Created and maintained automatically by Coder to match your specified preset configurations.
- Claimed transparently when developers request matching workspaces.
- Claimed transparently when developers create workspaces.
- Monitored and replaced automatically to maintain your desired pool size.

## Prerequisites

- [**Premium license**](../../licensing/index.md)
- [**Template administrator privileges**](../../users/groups-roles.md)
- **Compatible Terraform provider**: Use `coder/coder` Terraform provider `>= 2.3.0-pre2`. (**TODO: update with latest version**)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

NOTE: we must not merge until this is updated.

Copy link
Contributor

Choose a reason for hiding this comment

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

@dannykopping - once this is resolved, I think we're set ❗

- **Feature flag**: Enable the `workspace-prebuilds` [experiment](../../../reference/cli/server.md#--experiments).

Expand All @@ -34,7 +33,7 @@ instances your Coder deployment should maintain:
memory = 16
}
prebuilds {
instances = 3 // Number of prebuilt workspaces to maintain
instances = 3 # Number of prebuilt workspaces to maintain
}
}
```
Expand Down Expand Up @@ -67,11 +66,11 @@ Expand each item in this list for more information about the stage:

1. The workspace is provisioned like a regular workspace.
1. The workspace reaches `running` state.
1. The agent connects and reports `ready` status.
1. All bootstrap procedures and startup scripts complete successfully.
1. The workspace is marked as `eligible` to be claimed.
1. The agent connects to coderd.
1. The agent starts its bootstrap procedures and startup scripts complete successfully.
1. The agent reports `ready` status.

Prebuilds that fail during provisioning are retried with an exponential backoff to prevent resource waste.
Prebuilds that fail during provisioning are retried with an exponential backoff to prevent transient failures.

</details>

Expand Down Expand Up @@ -112,11 +111,9 @@ Prebuilt workspaces are tightly integrated with [workspace presets](./parameters

1. Each Prebuild is associated with a specific template preset.
1. The preset must define all required parameters needed to build the workspace.
1. Parameters that are not defined in the preset can still be customized by users when they claim a workspace.
1. The preset parameters define the base configuration and are immutable after they're claimed.
1. Prebuilds help presets deliver even faster workspace creation.
1. Parameters that are not defined in the preset can still be customized by users when they claim a workspace.

_Note: In future releases, we will allow operators to invalidate their prebuilt workspaces programmatically._

## Administration and troubleshooting

Expand All @@ -127,15 +124,14 @@ Because unclaimed prebuilt workspaces are owned by the `prebuilds` user, you can

1. Configure quotas for any group that includes this user.
1. Set appropriate limits to balance Prebuild availability with resource constraints.
1. Monitor quota utilization through Coder's dashboard.

If a quota is exceeded, the prebuilt workspace will fail provisioning the same way other workspaces do.

### Template configuration best practices

#### Preventing resource replacement

When a prebuilt workspace is claimed, Terraform runs again with new values for the workspace owner and name.
When a prebuilt workspace is claimed, another `terraform apply` run occurs with new values for the workspace owner and name.

This can cause issues:

Expand Down Expand Up @@ -214,5 +210,4 @@ These logs provide information about:

1. Creation and deletion attempts for prebuilds.
1. Backoff events after failed builds.
1. Eligibility state changes.
1. Claiming operations.
Loading
0