-
Notifications
You must be signed in to change notification settings - Fork 1.4k
feat(coderd): add Coder Quickstart base to the template builder #27247
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
Draft
nickvigilante
wants to merge
10
commits into
main
Choose a base branch
from
vigilante/docs-558-add-coder-quickstart-template-to-template-builder
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
3817ab4
feat(coderd): add Coder Quickstart base to the template builder
nickvigilante 8d43dd6
test(coderd): assert quickstart-first ordering in TemplateBuilderBases
nickvigilante ce51b17
fix(coderd): make template builder base ordering a total order
nickvigilante e438dce
test(coderd): cover quickstart in the template builder bases spec table
nickvigilante ce7a13a
feat(coderd): trim quickstart base and group it next to Docker
nickvigilante 8d078dd
feat(coderd): guard against base/module name collisions in the builder
nickvigilante f9cfc4f
test(coderd): enforce base included_modules match rendered blocks
nickvigilante 53472c4
refactor(coderd): modernize base ordering, dedupe guard comments
nickvigilante 7f65dc4
fix(coderd): correct quickstart install docs and language dispatch
nickvigilante bc740d2
feat(coderd): address R5 review nits on the quickstart base
nickvigilante File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,64 @@ | ||
| --- | ||
| display_name: Coder Quickstart | ||
| description: Get started with Coder by picking your languages and a repo | ||
| icon: ../../../site/static/icon/coder.svg | ||
| maintainer_github: coder | ||
| verified: true | ||
| tags: [docker, quickstart] | ||
| --- | ||
|
|
||
| # Coder Quickstart | ||
|
|
||
| Get up and running with Coder in minutes. Choose your programming languages, optionally clone a Git repository, and start coding. | ||
|
|
||
| ## How It Works | ||
|
|
||
| When you create a workspace from this template, you select: | ||
|
|
||
| 1. **Languages** to pre-install (Python, Node.js, Go, Rust, Java, C/C++) | ||
| 2. **A Git repository** to clone (optional) | ||
|
|
||
| Coder provisions a workspace with your selections and you can start developing immediately. | ||
|
|
||
| <!-- prerequisites:start --> | ||
|
|
||
| ## Prerequisites | ||
|
|
||
| The host running Coder must have a Docker daemon accessible to the `coder` user: | ||
|
|
||
| ```sh | ||
| # Add coder user to Docker group | ||
| sudo adduser coder docker | ||
|
|
||
| # Restart Coder server | ||
| sudo systemctl restart coder | ||
|
|
||
| # Verify access | ||
| sudo -u coder docker ps | ||
| ``` | ||
|
|
||
| <!-- prerequisites:end --> | ||
|
|
||
| ## Architecture | ||
|
|
||
| This template provisions: | ||
|
|
||
| - **Docker container** (ephemeral) running Ubuntu with the Coder agent | ||
| - **Docker volume** (persistent) mounted at `/home/coder` | ||
|
|
||
| Files in your home directory (`/home/coder`) persist across workspace restarts. The language install script runs on every start and blocks login until it finishes. Most toolchains install into the ephemeral workspace container rather than your home directory, so they are reinstalled from the network on each start; the exception is Rust, whose toolchain lives under `~/.cargo` in your home directory and is detected and reused. | ||
|
|
||
| ## Presets | ||
|
|
||
| Select a preset to auto-fill languages for common workflows: | ||
|
|
||
| | Preset | Languages | | ||
| | ------------------- | ------------------- | | ||
| | **Web Development** | Python, Node.js | | ||
| | **Backend (Go)** | Go | | ||
| | **Data Science** | Python | | ||
| | **Full Stack** | Python, Node.js, Go | | ||
|
|
||
| ## Editors | ||
|
|
||
| VS Code Desktop is available on every workspace by default (Coder enables the VS Code Desktop display app automatically). To add more editors (VS Code in the browser, Cursor, JetBrains, Zed, Windsurf) or other tools, add them as modules in the next step of the template builder. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| { | ||
| "id": "quickstart", | ||
| "display_name": "Coder Quickstart", | ||
| "os": "linux", | ||
| "default_context": {}, | ||
| "included_modules": ["git-clone"] | ||
| } | ||
98 changes: 98 additions & 0 deletions
98
coderd/templatebuilder/bases/quickstart/install-languages.sh.tftpl
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,98 @@ | ||
| #!/bin/bash | ||
| set -e | ||
|
|
||
| LANGUAGES="${LANGUAGES}" | ||
| APT_UPDATED=false | ||
|
|
||
| apt_update() { | ||
| if [ "$APT_UPDATED" = "false" ]; then | ||
| sudo apt-get update -qq | ||
| APT_UPDATED=true | ||
| fi | ||
| } | ||
|
|
||
| # has_language reports whether NAME is one of the selected languages. It matches | ||
| # whole comma-separated entries, so a value can never partially match another | ||
| # (guards against a future language whose name contains an existing one). | ||
| has_language() { | ||
| case ",$LANGUAGES," in | ||
| *",$1,"*) return 0 ;; | ||
| *) return 1 ;; | ||
| esac | ||
| } | ||
|
|
||
| if has_language python; then | ||
| if command -v python3 >/dev/null 2>&1; then | ||
| echo "Python: $(python3 --version)" | ||
| else | ||
| echo "Installing Python..." | ||
| apt_update | ||
| sudo apt-get install -y -qq python3 python3-pip python3-venv | ||
| echo "Installed Python: $(python3 --version)" | ||
| fi | ||
| fi | ||
|
|
||
| if has_language nodejs; then | ||
| if command -v node >/dev/null 2>&1; then | ||
| echo "Node.js: $(node --version)" | ||
| else | ||
| echo "Installing Node.js 22..." | ||
| curl -fsSL https://deb.nodesource.com/setup_22.x | sudo -E bash - | ||
| sudo apt-get install -y -qq nodejs | ||
| echo "Installed Node.js: $(node --version)" | ||
| fi | ||
| fi | ||
|
|
||
| if has_language go; then | ||
| if command -v /usr/local/go/bin/go >/dev/null 2>&1; then | ||
| echo "Go: $(/usr/local/go/bin/go version)" | ||
| else | ||
| echo "Installing Go..." | ||
| ARCH=$(uname -m) | ||
| case $ARCH in | ||
| x86_64) GOARCH="amd64" ;; | ||
| aarch64) GOARCH="arm64" ;; | ||
| *) echo "Unsupported architecture: $ARCH"; exit 1 ;; | ||
| esac | ||
| GO_VERSION=$(curl -fsSL "https://go.dev/VERSION?m=text" | head -1) | ||
| curl -fsSL "https://go.dev/dl/$${GO_VERSION}.linux-$${GOARCH}.tar.gz" | sudo tar -C /usr/local -xz | ||
| echo 'export PATH=$PATH:/usr/local/go/bin:$HOME/go/bin' | sudo tee /etc/profile.d/go.sh >/dev/null | ||
| echo "Installed Go: $(/usr/local/go/bin/go version)" | ||
| fi | ||
| fi | ||
|
|
||
| if has_language rust; then | ||
| if command -v rustc >/dev/null 2>&1 || [ -f "$HOME/.cargo/bin/rustc" ]; then | ||
| RUSTC=$${HOME}/.cargo/bin/rustc | ||
| command -v rustc >/dev/null 2>&1 && RUSTC=rustc | ||
| echo "Rust: $($RUSTC --version)" | ||
| else | ||
| echo "Installing Rust..." | ||
| curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y | ||
| echo "Installed Rust: $($HOME/.cargo/bin/rustc --version)" | ||
| fi | ||
| fi | ||
|
|
||
| if has_language java; then | ||
| if command -v java >/dev/null 2>&1; then | ||
| echo "Java: $(java --version 2>&1 | head -1)" | ||
| else | ||
| echo "Installing Java (OpenJDK 21)..." | ||
| apt_update | ||
| sudo apt-get install -y -qq openjdk-21-jdk | ||
| echo "Installed Java: $(java --version 2>&1 | head -1)" | ||
| fi | ||
| fi | ||
|
|
||
| if has_language cpp; then | ||
| if command -v gcc >/dev/null 2>&1; then | ||
| echo "C/C++: $(gcc --version | head -1)" | ||
| else | ||
| echo "Installing C/C++ toolchain..." | ||
| apt_update | ||
| sudo apt-get install -y -qq gcc g++ make cmake | ||
| echo "Installed C/C++: $(gcc --version | head -1)" | ||
| fi | ||
| fi | ||
|
|
||
| echo "Language setup complete." |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
P3 [CRF-12] The collision guard's invariant is not enforced:
included_modulesis a hand-maintained duplicate of the base's actualmoduleblocks, and nothing binds them (Hisoka, Mafuuu, Pariston, Chopper, Melody, Meruem, Zoro P3; Knov P2).Today
included_modules: ["git-clone"]matches the singlemodule "git-clone"block. But the two live in separate files with no link, and no test cross-checks them (the only reference isBaseExcludesIncludedModules, which asserts the endpoint honors the JSON, not that the JSON describes reality). If a future edit adds a catalog-namedmoduleblock and forgets the JSON line (or renames the block),validateModulesstops reserving the name and the endpoint starts offering it, and CRF-4's P1 duplicate-module break returns with no failing test. There is also no check thatincluded_modulesentries are real catalog IDs, so a typo silently protects the wrong name.The R4 fix closed the git-clone instance; this closes the class. Mechanical fix (AGENTS.md prefers this): a test that renders each base, scans for
module "<id>"labels that are catalog IDs, and asserts the set equals that base'sincluded_modules, or derive the set from the rendered base (the package already parses base HCL inExtractAgentResourceName) and delete the field.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Enforced in 657abbb. Added
ExtractModuleNamesandTestBaseIncludedModulesMatchRendered: it renders each base, keeps themodule "<id>"labels that are catalog IDs, and asserts that set equals the base'sincluded_modules. A base that adds a catalog-named module block without the manifest line (or lists a phantom/typo'd one) now fails. Verified empirically: it fails when I temporarily emptied quickstart'sincluded_modules, and passes once restored.