From fb1d6507fd5178a84e2f233f72dfb43ac335a64b Mon Sep 17 00:00:00 2001 From: DevelopmentCats Date: Tue, 8 Jul 2025 02:38:00 +0000 Subject: [PATCH 01/20] docs: add contributing guideline docs for modules and templates --- docs/contributing/modules.md | 449 +++++++++++++++++++++++++++ docs/contributing/templates.md | 534 +++++++++++++++++++++++++++++++++ 2 files changed, 983 insertions(+) create mode 100644 docs/contributing/modules.md create mode 100644 docs/contributing/templates.md diff --git a/docs/contributing/modules.md b/docs/contributing/modules.md new file mode 100644 index 0000000000000..073db4e16c573 --- /dev/null +++ b/docs/contributing/modules.md @@ -0,0 +1,449 @@ +# Contributing modules + +Learn how to create and contribute Terraform modules to the Coder Registry. Modules provide reusable components that extend Coder workspaces with IDEs, development tools, login tools, and other features. + +## What are Coder modules + +Coder modules are Terraform modules that integrate with Coder workspaces to provide specific functionality. They are published to the Coder Registry at [registry.coder.com](https://registry.coder.com) and can be consumed in any Coder template using standard Terraform module syntax. + +Examples of modules include: + +- **IDE integrations**: [`code-server`](https://registry.coder.com/modules/coder/code-server), [`jetbrains-gateway`](https://registry.coder.com/modules/coder/jetbrains-gateway), [`cursor`](https://registry.coder.com/modules/coder/cursor) +- **Development tools**: [`git-clone`](https://registry.coder.com/modules/coder/git-clone), [`dotfiles`](https://registry.coder.com/modules/coder/dotfiles), [`devcontainers-cli`](https://registry.coder.com/modules/coder/devcontainers-cli) +- **Workspace utilities**: [`filebrowser`](https://registry.coder.com/modules/coder/filebrowser), [`coder-login`](https://registry.coder.com/modules/coder/coder-login), [`personalize`](https://registry.coder.com/modules/coder/personalize) + +## Prerequisites + +Before contributing modules, ensure you have: + +- Basic Terraform knowledge +- [Terraform installed](https://developer.hashicorp.com/terraform/install) +- [Docker installed](https://docs.docker.com/get-docker/) (for running tests) +- [Bun installed](https://bun.sh/docs/installation) (for running tests and tooling) + +## Setup your development environment + +1. **Fork and clone the repository**: + + ```bash + git clone https://github.com/your-username/registry.git + cd registry + ``` + +2. **Install dependencies**: + + ```bash + bun install + ``` + +3. **Understand the structure**: + + ```text + registry/[namespace]/ + ├── modules/ # Your modules + ├── .images/ # Namespace avatar and screenshots + └── README.md # Namespace description + ``` + +## Create your first module + +### 1. Set up your namespace + +If you're a new contributor, create your namespace directory: + +```bash +mkdir -p registry/[your-username] +mkdir -p registry/[your-username]/.images +``` + +Add your namespace avatar by downloading your GitHub avatar and saving it as `avatar.png`: + +```bash +curl -o registry/[your-username]/.images/avatar.png https://github.com/[your-username].png +``` + +Create your namespace README at `registry/[your-username]/README.md`: + +```markdown +--- +display_name: "Your Name" +bio: "Brief description of what you do" +avatar_url: "./.images/avatar.png" +github: "your-username" +status: "community" +--- + +# Your Name + +Brief description of who you are and what you do. +``` + +### 2. Generate module scaffolding + +Use the provided script to generate your module structure: + +```bash +./scripts/new_module.sh [your-username]/[module-name] +cd registry/[your-username]/modules/[module-name] +``` + +This creates: + +- `main.tf` - Terraform configuration template +- `README.md` - Documentation template with frontmatter +- `run.sh` - Optional execution script + +### 3. Implement your module + +Edit `main.tf` to build your module's features. Here's an example based on the `git-clone` module structure: + +```terraform +terraform { + required_providers { + coder = { + source = "coder/coder" + } + } +} + +# Input variables +variable "agent_id" { + description = "The ID of a Coder agent" + type = string +} + +variable "url" { + description = "Git repository URL to clone" + type = string + validation { + condition = can(regex("^(https?://|git@)", var.url)) + error_message = "URL must be a valid git repository URL." + } +} + +variable "base_dir" { + description = "Directory to clone the repository into" + type = string + default = "~" +} + +# Resources +resource "coder_script" "clone_repo" { + agent_id = var.agent_id + display_name = "Clone Repository" + script = <<-EOT + #!/bin/bash + set -e + + # Ensure git is installed + if ! command -v git &> /dev/null; then + echo "Installing git..." + sudo apt-get update && sudo apt-get install -y git + fi + + # Clone repository if it doesn't exist + if [ ! -d "${var.base_dir}/$(basename ${var.url} .git)" ]; then + echo "Cloning ${var.url}..." + git clone ${var.url} ${var.base_dir}/$(basename ${var.url} .git) + fi + EOT + run_on_start = true +} + +# Outputs +output "repo_dir" { + description = "Path to the cloned repository" + value = "${var.base_dir}/$(basename ${var.url} .git)" +} +``` + +### 4. Write complete tests + +Create `main.test.ts` to test your module features: + +```typescript +import { runTerraformApply, runTerraformInit, testRequiredVariables } from "~test" + +describe("git-clone", async () => { + await testRequiredVariables("registry/[your-username]/modules/git-clone") + + it("should clone repository successfully", async () => { + await runTerraformInit("registry/[your-username]/modules/git-clone") + await runTerraformApply("registry/[your-username]/modules/git-clone", { + agent_id: "test-agent-id", + url: "https://github.com/coder/coder.git", + base_dir: "/tmp" + }) + }) + + it("should work with SSH URLs", async () => { + await runTerraformInit("registry/[your-username]/modules/git-clone") + await runTerraformApply("registry/[your-username]/modules/git-clone", { + agent_id: "test-agent-id", + url: "git@github.com:coder/coder.git" + }) + }) +}) +``` + +### 5. Document your module + +Update `README.md` with complete documentation: + +```markdown +--- +display_name: "Git Clone" +description: "Clone a Git repository into your Coder workspace" +icon: "../../../../.icons/git.svg" +verified: false +tags: ["git", "development", "vcs"] +--- + +# Git Clone + +This module clones a Git repository into your Coder workspace and ensures Git is installed. + +## Usage + +```tf +module "git_clone" { + source = "registry.coder.com/[your-username]/git-clone/coder" + version = "~> 1.0" + + agent_id = coder_agent.main.id + url = "https://github.com/coder/coder.git" + base_dir = "/home/coder/projects" +} +``` + +## Variables + +| Name | Description | Type | Default | Required | +|------|-------------|------|---------|----------| +| `agent_id` | The ID of a Coder agent | `string` | n/a | yes | +| `url` | Git repository URL to clone | `string` | n/a | yes | +| `base_dir` | Directory to clone the repository into | `string` | `"~"` | no | + +## Outputs + +| Name | Description | +|------|-------------| +| `repo_dir` | Path to the cloned repository | + +```markdown + +## Module best practices + +### Design principles + +- **Single responsibility**: Each module should have one clear purpose +- **Reusability**: Design for use across different workspace types +- **Flexibility**: Provide sensible defaults but allow customization +- **Safe to rerun**: Ensure modules can be applied multiple times safely + +### Terraform conventions + +- Use descriptive variable names and include descriptions +- Provide default values for optional variables +- Include helpful outputs for working with other modules +- Use proper resource dependencies with `depends_on` when needed +- Follow [Terraform style conventions](https://developer.hashicorp.com/terraform/language/syntax/style) + +### Testing requirements + +Every module must include complete tests: + +```typescript +import { runTerraformApply, runTerraformInit, testRequiredVariables } from "~test" + +describe("code-server", async () => { + // Test required variables + await testRequiredVariables("registry/coder/modules/code-server") + + // Test successful installation + it("should install code-server successfully", async () => { + await runTerraformInit("registry/coder/modules/code-server") + await runTerraformApply("registry/coder/modules/code-server", { + agent_id: "test-agent-id" + }) + }) + + // Test with custom folder + it("should work with custom folder", async () => { + await runTerraformInit("registry/coder/modules/code-server") + await runTerraformApply("registry/coder/modules/code-server", { + agent_id: "test-agent-id", + folder: "/workspace/project" + }) + }) + + // Test with auto-install extensions + it("should support auto-install extensions", async () => { + await runTerraformInit("registry/coder/modules/code-server") + await runTerraformApply("registry/coder/modules/code-server", { + agent_id: "test-agent-id", + auto_install_extensions: true + }) + }) +}) +``` + +### Documentation standards + +Your module README must include: + +- **Frontmatter**: Required metadata for the registry +- **Description**: Clear explanation of what the module does +- **Usage example**: Working Terraform code snippet +- **Variables table**: All input variables with descriptions +- **Outputs table**: All outputs with descriptions +- **Additional context**: Setup requirements, known limitations, etc. + +## Test your module + +Run tests to ensure your module works correctly: + +```bash +# Test your specific module +bun test -t 'git-clone' + +# Test all modules +bun test + +# Format code +bun fmt +``` + +**Important**: Tests require Docker with `--network=host` support, which typically requires Linux. macOS users can use [Colima](https://github.com/abiosoft/colima) or [OrbStack](https://orbstack.dev/) instead of Docker Desktop. + +## Contribute to existing modules + +### Types of contributions + +**Bug fixes**: + +- Fix installation or configuration issues +- Resolve compatibility problems +- Correct documentation errors + +**Feature additions**: + +- Add new configuration options +- Support additional platforms or versions +- Add new features + +**Maintenance**: + +- Update dependencies +- Improve error handling +- Optimize performance + +### Making changes + +1. **Identify the issue**: Reproduce the problem or identify the improvement needed +2. **Make focused changes**: Keep modifications minimal and targeted +3. **Maintain compatibility**: Ensure existing users aren't broken +4. **Add tests**: Test new features and edge cases +5. **Update documentation**: Reflect changes in the README + +### Backward compatibility + +When modifying existing modules: + +- Add new variables with sensible defaults +- Don't remove existing variables without a migration path +- Don't change variable types or meanings +- Test that basic configurations still work + +## Submit your contribution + +1. **Create a feature branch**: + + ```bash + git checkout -b feat/add-git-clone-module + ``` + +2. **Test thoroughly**: + + ```bash + bun test -t 'git-clone' + bun fmt + ``` + +3. **Commit with clear messages**: + + ```bash + git add . + git commit -m "Add git-clone module for repository cloning" + ``` + +4. **Open a pull request**: + - Use a descriptive title + - Explain what the module does and why it's useful + - Include testing instructions + - Reference any related issues + +## Versioning + +When you modify a module, update its version following semantic versioning: + +- **Patch** (1.0.0 → 1.0.1): Bug fixes, documentation updates +- **Minor** (1.0.0 → 1.1.0): New features, new variables +- **Major** (1.0.0 → 2.0.0): Breaking changes, removing variables + +Use the version bump script to update versions: + +```bash +# For bug fixes +./.github/scripts/version-bump.sh patch + +# For new features +./.github/scripts/version-bump.sh minor + +# For breaking changes +./.github/scripts/version-bump.sh major +``` + +## Common issues and solutions + +### Testing problems + +**Issue**: Tests fail with network errors +**Solution**: Ensure Docker is running with `--network=host` support + +**Issue**: Module not found in tests +**Solution**: Check your module path and ensure it matches the test file location + +### Module development + +**Issue**: Variables not showing in registry +**Solution**: Ensure your README includes properly formatted variables table + +**Issue**: Icon not displaying +**Solution**: Verify icon path is correct and file exists in `.icons/` directory + +### Documentation + +**Issue**: Module not appearing on registry +**Solution**: Check frontmatter format and ensure all required fields are present + +**Issue**: Code blocks not syntax highlighted +**Solution**: Use `tf` language identifier for Terraform code blocks + +## Get help + +- **Examples**: Review existing modules like [`code-server`](https://registry.coder.com/modules/coder/code-server), [`git-clone`](https://registry.coder.com/modules/coder/git-clone), and [`filebrowser`](https://registry.coder.com/modules/coder/filebrowser) +- **Issues**: Open an issue for technical problems +- **Community**: Join the [Coder Discord](https://discord.gg/coder) for questions +- **Documentation**: Check the [Coder docs](https://coder.com/docs) for Terraform guidance + +## Next steps + +After creating your first module: + +1. **Share with the community**: Announce your module on Discord or social media +2. **Iterate based on feedback**: Improve based on user suggestions +3. **Create more modules**: Build a collection of related tools +4. **Contribute to existing modules**: Help maintain and improve the ecosystem + +Happy contributing! 🚀 diff --git a/docs/contributing/templates.md b/docs/contributing/templates.md new file mode 100644 index 0000000000000..4687e2f46d2dd --- /dev/null +++ b/docs/contributing/templates.md @@ -0,0 +1,534 @@ +# Contributing templates + +Learn how to create and contribute complete Coder workspace templates to the Coder Registry. Templates provide ready-to-use workspace configurations that users can deploy directly to create development environments. + +## What are Coder templates + +Coder templates are complete Terraform configurations that define entire workspace environments. Unlike modules (which are reusable components), templates provide full infrastructure definitions that include: + +- Infrastructure setup (containers, VMs, cloud resources) +- Coder agent configuration +- Development tools and IDE integrations +- Networking and security settings +- Complete startup automation + +Templates appear as "Community Templates" on the Coder Registry and can be deployed directly by users. + +## Prerequisites + +Before contributing templates, ensure you have: + +- Strong Terraform knowledge +- [Terraform installed](https://developer.hashicorp.com/terraform/install) +- [Coder CLI installed](https://coder.com/docs/install) +- Access to your target infrastructure platform (Docker, AWS, GCP, etc.) +- [Bun installed](https://bun.sh/docs/installation) (for tooling) + +## Setup your development environment + +1. **Fork and clone the repository**: + + ```bash + git clone https://github.com/your-username/registry.git + cd registry + ``` + +2. **Install dependencies**: + + ```bash + bun install + ``` + +3. **Understand the structure**: + + ```text + registry/[namespace]/ + ├── templates/ # Your templates + ├── .images/ # Namespace avatar and screenshots + └── README.md # Namespace description + ``` + +## Create your first template + +### 1. Set up your namespace + +If you're a new contributor, create your namespace directory: + +```bash +mkdir -p registry/[your-username] +mkdir -p registry/[your-username]/.images +``` + +Add your namespace avatar by downloading your GitHub avatar and saving it as `avatar.png`: + +```bash +curl -o registry/[your-username]/.images/avatar.png https://github.com/[your-username].png +``` + +Create your namespace README at `registry/[your-username]/README.md`: + +```markdown +--- +display_name: "Your Name" +bio: "Brief description of what you do" +avatar_url: "./.images/avatar.png" +github: "your-username" +status: "community" +--- + +# Your Name + +Brief description of who you are and what you do. +``` + +### 2. Create your template directory + +Create a directory for your template: + +```bash +mkdir -p registry/[your-username]/templates/[template-name] +cd registry/[your-username]/templates/[template-name] +``` + +### 3. Build your template + +Create `main.tf` with your complete Terraform configuration: + +```terraform +terraform { + required_providers { + coder = { + source = "coder/coder" + } + docker = { + source = "kreuzwerker/docker" + } + } +} + +# Coder data sources +data "coder_workspace" "me" {} +data "coder_workspace_owner" "me" {} + +# Coder agent +resource "coder_agent" "main" { + arch = "amd64" + os = "linux" + startup_script_timeout = 180 + startup_script = <<-EOT + set -e + + # Install development tools + sudo apt-get update + sudo apt-get install -y curl wget git + + # Additional setup here + EOT +} + +# Registry modules for IDEs and tools +module "code-server" { + source = "registry.coder.com/coder/code-server/coder" + version = "~> 1.0" + agent_id = coder_agent.main.id +} + +module "git-clone" { + source = "registry.coder.com/coder/git-clone/coder" + version = "~> 1.0" + agent_id = coder_agent.main.id + url = "https://github.com/example/repo.git" +} + +# Infrastructure resources +resource "docker_image" "main" { + name = "codercom/enterprise-base:ubuntu" +} + +resource "docker_container" "workspace" { + count = data.coder_workspace.me.start_count + image = docker_image.main.name + name = "coder-${data.coder_workspace_owner.me.name}-${data.coder_workspace.me.name}" + + command = ["sh", "-c", coder_agent.main.init_script] + env = ["CODER_AGENT_TOKEN=${coder_agent.main.token}"] + + host { + host = "host.docker.internal" + ip = "host-gateway" + } +} + +# Metadata +resource "coder_metadata" "workspace_info" { + count = data.coder_workspace.me.start_count + resource_id = docker_container.workspace[0].id + + item { + key = "memory" + value = "4 GB" + } + + item { + key = "cpu" + value = "2 cores" + } +} +``` + +### 4. Document your template + +Create `README.md` with comprehensive documentation: + +```markdown +--- +display_name: "Ubuntu Development Environment" +description: "Complete Ubuntu workspace with VS Code, Git, and development tools" +icon: "../../../../.icons/ubuntu.svg" +maintainer_github: "your-username" +verified: false +tags: ["ubuntu", "docker", "vscode", "git"] +--- + +# Ubuntu Development Environment + +A complete Ubuntu-based development workspace with VS Code, Git, and essential development tools pre-installed. + +## Features + +- **Ubuntu 20.04 LTS** base image +- **VS Code** with code-server for browser-based development +- **Git** with automatic repository cloning +- **Node.js** and **npm** for JavaScript development +- **Python 3** with pip +- **Docker** for containerized development + +## Requirements + +- Docker runtime +- 4 GB RAM minimum +- 2 CPU cores recommended + +## Usage + +1. Deploy this template in your Coder instance +2. Create a new workspace from the template +3. Access VS Code through the workspace dashboard +4. Start developing in your fully configured environment + +## Customization + +You can customize this template by: + +- Modifying the base image in `docker_image.main` +- Adding additional registry modules +- Adjusting resource allocations +- Including additional development tools + +## Troubleshooting + +**Issue**: Workspace fails to start +**Solution**: Ensure Docker is running and accessible + +**Issue**: VS Code not accessible +**Solution**: Check agent logs and ensure code-server module is properly configured +``` + +## Template best practices + +### Design principles + +- **Complete environments**: Templates should provide everything needed for development +- **Platform-specific**: Focus on one platform or use case per template +- **Production-ready**: Include proper error handling and resource management +- **User-friendly**: Provide clear documentation and sensible defaults + +### Infrastructure setup + +- **Resource efficiency**: Use appropriate resource allocations +- **Network configuration**: Ensure proper connectivity for development tools +- **Security**: Follow security best practices for your platform +- **Scalability**: Design for multiple concurrent users + +### Module integration + +Use registry modules for common features: + +```terraform +# VS Code in browser +module "code-server" { + source = "registry.coder.com/coder/code-server/coder" + version = "~> 1.0" + agent_id = coder_agent.main.id + folder = "/home/coder" +} + +# JetBrains IDEs +module "jetbrains_gateway" { + source = "registry.coder.com/coder/jetbrains-gateway/coder" + version = "~> 1.0" + agent_id = coder_agent.main.id + jetbrains_ides = ["IU", "PS", "WS", "PY", "GO"] + default = "IU" + folder = "/home/coder" +} + +# Git repository cloning +module "git-clone" { + source = "registry.coder.com/coder/git-clone/coder" + version = "~> 1.0" + agent_id = coder_agent.main.id + url = "https://github.com/example/project.git" +} + +# File browser interface +module "filebrowser" { + source = "registry.coder.com/coder/filebrowser/coder" + version = "~> 1.0" + agent_id = coder_agent.main.id +} + +# Dotfiles management +module "dotfiles" { + source = "registry.coder.com/coder/dotfiles/coder" + version = "~> 1.0" + agent_id = coder_agent.main.id + repo_url = "https://github.com/example/dotfiles.git" +} +``` + +### Variable design + +Provide meaningful customization options: + +```terraform +variable "git_repo_url" { + description = "Git repository to clone" + type = string + default = "" +} + +variable "instance_type" { + description = "Instance type for the workspace" + type = string + default = "t3.medium" +} + +variable "workspace_name" { + description = "Name for the workspace" + type = string + default = "dev-workspace" +} +``` + +## Test your template + +### Local testing + +Test your template locally with Coder: + +```bash +# Navigate to your template directory +cd registry/[your-username]/templates/[template-name] + +# Push to Coder for testing +coder templates push test-template -d . + +# Create a test workspace +coder create test-workspace --template test-template +``` + +### Validation checklist + +Before submitting your template, verify: + +- [ ] Template provisions successfully +- [ ] Agent connects properly +- [ ] All registry modules work correctly +- [ ] VS Code/IDEs are accessible +- [ ] Networking functions properly +- [ ] Resource metadata is accurate +- [ ] Documentation is complete and accurate + +## Contribute to existing templates + +### Types of improvements + +**Bug fixes**: + +- Fix setup issues +- Resolve agent connectivity problems +- Correct resource configurations + +**Feature additions**: + +- Add new registry modules +- Include additional development tools +- Improve startup automation + +**Platform updates**: + +- Update base images or AMIs +- Adapt to new platform features +- Improve security configurations + +**Documentation improvements**: + +- Clarify setup requirements +- Add troubleshooting guides +- Improve usage examples + +### Making changes + +1. **Test thoroughly**: Always test template changes in a Coder instance +2. **Maintain compatibility**: Ensure existing workspaces continue to function +3. **Document changes**: Update the README with new features or requirements +4. **Follow versioning**: Update version numbers for significant changes + +### Backward compatibility + +When modifying existing templates: + +- Don't remove existing variables without clear migration paths +- Preserve existing functionality +- Test that minimal configurations still work +- Document any breaking changes clearly + +## Submit your contribution + +1. **Create a feature branch**: + + ```bash + git checkout -b feat/add-python-template + ``` + +2. **Test thoroughly**: + + ```bash + # Test with Coder + coder templates push test-python-template -d . + coder create test-workspace --template test-python-template + + # Format code + bun fmt + ``` + +3. **Commit with clear messages**: + + ```bash + git add . + git commit -m "Add Python development template with FastAPI setup" + ``` + +4. **Open a pull request**: + - Use a descriptive title + - Explain what the template provides + - Include testing instructions + - Reference any related issues + +## Template examples + +### Docker-based template + +```terraform +# Simple Docker template +resource "docker_container" "workspace" { + count = data.coder_workspace.me.start_count + image = "ubuntu:20.04" + name = "coder-${data.coder_workspace_owner.me.name}-${data.coder_workspace.me.name}" + + command = ["sh", "-c", coder_agent.main.init_script] + env = ["CODER_AGENT_TOKEN=${coder_agent.main.token}"] +} +``` + +### AWS EC2 template + +```terraform +# AWS EC2 template +resource "aws_instance" "workspace" { + count = data.coder_workspace.me.start_count + ami = data.aws_ami.ubuntu.id + instance_type = var.instance_type + + user_data = coder_agent.main.init_script + + tags = { + Name = "coder-${data.coder_workspace_owner.me.name}-${data.coder_workspace.me.name}" + } +} +``` + +### Kubernetes template + +```terraform +# Kubernetes template +resource "kubernetes_pod" "workspace" { + count = data.coder_workspace.me.start_count + + metadata { + name = "coder-${data.coder_workspace_owner.me.name}-${data.coder_workspace.me.name}" + } + + spec { + container { + name = "workspace" + image = "ubuntu:20.04" + + command = ["sh", "-c", coder_agent.main.init_script] + env { + name = "CODER_AGENT_TOKEN" + value = coder_agent.main.token + } + } + } +} +``` + +## Common issues and solutions + +### Template development + +**Issue**: Template fails to create resources +**Solution**: Check Terraform syntax and provider configuration + +**Issue**: Agent doesn't connect +**Solution**: Verify agent token and network connectivity + +**Issue**: Registry modules not working +**Solution**: Check module versions and variable passing + +### Documentation + +**Issue**: Template not appearing on registry +**Solution**: Check frontmatter format and ensure all required fields are present + +**Issue**: Icon not displaying +**Solution**: Verify icon path and file existence + +### Platform-specific + +**Issue**: Docker containers not starting +**Solution**: Verify Docker daemon is running and accessible + +**Issue**: Cloud resources failing +**Solution**: Check credentials and permissions + +## Get help + +- **Examples**: Review real-world examples in the [Coder repository templates](https://github.com/coder/coder/tree/main/examples/templates) +- **Modules**: Browse available modules at [registry.coder.com/modules](https://registry.coder.com/modules) +- **Issues**: Open an issue for technical problems +- **Community**: Join the [Coder Discord](https://discord.gg/coder) for questions +- **Documentation**: Check the [Coder docs](https://coder.com/docs) for template guidance + +## Next steps + +After creating your first template: + +1. **Share with the community**: Announce your template on Discord or social media +2. **Gather feedback**: Iterate based on user suggestions and issues +3. **Create variations**: Build templates for different use cases or platforms +4. **Contribute to existing templates**: Help maintain and improve the ecosystem + +Your templates help developers get productive faster by providing ready-to-use development environments. Happy contributing! 🚀 From 5238467c6111e87bee95f6807bc8dde1f99bdd9a Mon Sep 17 00:00:00 2001 From: DevelopmentCats Date: Thu, 10 Jul 2025 04:32:35 +0000 Subject: [PATCH 02/20] docs: move and update detailed contributing guidelines for modules and templates --- docs/{ => about}/contributing/modules.md | 112 ++++++--------------- docs/{ => about}/contributing/templates.md | 0 2 files changed, 30 insertions(+), 82 deletions(-) rename docs/{ => about}/contributing/modules.md (85%) rename docs/{ => about}/contributing/templates.md (100%) diff --git a/docs/contributing/modules.md b/docs/about/contributing/modules.md similarity index 85% rename from docs/contributing/modules.md rename to docs/about/contributing/modules.md index 073db4e16c573..bd36bf3c815c8 100644 --- a/docs/contributing/modules.md +++ b/docs/about/contributing/modules.md @@ -68,8 +68,10 @@ Create your namespace README at `registry/[your-username]/README.md`: --- display_name: "Your Name" bio: "Brief description of what you do" -avatar_url: "./.images/avatar.png" github: "your-username" +avatar: "./.images/avatar.png" +linkedin: "https://www.linkedin.com/in/your-username" +website: "https://your-website.com" status: "community" --- @@ -78,6 +80,8 @@ status: "community" Brief description of who you are and what you do. ``` +**Note**: The `linkedin` and `website` fields are optional and can be omitted or left empty if not applicable. + ### 2. Generate module scaffolding Use the provided script to generate your module structure: @@ -215,22 +219,7 @@ module "git_clone" { base_dir = "/home/coder/projects" } ``` - -## Variables - -| Name | Description | Type | Default | Required | -|------|-------------|------|---------|----------| -| `agent_id` | The ID of a Coder agent | `string` | n/a | yes | -| `url` | Git repository URL to clone | `string` | n/a | yes | -| `base_dir` | Directory to clone the repository into | `string` | `"~"` | no | - -## Outputs - -| Name | Description | -|------|-------------| -| `repo_dir` | Path to the cloned repository | - -```markdown +``` ## Module best practices @@ -249,54 +238,13 @@ module "git_clone" { - Use proper resource dependencies with `depends_on` when needed - Follow [Terraform style conventions](https://developer.hashicorp.com/terraform/language/syntax/style) -### Testing requirements - -Every module must include complete tests: - -```typescript -import { runTerraformApply, runTerraformInit, testRequiredVariables } from "~test" - -describe("code-server", async () => { - // Test required variables - await testRequiredVariables("registry/coder/modules/code-server") - - // Test successful installation - it("should install code-server successfully", async () => { - await runTerraformInit("registry/coder/modules/code-server") - await runTerraformApply("registry/coder/modules/code-server", { - agent_id: "test-agent-id" - }) - }) - - // Test with custom folder - it("should work with custom folder", async () => { - await runTerraformInit("registry/coder/modules/code-server") - await runTerraformApply("registry/coder/modules/code-server", { - agent_id: "test-agent-id", - folder: "/workspace/project" - }) - }) - - // Test with auto-install extensions - it("should support auto-install extensions", async () => { - await runTerraformInit("registry/coder/modules/code-server") - await runTerraformApply("registry/coder/modules/code-server", { - agent_id: "test-agent-id", - auto_install_extensions: true - }) - }) -}) -``` - ### Documentation standards -Your module README must include: +Your module README should include: - **Frontmatter**: Required metadata for the registry - **Description**: Clear explanation of what the module does - **Usage example**: Working Terraform code snippet -- **Variables table**: All input variables with descriptions -- **Outputs table**: All outputs with descriptions - **Additional context**: Setup requirements, known limitations, etc. ## Test your module @@ -355,12 +303,33 @@ When modifying existing modules: - Don't change variable types or meanings - Test that basic configurations still work +## Versioning + +When you modify a module, update its version following semantic versioning: + +- **Patch** (1.0.0 → 1.0.1): Bug fixes, documentation updates +- **Minor** (1.0.0 → 1.1.0): New features, new variables +- **Major** (1.0.0 → 2.0.0): Breaking changes, removing variables + +Use the version bump script to update versions: + +```bash +# For bug fixes +./.github/scripts/version-bump.sh patch + +# For new features +./.github/scripts/version-bump.sh minor + +# For breaking changes +./.github/scripts/version-bump.sh major +``` + ## Submit your contribution 1. **Create a feature branch**: ```bash - git checkout -b feat/add-git-clone-module + git checkout -b feat/modify-git-clone-module ``` 2. **Test thoroughly**: @@ -374,7 +343,7 @@ When modifying existing modules: ```bash git add . - git commit -m "Add git-clone module for repository cloning" + git commit -m "feat(git-clone):modify git-clone module" ``` 4. **Open a pull request**: @@ -383,27 +352,6 @@ When modifying existing modules: - Include testing instructions - Reference any related issues -## Versioning - -When you modify a module, update its version following semantic versioning: - -- **Patch** (1.0.0 → 1.0.1): Bug fixes, documentation updates -- **Minor** (1.0.0 → 1.1.0): New features, new variables -- **Major** (1.0.0 → 2.0.0): Breaking changes, removing variables - -Use the version bump script to update versions: - -```bash -# For bug fixes -./.github/scripts/version-bump.sh patch - -# For new features -./.github/scripts/version-bump.sh minor - -# For breaking changes -./.github/scripts/version-bump.sh major -``` - ## Common issues and solutions ### Testing problems diff --git a/docs/contributing/templates.md b/docs/about/contributing/templates.md similarity index 100% rename from docs/contributing/templates.md rename to docs/about/contributing/templates.md From c692a8aff669775c4c03857b99d70c32f1fd94fb Mon Sep 17 00:00:00 2001 From: DevelopmentCats Date: Thu, 10 Jul 2025 23:30:03 +0000 Subject: [PATCH 03/20] docs: update module contribution guidelines and remove redundant content --- docs/about/contributing/modules.md | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/docs/about/contributing/modules.md b/docs/about/contributing/modules.md index bd36bf3c815c8..5f610b2a27108 100644 --- a/docs/about/contributing/modules.md +++ b/docs/about/contributing/modules.md @@ -235,7 +235,7 @@ module "git_clone" { - Use descriptive variable names and include descriptions - Provide default values for optional variables - Include helpful outputs for working with other modules -- Use proper resource dependencies with `depends_on` when needed +- Use proper resource dependencies - Follow [Terraform style conventions](https://developer.hashicorp.com/terraform/language/syntax/style) ### Documentation standards @@ -343,13 +343,12 @@ Use the version bump script to update versions: ```bash git add . - git commit -m "feat(git-clone):modify git-clone module" + git commit -m "feat(git-clone):add git-clone module" ``` 4. **Open a pull request**: - Use a descriptive title - Explain what the module does and why it's useful - - Include testing instructions - Reference any related issues ## Common issues and solutions From bd1df6b99c559353d4f147e538d29f1f4e10078f Mon Sep 17 00:00:00 2001 From: DevelopmentCats Date: Fri, 11 Jul 2025 00:07:45 +0000 Subject: [PATCH 04/20] docs: remove redundant label from registry description --- docs/about/contributing/templates.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/about/contributing/templates.md b/docs/about/contributing/templates.md index 4687e2f46d2dd..915f13923f649 100644 --- a/docs/about/contributing/templates.md +++ b/docs/about/contributing/templates.md @@ -12,7 +12,7 @@ Coder templates are complete Terraform configurations that define entire workspa - Networking and security settings - Complete startup automation -Templates appear as "Community Templates" on the Coder Registry and can be deployed directly by users. +Templates appear on the Coder Registry and can be deployed directly by users. ## Prerequisites From a3bd6280787c5e0458429466a9af334ab7fd5e78 Mon Sep 17 00:00:00 2001 From: DevelopmentCats Date: Fri, 11 Jul 2025 01:01:45 +0000 Subject: [PATCH 05/20] docs: add new sections for contributing modules and templates in the manifest --- docs/manifest.json | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/docs/manifest.json b/docs/manifest.json index 65555caa0df4f..4dd66e0b89d52 100644 --- a/docs/manifest.json +++ b/docs/manifest.json @@ -47,6 +47,18 @@ "path": "./about/contributing/documentation.md", "icon_path": "./images/icons/document.svg" }, + { + "title": "Modules", + "description": "Learn how to contribute modules to Coder", + "path": "./about/contributing/modules.md", + "icon_path": "./images/icons/gear.svg" + }, + { + "title": "Templates", + "description": "Learn how to contribute templates to Coder", + "path": "./about/contributing/templates.md", + "icon_path": "./images/icons/picture.svg" + }, { "title": "Backend", "description": "Our guide for backend development", From 5a74cebf3fb6b1afbef6d9ebe9f222519b488e25 Mon Sep 17 00:00:00 2001 From: DevelopmentCats Date: Fri, 11 Jul 2025 01:17:24 +0000 Subject: [PATCH 06/20] docs: remove unnecessary whitespace in module contribution guidelines --- docs/about/contributing/modules.md | 1 - 1 file changed, 1 deletion(-) diff --git a/docs/about/contributing/modules.md b/docs/about/contributing/modules.md index 5f610b2a27108..8100543f85bb4 100644 --- a/docs/about/contributing/modules.md +++ b/docs/about/contributing/modules.md @@ -219,7 +219,6 @@ module "git_clone" { base_dir = "/home/coder/projects" } ``` -``` ## Module best practices From aaa5fe141862eb7fd394c077142526827f17e755 Mon Sep 17 00:00:00 2001 From: DevCats Date: Fri, 11 Jul 2025 21:14:07 -0500 Subject: [PATCH 07/20] Update docs/about/contributing/modules.md Co-authored-by: Atif Ali --- docs/about/contributing/modules.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/about/contributing/modules.md b/docs/about/contributing/modules.md index 8100543f85bb4..b8fd8721355c1 100644 --- a/docs/about/contributing/modules.md +++ b/docs/about/contributing/modules.md @@ -381,7 +381,7 @@ Use the version bump script to update versions: - **Examples**: Review existing modules like [`code-server`](https://registry.coder.com/modules/coder/code-server), [`git-clone`](https://registry.coder.com/modules/coder/git-clone), and [`filebrowser`](https://registry.coder.com/modules/coder/filebrowser) - **Issues**: Open an issue for technical problems - **Community**: Join the [Coder Discord](https://discord.gg/coder) for questions -- **Documentation**: Check the [Coder docs](https://coder.com/docs) for Terraform guidance +- **Documentation**: Check the [Coder docs](https://coder.com/docs) for help on Coder. ## Next steps From df66bf2cec9072c4ceaae20602790d26ddc81590 Mon Sep 17 00:00:00 2001 From: DevelopmentCats Date: Sat, 12 Jul 2025 02:00:25 +0000 Subject: [PATCH 08/20] docs(modules): split ide's into web and desktop with examples --- docs/about/contributing/modules.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/about/contributing/modules.md b/docs/about/contributing/modules.md index b8fd8721355c1..5e84aeb74f540 100644 --- a/docs/about/contributing/modules.md +++ b/docs/about/contributing/modules.md @@ -8,7 +8,8 @@ Coder modules are Terraform modules that integrate with Coder workspaces to prov Examples of modules include: -- **IDE integrations**: [`code-server`](https://registry.coder.com/modules/coder/code-server), [`jetbrains-gateway`](https://registry.coder.com/modules/coder/jetbrains-gateway), [`cursor`](https://registry.coder.com/modules/coder/cursor) +- **Desktop IDEs**: [`jetbrains-fleet`](https://registry.coder.com/modules/coder/jetbrains-fleet), [`cursor`](https://registry.coder.com/modules/coder/cursor), [`windsurf`](https://registry.coder.com/modules/coder/windsurf), [`zed`](https://registry.coder.com/modules/coder/zed) +- **Web IDEs**: [`code-server`](https://registry.coder.com/modules/coder/code-server), [`vscode-web`](https://registry.coder.com/modules/coder/vscode-web), [`jupyter-notebook`](https://registry.coder.com/modules/coder/jupyter-notebook), [`jupyter-lab`](https://registry.coder.com/modules/coder/jupyterlab) - **Development tools**: [`git-clone`](https://registry.coder.com/modules/coder/git-clone), [`dotfiles`](https://registry.coder.com/modules/coder/dotfiles), [`devcontainers-cli`](https://registry.coder.com/modules/coder/devcontainers-cli) - **Workspace utilities**: [`filebrowser`](https://registry.coder.com/modules/coder/filebrowser), [`coder-login`](https://registry.coder.com/modules/coder/coder-login), [`personalize`](https://registry.coder.com/modules/coder/personalize) From 38db529e9d4b2ec8cdc209b9c0b64116fdeda3f6 Mon Sep 17 00:00:00 2001 From: DevelopmentCats Date: Sat, 12 Jul 2025 02:03:15 +0000 Subject: [PATCH 09/20] docs(modules): update examples for development tools and workspace utilities --- docs/about/contributing/modules.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/about/contributing/modules.md b/docs/about/contributing/modules.md index 5e84aeb74f540..df444b1184622 100644 --- a/docs/about/contributing/modules.md +++ b/docs/about/contributing/modules.md @@ -10,8 +10,8 @@ Examples of modules include: - **Desktop IDEs**: [`jetbrains-fleet`](https://registry.coder.com/modules/coder/jetbrains-fleet), [`cursor`](https://registry.coder.com/modules/coder/cursor), [`windsurf`](https://registry.coder.com/modules/coder/windsurf), [`zed`](https://registry.coder.com/modules/coder/zed) - **Web IDEs**: [`code-server`](https://registry.coder.com/modules/coder/code-server), [`vscode-web`](https://registry.coder.com/modules/coder/vscode-web), [`jupyter-notebook`](https://registry.coder.com/modules/coder/jupyter-notebook), [`jupyter-lab`](https://registry.coder.com/modules/coder/jupyterlab) -- **Development tools**: [`git-clone`](https://registry.coder.com/modules/coder/git-clone), [`dotfiles`](https://registry.coder.com/modules/coder/dotfiles), [`devcontainers-cli`](https://registry.coder.com/modules/coder/devcontainers-cli) -- **Workspace utilities**: [`filebrowser`](https://registry.coder.com/modules/coder/filebrowser), [`coder-login`](https://registry.coder.com/modules/coder/coder-login), [`personalize`](https://registry.coder.com/modules/coder/personalize) +- **Development tools**: [`devcontainers-cli`](https://registry.coder.com/modules/coder/devcontainers-cli), [`vault-github`](https://registry.coder.com/modules/coder/vault-github), [`jfrog-oauth`](https://registry.coder.com/modules/coder/jfrog-oauth), [`jfrog-token`](https://registry.coder.com/modules/coder/jfrog-token) +- **Workspace utilities**: [`git-clone`](https://registry.coder.com/modules/coder/git-clone), [`dotfiles`](https://registry.coder.com/modules/coder/dotfiles), [`filebrowser`](https://registry.coder.com/modules/coder/filebrowser), [`coder-login`](https://registry.coder.com/modules/coder/coder-login), [`personalize`](https://registry.coder.com/modules/coder/personalize) ## Prerequisites From a78c04f803b31034d9b039c4272a5ed08b3dcebf Mon Sep 17 00:00:00 2001 From: DevelopmentCats Date: Sat, 12 Jul 2025 02:07:32 +0000 Subject: [PATCH 10/20] docs(modules): update alerts to all match GFM style --- docs/about/contributing/modules.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/docs/about/contributing/modules.md b/docs/about/contributing/modules.md index df444b1184622..186fc126e0b9a 100644 --- a/docs/about/contributing/modules.md +++ b/docs/about/contributing/modules.md @@ -81,7 +81,8 @@ status: "community" Brief description of who you are and what you do. ``` -**Note**: The `linkedin` and `website` fields are optional and can be omitted or left empty if not applicable. +> [!NOTE] +> The `linkedin` and `website` fields are optional and can be omitted or left empty if not applicable. ### 2. Generate module scaffolding @@ -262,7 +263,8 @@ bun test bun fmt ``` -**Important**: Tests require Docker with `--network=host` support, which typically requires Linux. macOS users can use [Colima](https://github.com/abiosoft/colima) or [OrbStack](https://orbstack.dev/) instead of Docker Desktop. +> [!IMPORTANT] +> Tests require Docker with `--network=host` support, which typically requires Linux. macOS users can use [Colima](https://github.com/abiosoft/colima) or [OrbStack](https://orbstack.dev/) instead of Docker Desktop. ## Contribute to existing modules From e280608d1b1ac05bc0d1f7ef25fa3ad44e8dc3cd Mon Sep 17 00:00:00 2001 From: DevelopmentCats Date: Sat, 12 Jul 2025 02:09:08 +0000 Subject: [PATCH 11/20] docs(modules): simplify version bump instructions in contribution guidelines --- docs/about/contributing/modules.md | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/docs/about/contributing/modules.md b/docs/about/contributing/modules.md index 186fc126e0b9a..5d5f15ae7aa01 100644 --- a/docs/about/contributing/modules.md +++ b/docs/about/contributing/modules.md @@ -316,14 +316,7 @@ When you modify a module, update its version following semantic versioning: Use the version bump script to update versions: ```bash -# For bug fixes -./.github/scripts/version-bump.sh patch - -# For new features -./.github/scripts/version-bump.sh minor - -# For breaking changes -./.github/scripts/version-bump.sh major +./.github/scripts/version-bump.sh patch|minor|major ``` ## Submit your contribution From 867c60db3bda01e0be1496c94aa0f1e5aeda17c9 Mon Sep 17 00:00:00 2001 From: DevelopmentCats Date: Sat, 12 Jul 2025 02:10:18 +0000 Subject: [PATCH 12/20] docs(modules): remove outdated troubleshooting tips from contribution guidelines --- docs/about/contributing/modules.md | 3 --- 1 file changed, 3 deletions(-) diff --git a/docs/about/contributing/modules.md b/docs/about/contributing/modules.md index 5d5f15ae7aa01..313a989cbdcd7 100644 --- a/docs/about/contributing/modules.md +++ b/docs/about/contributing/modules.md @@ -366,9 +366,6 @@ Use the version bump script to update versions: ### Documentation -**Issue**: Module not appearing on registry -**Solution**: Check frontmatter format and ensure all required fields are present - **Issue**: Code blocks not syntax highlighted **Solution**: Use `tf` language identifier for Terraform code blocks From 7cb96d8219506b202cb26190d6d11ea0aa58b5bd Mon Sep 17 00:00:00 2001 From: DevelopmentCats Date: Sat, 12 Jul 2025 02:12:15 +0000 Subject: [PATCH 13/20] docs(modules): remove redundant common issues --- docs/about/contributing/modules.md | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/docs/about/contributing/modules.md b/docs/about/contributing/modules.md index 313a989cbdcd7..3eb3616f2a621 100644 --- a/docs/about/contributing/modules.md +++ b/docs/about/contributing/modules.md @@ -248,6 +248,9 @@ Your module README should include: - **Usage example**: Working Terraform code snippet - **Additional context**: Setup requirements, known limitations, etc. +> [!NOTE] +> Do not include variables tables in your README. The registry automatically generates variable documentation from your `main.tf` file. + ## Test your module Run tests to ensure your module works correctly: @@ -353,14 +356,8 @@ Use the version bump script to update versions: **Issue**: Tests fail with network errors **Solution**: Ensure Docker is running with `--network=host` support -**Issue**: Module not found in tests -**Solution**: Check your module path and ensure it matches the test file location - ### Module development -**Issue**: Variables not showing in registry -**Solution**: Ensure your README includes properly formatted variables table - **Issue**: Icon not displaying **Solution**: Verify icon path is correct and file exists in `.icons/` directory From d274157effd7fd4ea59f869ff6b881ccf0ae0645 Mon Sep 17 00:00:00 2001 From: DevelopmentCats Date: Sat, 12 Jul 2025 02:13:44 +0000 Subject: [PATCH 14/20] docs(modules): update reference module links in contribution guidelines --- docs/about/contributing/modules.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/about/contributing/modules.md b/docs/about/contributing/modules.md index 3eb3616f2a621..0616618362004 100644 --- a/docs/about/contributing/modules.md +++ b/docs/about/contributing/modules.md @@ -368,7 +368,7 @@ Use the version bump script to update versions: ## Get help -- **Examples**: Review existing modules like [`code-server`](https://registry.coder.com/modules/coder/code-server), [`git-clone`](https://registry.coder.com/modules/coder/git-clone), and [`filebrowser`](https://registry.coder.com/modules/coder/filebrowser) +- **Examples**: Review existing modules like [`code-server`](https://registry.coder.com/modules/coder/code-server), [`git-clone`](https://registry.coder.com/modules/coder/git-clone), and [`jetbrains-gateway`](https://registry.coder.com/modules/coder/jetbrains-gateway) - **Issues**: Open an issue for technical problems - **Community**: Join the [Coder Discord](https://discord.gg/coder) for questions - **Documentation**: Check the [Coder docs](https://coder.com/docs) for help on Coder. From c9ddb0885ded73dd3894ac4402153773bf07ec45 Mon Sep 17 00:00:00 2001 From: DevelopmentCats Date: Sat, 12 Jul 2025 02:21:29 +0000 Subject: [PATCH 15/20] docs(contributing): update all frontmatter fields in both docs and address other issues --- docs/about/contributing/modules.md | 3 ++- docs/about/contributing/templates.md | 17 +++++++++++------ 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/docs/about/contributing/modules.md b/docs/about/contributing/modules.md index 0616618362004..7c9c4df164db7 100644 --- a/docs/about/contributing/modules.md +++ b/docs/about/contributing/modules.md @@ -73,6 +73,7 @@ github: "your-username" avatar: "./.images/avatar.png" linkedin: "https://www.linkedin.com/in/your-username" website: "https://your-website.com" +support_email: "support@your-domain.com" status: "community" --- @@ -82,7 +83,7 @@ Brief description of who you are and what you do. ``` > [!NOTE] -> The `linkedin` and `website` fields are optional and can be omitted or left empty if not applicable. +> The `linkedin`, `website`, and `support_email` fields are optional and can be omitted or left empty if not applicable. ### 2. Generate module scaffolding diff --git a/docs/about/contributing/templates.md b/docs/about/contributing/templates.md index 915f13923f649..4294ffab032bc 100644 --- a/docs/about/contributing/templates.md +++ b/docs/about/contributing/templates.md @@ -71,8 +71,11 @@ Create your namespace README at `registry/[your-username]/README.md`: --- display_name: "Your Name" bio: "Brief description of what you do" -avatar_url: "./.images/avatar.png" github: "your-username" +avatar: "./.images/avatar.png" +linkedin: "https://www.linkedin.com/in/your-username" +website: "https://your-website.com" +support_email: "support@your-domain.com" status: "community" --- @@ -81,6 +84,9 @@ status: "community" Brief description of who you are and what you do. ``` +> [!NOTE] +> The `linkedin`, `website`, and `support_email` fields are optional and can be omitted or left empty if not applicable. + ### 2. Create your template directory Create a directory for your template: @@ -185,7 +191,6 @@ Create `README.md` with comprehensive documentation: display_name: "Ubuntu Development Environment" description: "Complete Ubuntu workspace with VS Code, Git, and development tools" icon: "../../../../.icons/ubuntu.svg" -maintainer_github: "your-username" verified: false tags: ["ubuntu", "docker", "vscode", "git"] --- @@ -196,7 +201,7 @@ A complete Ubuntu-based development workspace with VS Code, Git, and essential d ## Features -- **Ubuntu 20.04 LTS** base image +- **Ubuntu 24.04 LTS** base image - **VS Code** with code-server for browser-based development - **Git** with automatic repository cloning - **Node.js** and **npm** for JavaScript development @@ -297,7 +302,7 @@ module "dotfiles" { } ``` -### Variable design +### Variables Provide meaningful customization options: @@ -434,7 +439,7 @@ When modifying existing templates: # Simple Docker template resource "docker_container" "workspace" { count = data.coder_workspace.me.start_count - image = "ubuntu:20.04" + image = "ubuntu:24.04" name = "coder-${data.coder_workspace_owner.me.name}-${data.coder_workspace.me.name}" command = ["sh", "-c", coder_agent.main.init_script] @@ -473,7 +478,7 @@ resource "kubernetes_pod" "workspace" { spec { container { name = "workspace" - image = "ubuntu:20.04" + image = "ubuntu:24.04" command = ["sh", "-c", coder_agent.main.init_script] env { From 132d499b2f04cbdb3e0c6e1e7d135af2722648ca Mon Sep 17 00:00:00 2001 From: DevelopmentCats Date: Sat, 12 Jul 2025 02:26:50 +0000 Subject: [PATCH 16/20] docs(contributing): remove redundant template issues and remove over explanation of backwards compatability need in favor of modernization --- docs/about/contributing/templates.md | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) diff --git a/docs/about/contributing/templates.md b/docs/about/contributing/templates.md index 4294ffab032bc..16f51fd022bb9 100644 --- a/docs/about/contributing/templates.md +++ b/docs/about/contributing/templates.md @@ -389,15 +389,7 @@ Before submitting your template, verify: 2. **Maintain compatibility**: Ensure existing workspaces continue to function 3. **Document changes**: Update the README with new features or requirements 4. **Follow versioning**: Update version numbers for significant changes - -### Backward compatibility - -When modifying existing templates: - -- Don't remove existing variables without clear migration paths -- Preserve existing functionality -- Test that minimal configurations still work -- Document any breaking changes clearly +5. **Modernize**: Use latest provider versions, best practices, and current software versions ## Submit your contribution @@ -500,14 +492,8 @@ resource "kubernetes_pod" "workspace" { **Issue**: Agent doesn't connect **Solution**: Verify agent token and network connectivity -**Issue**: Registry modules not working -**Solution**: Check module versions and variable passing - ### Documentation -**Issue**: Template not appearing on registry -**Solution**: Check frontmatter format and ensure all required fields are present - **Issue**: Icon not displaying **Solution**: Verify icon path and file existence From b9b548d90d754f35866b9f4dd788f204e2169ee6 Mon Sep 17 00:00:00 2001 From: DevelopmentCats Date: Sat, 12 Jul 2025 02:34:53 +0000 Subject: [PATCH 17/20] docs(contributing): update examples section with links to official Coder templates for various environments --- docs/about/contributing/templates.md | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/docs/about/contributing/templates.md b/docs/about/contributing/templates.md index 16f51fd022bb9..287457cbebcc9 100644 --- a/docs/about/contributing/templates.md +++ b/docs/about/contributing/templates.md @@ -507,7 +507,14 @@ resource "kubernetes_pod" "workspace" { ## Get help -- **Examples**: Review real-world examples in the [Coder repository templates](https://github.com/coder/coder/tree/main/examples/templates) +- **Examples**: Review real-world examples from the [official Coder templates](https://registry.coder.com/contributors/coder?tab=templates): + - [AWS EC2 (Devcontainer)](https://registry.coder.com/templates/aws-devcontainer) - AWS EC2 VMs with devcontainer support + - [Docker (Devcontainer)](https://registry.coder.com/templates/docker-devcontainer) - Envbuilder containers with dev container support + - [Kubernetes (Devcontainer)](https://registry.coder.com/templates/kubernetes-devcontainer) - Envbuilder pods on Kubernetes + - [Docker Containers](https://registry.coder.com/templates/docker) - Basic Docker container workspaces + - [AWS EC2 (Linux)](https://registry.coder.com/templates/aws-linux) - AWS EC2 VMs for Linux development + - [Google Compute Engine (Linux)](https://registry.coder.com/templates/gcp-vm-container) - GCP VM instances + - [Scratch](https://registry.coder.com/templates/scratch) - Minimal starter template - **Modules**: Browse available modules at [registry.coder.com/modules](https://registry.coder.com/modules) - **Issues**: Open an issue for technical problems - **Community**: Join the [Coder Discord](https://discord.gg/coder) for questions From 60996656983f88d403279ca917aea41c2f1ca6a3 Mon Sep 17 00:00:00 2001 From: DevelopmentCats Date: Sat, 12 Jul 2025 02:38:39 +0000 Subject: [PATCH 18/20] docs(contributing): update issue reporting instructions to include direct GitHub link --- docs/about/contributing/modules.md | 2 +- docs/about/contributing/templates.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/about/contributing/modules.md b/docs/about/contributing/modules.md index 7c9c4df164db7..4c801ba60f4fe 100644 --- a/docs/about/contributing/modules.md +++ b/docs/about/contributing/modules.md @@ -370,7 +370,7 @@ Use the version bump script to update versions: ## Get help - **Examples**: Review existing modules like [`code-server`](https://registry.coder.com/modules/coder/code-server), [`git-clone`](https://registry.coder.com/modules/coder/git-clone), and [`jetbrains-gateway`](https://registry.coder.com/modules/coder/jetbrains-gateway) -- **Issues**: Open an issue for technical problems +- **Issues**: Open an issue at [github.com/coder/registry](https://github.com/coder/registry/issues) - **Community**: Join the [Coder Discord](https://discord.gg/coder) for questions - **Documentation**: Check the [Coder docs](https://coder.com/docs) for help on Coder. diff --git a/docs/about/contributing/templates.md b/docs/about/contributing/templates.md index 287457cbebcc9..7a770083cb9c3 100644 --- a/docs/about/contributing/templates.md +++ b/docs/about/contributing/templates.md @@ -516,7 +516,7 @@ resource "kubernetes_pod" "workspace" { - [Google Compute Engine (Linux)](https://registry.coder.com/templates/gcp-vm-container) - GCP VM instances - [Scratch](https://registry.coder.com/templates/scratch) - Minimal starter template - **Modules**: Browse available modules at [registry.coder.com/modules](https://registry.coder.com/modules) -- **Issues**: Open an issue for technical problems +- **Issues**: Open an issue at [github.com/coder/registry](https://github.com/coder/registry/issues) - **Community**: Join the [Coder Discord](https://discord.gg/coder) for questions - **Documentation**: Check the [Coder docs](https://coder.com/docs) for template guidance From 2ec825a6799a816847fa53e3831d5b600d81250f Mon Sep 17 00:00:00 2001 From: DevelopmentCats Date: Tue, 15 Jul 2025 00:51:34 +0000 Subject: [PATCH 19/20] docs(contributing): update module examples with new versions agent IDs, and count for workspace initialization. replace jetbrains_gateway with jetbrains --- docs/about/contributing/templates.md | 38 +++++++++++++++------------- 1 file changed, 20 insertions(+), 18 deletions(-) diff --git a/docs/about/contributing/templates.md b/docs/about/contributing/templates.md index 7a770083cb9c3..321377bb0f8aa 100644 --- a/docs/about/contributing/templates.md +++ b/docs/about/contributing/templates.md @@ -262,43 +262,45 @@ Use registry modules for common features: ```terraform # VS Code in browser module "code-server" { + count = data.coder_workspace.me.start_count source = "registry.coder.com/coder/code-server/coder" - version = "~> 1.0" - agent_id = coder_agent.main.id - folder = "/home/coder" + version = "1.3.0" + agent_id = coder_agent.example.id } # JetBrains IDEs -module "jetbrains_gateway" { - source = "registry.coder.com/coder/jetbrains-gateway/coder" - version = "~> 1.0" - agent_id = coder_agent.main.id - jetbrains_ides = ["IU", "PS", "WS", "PY", "GO"] - default = "IU" - folder = "/home/coder" +module "jetbrains" { + count = data.coder_workspace.me.start_count + source = "registry.coder.com/coder/jetbrains/coder" + version = "1.0.0" + agent_id = coder_agent.example.id + folder = "/home/coder/project" } # Git repository cloning module "git-clone" { + count = data.coder_workspace.me.start_count source = "registry.coder.com/coder/git-clone/coder" - version = "~> 1.0" - agent_id = coder_agent.main.id - url = "https://github.com/example/project.git" + version = "1.1.0" + agent_id = coder_agent.example.id + url = "https://github.com/coder/coder" + base_dir = "~/projects/coder" } # File browser interface module "filebrowser" { + count = data.coder_workspace.me.start_count source = "registry.coder.com/coder/filebrowser/coder" - version = "~> 1.0" - agent_id = coder_agent.main.id + version = "1.1.1" + agent_id = coder_agent.example.id } # Dotfiles management module "dotfiles" { + count = data.coder_workspace.me.start_count source = "registry.coder.com/coder/dotfiles/coder" - version = "~> 1.0" - agent_id = coder_agent.main.id - repo_url = "https://github.com/example/dotfiles.git" + version = "1.2.0" + agent_id = coder_agent.example.id } ``` From ca4654fa5c647577e33bc2ecfbe3648e6da2da81 Mon Sep 17 00:00:00 2001 From: DevelopmentCats Date: Tue, 15 Jul 2025 00:51:53 +0000 Subject: [PATCH 20/20] docs(contributing): update module examples section to replace 'Development tools' with 'Integrations' --- docs/about/contributing/modules.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/about/contributing/modules.md b/docs/about/contributing/modules.md index 4c801ba60f4fe..b824fa209e77a 100644 --- a/docs/about/contributing/modules.md +++ b/docs/about/contributing/modules.md @@ -10,7 +10,7 @@ Examples of modules include: - **Desktop IDEs**: [`jetbrains-fleet`](https://registry.coder.com/modules/coder/jetbrains-fleet), [`cursor`](https://registry.coder.com/modules/coder/cursor), [`windsurf`](https://registry.coder.com/modules/coder/windsurf), [`zed`](https://registry.coder.com/modules/coder/zed) - **Web IDEs**: [`code-server`](https://registry.coder.com/modules/coder/code-server), [`vscode-web`](https://registry.coder.com/modules/coder/vscode-web), [`jupyter-notebook`](https://registry.coder.com/modules/coder/jupyter-notebook), [`jupyter-lab`](https://registry.coder.com/modules/coder/jupyterlab) -- **Development tools**: [`devcontainers-cli`](https://registry.coder.com/modules/coder/devcontainers-cli), [`vault-github`](https://registry.coder.com/modules/coder/vault-github), [`jfrog-oauth`](https://registry.coder.com/modules/coder/jfrog-oauth), [`jfrog-token`](https://registry.coder.com/modules/coder/jfrog-token) +- **Integrations**: [`devcontainers-cli`](https://registry.coder.com/modules/coder/devcontainers-cli), [`vault-github`](https://registry.coder.com/modules/coder/vault-github), [`jfrog-oauth`](https://registry.coder.com/modules/coder/jfrog-oauth), [`jfrog-token`](https://registry.coder.com/modules/coder/jfrog-token) - **Workspace utilities**: [`git-clone`](https://registry.coder.com/modules/coder/git-clone), [`dotfiles`](https://registry.coder.com/modules/coder/dotfiles), [`filebrowser`](https://registry.coder.com/modules/coder/filebrowser), [`coder-login`](https://registry.coder.com/modules/coder/coder-login), [`personalize`](https://registry.coder.com/modules/coder/personalize) ## Prerequisites