Giter VIP home page Giter VIP logo

modules's Introduction

Modules extend Templates to create reusable components for your development environment.

e.g.

module "code-server" {
  source   = "registry.coder.com/modules/code-server/coder"
  version  = "1.0.2"
  agent_id = coder_agent.main.id
}
  • code-server: Install on start, create an app to access via the dashboard, install extensions, and pre-configure editor settings.
  • personalize: Run a script on workspace start that allows developers to run custom commands to personalize their workspace.
  • VS Code Desktop: Add a button to open any workspace in VS Code with a single click.
  • JetBrains Gateway: Display a button to launch JetBrains Gateway IDEs in the dashboard.

Registry

Check out the Coder Registry for instructions to integrate modules into your template.

Contributing a Module

See CONTRIBUTING.md for instructions on how to construct and publish a module to the Coder Registry.

modules's People

Contributors

asvoboda avatar bpmct avatar code-asher avatar conor-behard333 avatar dimberr avatar ericpaulsen avatar github-actions[bot] avatar kylecarbs avatar mafredri avatar masterwendu avatar matifali avatar michaelbrewer avatar phorcys420 avatar smolinari avatar spikecurtis avatar stirby avatar thezoker avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

modules's Issues

Document breaking changes

We should document the behavior when we update a module in such a way that it breaks existing templates. Examples are.

  1. Adding/removing/renaming required variables.
  2. Updating default values of any variable.
  3. etc

Suggestions

  • use versioning, so that if someone uses
module "jfrog" {
    source                   = "https://registry.coder.com/modules/jfrog"
	version                  = "1.0"
    agent_id                 = coder_agent.main.id
    jfrog_url                = "https://YYY.jfrog.io"
    ...
}
  • more ideas

cc: @bpmct, @kylecarbs

discord community coder_app

A module that adds a discord community link as an external coder_app.

Allow specifying a custom display_name

Filebrowser DB Location

I am looking for a way to modify where the filebrowser.db is stored.
Currently, it looks like it is saving in my working dir.

I would like it to save in ~/.config/... but it is saving as /workspace/repo/filebrowser.db, which is my coder_agent.dir.

I think this should be the relevant configuration from my template for this issue.

locals {
  folder_name = try(trimsuffix(element(split("/", data.coder_parameter.repo.value), length(split("/", data.coder_parameter.repo.value)) - 1), ".git"), "")
  repo_owner_name = try(element(split("/", data.coder_parameter.repo.value), length(split("/", data.coder_parameter.repo.value)) - 2), "")
  repo_host = try(one(regex("^(?:https?:\\/\\/)?(?:[^@\\/\\n]+@)?(?:www\\.)?([^:\\/\\n]+)", data.coder_parameter.repo.value)), "")
  root_dir = "/workspace"
  project_dir = "${local.root_dir}/${local.folder_name}"
}

resource "coder_agent" "main" {
  arch                   = data.coder_provisioner.me.arch
  os                     = data.coder_provisioner.me.os
  dir                    = local.project_dir
  startup_script_timeout = 180
}

# A file browser for your workspace
module "filebrowser" {
  source = "https://registry.coder.com/modules/filebrowser"
  agent_id = coder_agent.main.id
  folder = local.root_dir
}

Test coder modules manually

Test each of the submitted modules individually and ensure screenshots and examples have been added

  • code-server @kylecarbs I assume you have tested code-server
    • test
    • screenshots
    • examples
  • vscode-server
    • test
    • screenshots
    • examples
  • JupyterLab
    • test
    • screenshots
    • examples
  • KasmVNC
    • test
    • screenshots
    • examples
  • GCP regions
    • test
    • screenshots
    • examples
  • AWS regions
    • test
    • screenshots
    • examples
  • Azure regions
    • test
    • screenshots
    • examples
  • Fly.io regions
    • test
    • screenshots
    • examples
  • VS Code Desktop
    • test
    • screenshots
    • examples
  • JetBrains Gateway
    • test
    • screenshots
    • examples
  • JFrog
    • test
    • screenshots
    • examples
  • Personalize
    • test
    • screenshots
    • examples
  • Dotfiles
    • test
    • screenshots
    • examples
  • git clone
    • test
    • screenshots
    • examples
  • git config
    • test
    • screenshots
    • examples

cc: @bpmct, @stirby, @kylecarbs, please add/update the list if you contribute

RDP

Example template to enable RDP on Windows and expose a link with instructions to connect (external coder_app to point to the readme of the repo).

Down the road, we can improve this by improving in-product features such as coder_app and template READMEs (making them extensible via modules).

  • Test on AWS Windows
  • Test on Azure Windows
  • Test on GCP Windows

create a coder-login module

A module that can automatically login a user to coder deployment inside a workspace.
We have a nice workaround here

# Automatically authenticate the user if they are not already logged in
if ! coder list >/dev/null 2>&1; then
  set +x; coder login --token=$CODER_USER_TOKEN --url=$CODER_DEPLOYMENT_URL
else
  echo "You are already authenticated with Coder"
fi

add end-2-end tests for modules

  • Test coder_parameter with and without default
  • Test all example cases
  • Test coder_script based modules
  • Test if coder_apps are healthy and accessible.

We can have a test deployment for testing modules and use ci to create and update templates using modules and test using a workspace.

Add CONTRIBUTING.md

Describe the contribution process for community modules.

This is currently a part of README.md

cc: @kylecarbs and @bpmct for suggestions to move it to a separate file.

Installing multiple extentions for code-server module doesn't work

I am currently getting the following issue when trying to install multiple extension using the code-server module:

Installing code-server! 
################################################
🥳 code-server has been installed in /tmp/code-server 
🧩 Installing extension ms-azuretools.vscode-docker,codezombiech.gitignore... Extension 'ms-azuretools.vscode-docker,codezombiech.gitignore' not found. Make sure you use the full extension ID, including the publisher, e.g.: ms-dotnettools.csharp Failed Installing Extensions: ms-azuretools.vscode-docker,codezombiech.gitignore

my module terraform code is the following:

module "code-server" { 
    source = "https://registry.coder.com/modules/code-server" 
    agent_id = coder_agent.main.id 
    settings = { "workbench.colorTheme" = "Default Dark+" } 
    extensions = [ "ms-azuretools.vscode-docker", "codezombiech.gitignore" ]
 }

code-server module not loading settings

Hi,
I am using the code server module and the settings are not being ported over to the code-server user space
Here is the tf module for my template:

module "code-server" { 
  source = "https://registry.coder.com/modules/code-server" 
  agent_id = coder_agent.main.id 
  folder = "/home/coder/workspace/repo" 
  settings = { "workbench.colorTheme" = "Default Light Modern", "workbench.iconTheme" = "vscode-icons", "files.autoSave" = "onFocusChange", "editor.rulers" = "[80,120]", "update.mode" = "none", } 
  extensions = [ "ms-azuretools.vscode-docker", "sugatoray.vscode-git-extension-pack", "golang.Go", "ms-python.python", "redhat.vscode-yaml", "timonwong.shellcheck", "garlicbreadcleric.pandoc-markdown-syntax", "zaaack.markdown-editor", "hashicorp.terraform", "ms-kubernetes-tools.vscode-kubernetes-tools" ]
 }

After a little investigating into this script: https://github.com/coder/modules/blob/main/code-server/run.sh
Looking at the logs of my workspace "⚙️ Creating settings file..." is never outputted which means

if [ ! -f ~/.local/share/code-server/Machine/settings.json ]; then

is returning true.

Not sure why this is as when I destroy the workspace it should be gone and recreating it still causes this issue.

AWS Regions

Add AWS regions with

  • Friendly names
  • Location flag emojis as icon

How to get verified status on a module

Hi,

I created the 2 exoscale modules for the registry.
I set verified to false because I wasn´t sure how to verify.

Is is possible to verify a module?

Moreover you have a bug on the registry website.
In the modules overview our exoscale modules are not verified.
But in the detailed module view it is. It seems that you set a condition wrong there.

Add template for the module

  • README.md
    • Frontmatter
    • Introduction
    • Examples
    • Screenshots
  • run.sh (optional) [required for modules which uses coder_script]
  • main.tf

feat: allow execution ordering of coder modules

How can we specify the order in which modules run?

For example, I want the Personalize module to run after my Dotfiles have been fully cloned as I have a personalization script in my dotfiles.

[git-clone] - doesn't work with volumes (in k8s)

Discussion started here: https://discord.com/channels/747933592273027093/1157627766607454288

Basically, the git-clone module doesn't take into account that a volume might have already generated the directory path and with such a volume in place, the cloning of the repo will never happen.

The advantages with using a volume are a workspace (container) can be stopped and restarted ( to be updated or to save resources or just to get a fresh container running) and the dev can basically continue where she left off. Without a volume, the cloning, installing, building, etc. etc. all has to happen again, before the dev can continue. Also, if the dev had made changes to the repo and didn't push them to origin, before restarting the workspace, all changes would be lost.

I'll put in a PR to fix.

Scott

kasmVNC

Create a module that installs kasmvnc if it doesn't exist and starts it.

Must have

Nice to have

  • Variable to specify kasmvnc version
  • Variable to skip install (assumes it's already in the image)
  • Variable for path of kasmvnc (e.g. in home dir?)

References

Dotfiles

Basically we should replicate what we do for our dogfood template for dotfiles

  • coder_parameter
  • coder_script

Add screenshots to modules

The following READMEs could benefit from screenshots

  • VS Code Web (with copilot or live share in browser)
  • AWS Regions
  • Azure Regions
  • kasmVNC
  • Juypyter
  • GCP Region
  • Fly Region
  • JFrog
  • Personalize
  • VS Code Desktop

git config

Script to detect if user.name and user.email is set. If not, use the username and email from the Coder user

JFrog Module

Install and authenticate the JFrog CLI using the user's email!

git clone

git clone module to detect if repo exists and clone it

Nice to have

  • Support forking instead of clone with gh CLI (we could support other clouds down the road).

VS Code Web

This is different than code-server: code serve-web:

  • Variable to accept license (user must put true as a variable, default is false)
  • coder_app
  • coder_script

GCP Regions/Zones Module

Figuring out all of the flag emojis and friendly names for GCP regions is difficult. Let's make a module that has all of these

  • Output with local of all modules
  • coder_parameter

Should have

  • User can specify via a module variable a subset of regions they want to support ["us-east-1", "us-east-2"]
  • User can disable the parameter and just consume the local? idk why they would want this but why not

Ensure that not setting default or setting default to "" or `null` sets the default to `null` for all coder_parameter modules

While testing I noticed that

  • JetBrains Gateway module fails if no default is set.
  • Azure regions module sets the default region to eastus if no default is set.
  • AWS regions module sets the default region to us-east-1 if no default is set.

Ideal behavior should be that setting the default to null should set the default of coder_paramter to null so that the user is forced to choose a value from the list.

README template for modules

Create a general template for modules. This will probably require some ideation as we add several. This is just a dump of some initial ideas, but we can consider this issue closed when we are happy with a template that works across 5-10 modules.

  • Requirements and prerequisites for module (e.g. OS, architecture)
  • Frontmatter with tags (e.g. ide)
  • Screenshots section or GIF demo
  • Compatible templates?

vault-github: user is not part of required org

Module: vault-github
Coder Version: 2.4.0
Vault Version: 1.15.3
Issue: Error with ghu_ prefixed GitHub App token during workspace startup; ghp_ personal access tokens work fine.

Error Message on Workspace Startup:

Error authenticating: Error making API request.
URL: PUT http://192.168.1.105:8200/v1/auth/github/login
Code: 500. Errors:
* user is not part of required org

Configuration:

  • Installed and configured the vault-github module in a Coder template.
  • Engaged GitHub authentication and established GitHub organization in Vault settings.

Discovery:

  • Authentication with GitHub App tokens (ghu_ prefix) fails upon workspace initialization.
  • Authentication using personal access tokens (ghp_ prefix) performs correctly.

Steps to Reproduce:

  1. Set up the vault-github module in Coder template.
    module "vault" {
      source     = "https://registry.coder.com/modules/vault-github"
      agent_id   = coder_agent.dev.id
      vault_addr = "http://192.168.1.105:8200"
      coder_github_auth_id   = "primary-github"
    }
  2. Activated GitHub authentication and set the GitHub organization in Vault.
    vault auth enable github
    vault write auth/github/config organization=photonq-org
  3. Encountered an error when starting the workspace using a GitHub App token.
    vault login -method=github token=ghu_MyGitHubAppAccessToken
  4. Successfully logged in with a personal access token.
    vault login -method=github token=ghp_MyPersonalAccessToken

Question:
Is additional configuration required within HashiCorp Vault to enable authentication using GitHub App tokens (ghu_ prefix) as they produce an error stating the user is not part of the required organization?

JupyterLab

Must have

  • Auto-installs Jupyter with pip (if not installed)
  • Starts JupyterLab
  • coder_app
  • coder_script

Should have

  • Variable to specify version
  • Variable to specify whether they want notebook or lab lets create a separate module for legacy Jupyter notebooks

Allow basename of url to be added to custom path in the Git-Clone module

I am cloning a repo with the git-clone module.

module "git-clone" {
 source = "https://registry.coder.com/modules/git-clone"
 agent_id = coder_agent.main.id
 url = https://git-domain/test-repo
 path = "/home/coder/workspace" 
}

Instead of the code being cloned to /home/coder/workspace/ I want it to be cloned to /home/coder/workspace/test-repo.

Possible solution would be to change the tf here: https://github.com/coder/modules/blob/main/git-clone/main.tf

Maybe creating an optional var enable_basename and if set to true does something like this:
CLONE_PATH : var.path != "" ? join("/", [var.path, basename(var.url)]) : join("/", ["~", basename(var.url)]),

slack workspace/channel

A module that adds an external coder_app with a slack workspace/channel link.

It should allow specifying a custom app dispay_name

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.