-
Notifications
You must be signed in to change notification settings - Fork 887
Workspace pre-builds #5325
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
Comments
This is a combination of just documentation of best practices, as well as requiring that the end-user build some scripts/automation against our API? This won't be native? |
It could be native! We could support "pooling" where, at a given time, a template has |
For example, during an OpenShift workshop, there could be 100 clusters "ready" to be assigned to users, built in advance. |
I helped product manage this feature at a previous role, and here are some complications to consider:
|
This comment has been minimized.
This comment has been minimized.
For our UseCase a workspace is defined in a coder.yaml. So every start of a new workspace can have different settings. |
Related to #9611 |
I think we can implement this relatively cleanly by splitting provisioning into two phases:
Then users can make their templates warm-able by following these two practices:
Edit April 3rd, 2024: Instead of complicated the provisioning layer, we could wait until Workspace transfers are robust, and then assign pre-built workspaces to a dummy account until they're needed. Each transfer will have to constitute a rebuild. |
Just my two cents about prebuilds for Resources:
They are just images pushed into an oci registry. We could use any CI to build and push prebuilds. But would be nice to get a "ready" to use solution. However coder must be aware of git repositories to filter prebuilds from a given branch/ref. (using the git provider api) The configuration should be specific to each repository. # .coder/config.yaml
devcontainers:
template_id: # id of the devcontainer terraform template to use ?
prebuilds:
configuration: .devcontainer/devcontainer.json # default value
triggers: # some params in trigger should not be set together.
schedule: ...
on_change:
- ".devcontainer/**/*"
- "!.devcontainer/**/*.md"
- "Dockerfile"
commit_interval: 4 # new prebuild every 4 commits
enable_manual_trigger: true # allow manual trigger via coder cli or UI ?
branches: # which branches to prebuild
- main
- develop:
configuration: # override configuration for release/1.*
- .devcontainer/devcontainer.json
- .devcontainer/frontend/devcontainer.json
- release/2.* :
triggers:
on_change: # override on_change
- .devcontainer/**/*
- old-folder/Dockerfile
notify_failure: # notify coder users when failure happen.
- dev1
- dev2 Coder can schedule workspace creation based on the config in each repository. When a user create a workspace from a given branch/ref, they should see if a prebuild is available. Or even have the possibility to select one among a list of prebuilds. # Generic devcontainer template using envbuilder or devcontainer cli
resource "a_cloud_vm_instance" {
startup_script = data.coder_agent.main.init_script
# [...]
}
# get information about the repository
data "coder_repository" "me"{
# external auth to assume the git provider for api calls (bitbucket, gitlab, github...)
git_external_auth_id : data.coder_external_auth.my_git_provider.id
repository_url = data.coder_param.repository_url.value
# or
repository_id = my_project/_my_repo
selected_branch = data.coder_param.branch.value
}
resource "coder_devcontainer_prebuild" {
# Can set default values, enforce quotas/limits or configure admin configuration ?
registry: "dockerhub.com/org/${data.coder_repository.me.repository_name}:${data.coder_repository.me.head_short_sha}"
script: <<-EOT
# customize prebuild script if needed.
devcontainer build --push true --image-name dockerhub.com/org/${data.coder_repository.me.repository_name}:${data.coder_repository.me.head_short_sha}
# [...]
EOT
}
locals {
init_script = <<-EOT
if [[ ${data.coder_repository.prebuild} ]]
# use prebuild.
else
# devcontainer build ...
EOT
}
# [...] |
Update: @dannykopping is actively working on this and we'll likely have a generally available solution in the next couple of months. |
That's right! We're actively working on this. I added some updates to the issue body to reflect our current progress. |
This is now actively under development: https://github.com/orgs/coder/projects/44/views/3 |
Some of our users have templates with a long time to provision (e.g. Kubernetes clusters, OpenStack VMs, etc.) or large startup scripts /
git clones
that take 30+ minutes.Overview
For users with templates with long-running scripts to initialize, this should allow starts to become near-instant. This does not speed up the provisioning of ephemeral resources (e.g. pods, containers, VMs).
This will also make Coder workspaces more useful for workspaces per-branch or per-PR as the start time is much faster
Improving build performance
In parallel, we are also working on making it easier to profile workspace start/stop time so template admins can understand how to optimize. While we've had prometheus metrics on start times, for a while we'll be adding API endpoints and a UI view for viewing resource provisioning time and script execution time (#14773):
We'll also write up some docs on optimizing build performance: #14858
References
Prior art: #9611
From: @ggjulio:
The text was updated successfully, but these errors were encountered: