diff --git a/.images/jetbrains-gateway.png b/.images/jetbrains-gateway.png new file mode 100644 index 0000000..75807f6 Binary files /dev/null and b/.images/jetbrains-gateway.png differ diff --git a/.images/vscode-server.gif b/.images/vscode-server.gif new file mode 100644 index 0000000..dcc563c Binary files /dev/null and b/.images/vscode-server.gif differ diff --git a/aws-region/README.md b/aws-region/README.md index 99c9f2e..1051cc6 100644 --- a/aws-region/README.md +++ b/aws-region/README.md @@ -4,7 +4,7 @@ description: A parameter with human region names and icons icon: ../.icons/aws.svg maintainer_github: coder verified: true -tags: [helper, parameter] +tags: [helper, parameter, regions, aws] --- # AWS Region diff --git a/azure-region/README.md b/azure-region/README.md index e630933..cb14303 100644 --- a/azure-region/README.md +++ b/azure-region/README.md @@ -4,7 +4,7 @@ description: A parameter with human region names and icons icon: ../.icons/azure.svg maintainer_github: coder verified: true -tags: [helper, parameter, azure] +tags: [helper, parameter, azure, regions] --- # Azure Region @@ -59,4 +59,4 @@ module "azure-region" { resource "azurerm_resource_group" "example" { location = module.azure_region.value } -``` \ No newline at end of file +``` diff --git a/code-server/README.md b/code-server/README.md index 6f068ed..9f360e1 100644 --- a/code-server/README.md +++ b/code-server/README.md @@ -4,7 +4,7 @@ description: VS Code in the browser icon: ../.icons/code.svg maintainer_github: coder verified: true -tags: [helper, ide] +tags: [helper, ide, web] --- # code-server @@ -63,4 +63,4 @@ module "settings" { agent_id = coder_agent.example.id offline = true } -``` \ No newline at end of file +``` diff --git a/gcp-region/README.md b/gcp-region/README.md index 38692ee..553a8fd 100644 --- a/gcp-region/README.md +++ b/gcp-region/README.md @@ -1,10 +1,10 @@ --- -display_name: GCP Regions +display_name: GCP Region description: Add Google Cloud Platform regions to your Coder template. icon: ../.icons/gcp.svg maintainer_github: coder verified: true -tags: [gcp, regions, zones, helper] +tags: [gcp, regions, parameter, helper] --- # Google Cloud Platform Regions @@ -17,8 +17,8 @@ This module adds Google Cloud Platform regions to your Coder template. 1. Add only GPU zones in the US West 1 region: ```hcl - module "gcp_regions" { - source = "git::https://github.com/coder/modules.git//gcp-region?branch=gcp-region" + module "gcp_region" { + source = "https://registry.coder.com/modules/gcp-region" default = ["us-west1-a"] regions = ["us-west1"] gpu_only = false @@ -28,8 +28,8 @@ This module adds Google Cloud Platform regions to your Coder template. 2. Add all zones in the Europe West region: ```hcl - module "regions" { - source = "https://registry.coder.com/modules/gcp-regions" + module "gcp_region" { + source = "https://registry.coder.com/modules/gcp-region" regions = ["europe-west"] single_zone_per_region = false } @@ -38,8 +38,8 @@ This module adds Google Cloud Platform regions to your Coder template. 3. Add a single zone from each region in US and Europe that laos has GPUs ```hcl - module "regions" { - source = "https://registry.coder.com/modules/gcp-regions" + module "gcp_region" { + source = "https://registry.coder.com/modules/gcp-region" regions = ["us", "europe"] gpu_only = true single_zone_per_region = true diff --git a/jetbrains-gateway/README.md b/jetbrains-gateway/README.md index 3b67d22..7abe4d2 100644 --- a/jetbrains-gateway/README.md +++ b/jetbrains-gateway/README.md @@ -4,29 +4,32 @@ description: Add a one-click button to launch JetBrains Gateway IDEs in the dash icon: ../.icons/gateway.svg maintainer_github: coder verified: true -tags: [ide, jetbrains, gateway, goland, webstorm, intellij, pycharm, phpstorm, clion, rubymine, datagrip, rider] +tags: [ide, jetbrains, helper, parameter] --- # JetBrains Gateway -This module adds a JetBrains Gateway IDEs to your Coder template. +This module adds a JetBrains Gateway Button to open any workspace with a single click. -## How to use this module +![JetBrains Gateway IDes list](../.images/jetbrains-gateway.png) -To use this module, add the following snippet to your template manifest: +## Examples + +### Add GoLand and WebStorm with the default set to GoLand ```hcl module "jetbrains_gateway" { source = "https://registry.coder.com/modules/jetbrains-gateway" - agent_id = coder_agent.main.id - agent_name = "main" - project_directory = "/home/coder/project" - gateway_ide_product_code = ["GO","WS"] # A list of JetBrains product codes use ["ALL"] for all products + agent_id = coder_agent.example.id + agent_name = "example" + project_directory = "/home/coder/example" + jetbrains_ides = ["GO", "WS"] + default = "GO" } ``` ## Supported IDEs -The following JetBrains IDEs are supported: +This module and JetBrains Gateway support the following JetBrains IDEs: - GoLand (`GO`) - WebStorm (`WS`) diff --git a/jetbrains-gateway/main.tf b/jetbrains-gateway/main.tf index 993ea41..9e01cf0 100644 --- a/jetbrains-gateway/main.tf +++ b/jetbrains-gateway/main.tf @@ -24,23 +24,26 @@ variable "project_directory" { description = "The directory to open in the IDE. e.g. /home/coder/project" } -variable "gateway_ide_product_code" { +variable "default" { + type = string + description = "Default IDE" +} + +variable "jetbrains_ides" { type = list(string) - description = "The list of IDE product codes, e.g. ['GO', 'WS'] or ['ALL']" - default = ["ALL"] + description = "The list of IDE product codes." validation { condition = ( - length(var.gateway_ide_product_code) == 1 && var.gateway_ide_product_code[0] == "ALL" || alltrue([ - for code in var.gateway_ide_product_code : contains(["IU", "IC", "PS", "WS", "PY", "PC", "CL", "GO", "DB", "RD", "RM"], code) + for code in var.jetbrains_ides : contains(["IU", "IC", "PS", "WS", "PY", "PC", "CL", "GO", "DB", "RD", "RM"], code) ]) ) - error_message = "The gateway_ide_product_code must be ['ALL'] or a list of valid product codes. https://plugins.jetbrains.com/docs/marketplace/product-codes.html" + error_message = "The jetbrains_ides must be a list of valid product codes. https://plugins.jetbrains.com/docs/marketplace/product-codes.html" } } locals { - gateway_ides = { + jetbrains_ides = { "GO" = { icon = "/icon/goland.svg", name = "GoLand", @@ -105,10 +108,10 @@ data "coder_parameter" "jetbrains_ide" { display_name = "JetBrains IDE" icon = "/icon/gateway.svg" mutable = true - default = local.gateway_ides["GO"].value + default = var.default != null && var.default != "" ? local.jetbrains_ides[var.default].value : null dynamic "option" { - for_each = contains(var.gateway_ide_product_code, "ALL") ? local.gateway_ides : { for key, value in local.gateway_ides : key => value if contains(var.gateway_ide_product_code, key) } + for_each = { for key, value in local.jetbrains_ides : key => value if contains(var.jetbrains_ides, key) } content { icon = option.value.icon name = option.value.name @@ -127,3 +130,7 @@ resource "coder_app" "gateway" { icon = data.coder_parameter.jetbrains_ide.option[index(data.coder_parameter.jetbrains_ide.option.*.value, data.coder_parameter.jetbrains_ide.value)].icon external = true } + +output "jetbrains_ides" { + value = data.coder_parameter.jetbrains_ide.value +} diff --git a/jupyterhub/README.md b/jupyterhub/README.md deleted file mode 100644 index ab123ed..0000000 --- a/jupyterhub/README.md +++ /dev/null @@ -1,16 +0,0 @@ ---- -display_name: JupyterHub -description: A multi-user version of the notebook designed for companies, classrooms and research labs -icon: ../.icons/jupyter.svg -maintainer_github: coder -verified: true -tags: [helper, ide] ---- - -# JupyterHub - -Automatically install [JupyterHub](https://jupyter.org/hub) in a workspace, and create an app to access it via the dashboard. - -## Examples - -TODO \ No newline at end of file diff --git a/jupyterlab/README.md b/jupyterlab/README.md index ca3f979..d551f96 100644 --- a/jupyterlab/README.md +++ b/jupyterlab/README.md @@ -4,7 +4,7 @@ description: A module that adds JupyterLab in your Coder template. icon: ../.icons/jupyter.svg maintainer_github: coder verified: true -tags: [jupyter, helper] +tags: [jupyter, helper, ide, web] --- # JupyterLab diff --git a/kasmvnc/README.md b/kasmvnc/README.md index 1b16dad..0bfcaf9 100644 --- a/kasmvnc/README.md +++ b/kasmvnc/README.md @@ -4,7 +4,7 @@ description: A modern open source VNC server icon: ../.icons/kasmvnc.svg maintainer_github: coder verified: true -tags: [helper, ide, VNC] +tags: [helper, VNC, web] --- # KasmVNC diff --git a/vscode-desktop/README.md b/vscode-desktop/README.md index 4ec37a1..c188c45 100644 --- a/vscode-desktop/README.md +++ b/vscode-desktop/README.md @@ -4,6 +4,7 @@ description: Add a one-click button to launch VS Code Desktop icon: ../.icons/code.svg maintainer_github: coder verified: true +tags: [ide, vscode, helper] --- # VS Code Desktop diff --git a/vscode-server/README.md b/vscode-server/README.md new file mode 100644 index 0000000..dfbec39 --- /dev/null +++ b/vscode-server/README.md @@ -0,0 +1,38 @@ +--- +display_name: vscode-server +description: VS Code Web - Visual Studio Code in the browser +icon: ../.icons/code.svg +maintainer_github: coder +verified: true +tags: [helper, ide, vscode, web] +--- + +# VS Code Web + +Automatically install [Visual Studio Code Server](https://code.visualstudio.com/docs/remote/vscode-server) in a workspace using the [VS Code CLIs](https://code.visualstudio.com/docs/editor/command-line) and create an app to access it via the dashboard. + +![VS Code Server with GitHub Copilot and live-share](../.images/vscode-server.gif) + +## Examples + +1. Install VS Code Server with default settings: + + ```hcl + module "vscode-web" { + source = "https://registry.coder.com/modules/vscode-server" + agent_id = coder_agent.example.id + accept_license = true + } + ``` + +2. Install VS Code Server to a custom folder: + + ```hcl + module "vscode-web" { + source = "https://registry.coder.com/modules/vscode-server" + agent_id = coder_agent.example.id + install_dir = "/home/coder/.vscode-server" + folder = "/home/coder" + accept_license = true + } + ``` diff --git a/vscode-web/main.tf b/vscode-server/main.tf similarity index 66% rename from vscode-web/main.tf rename to vscode-server/main.tf index 2bf6348..bd86703 100644 --- a/vscode-web/main.tf +++ b/vscode-server/main.tf @@ -16,20 +16,26 @@ variable "agent_id" { variable "port" { type = number - description = "The port to run VS Code Wbe on." + description = "The port to run VS Code Web on." default = 13338 } variable "folder" { type = string - description = "The folder to open in VS Code Web." + description = "The folder to open in vscode-server." default = "" } variable "log_path" { type = string description = "The path to log." - default = "/tmp/vscode-web.log" + default = "/tmp/vscode-server.log" +} + +variable "install_dir" { + type = string + description = "The directory to install VS Code CLI" + default = "/tmp/vscode-cli" } variable "accept_license" { @@ -42,34 +48,23 @@ variable "accept_license" { } } -variable "version" { - type = string - description = "The version of VS Code to install." - default = "latest" - # add a validation block to validate the version is greater than or equal to 1.82.0 - validation { - condition = var.version >= "1.82.0" - error_message = "Version must be greater than or equal to 1.82.0" - } -} - -resource "coder_script" "vscode-web" { +resource "coder_script" "vscode-server" { agent_id = var.agent_id display_name = "VS Code Web" icon = "/icon/code.svg" script = templatefile("${path.module}/run.sh", { PORT : var.port, LOG_PATH : var.log_path, - VERSION : var.version, + INSTALL_DIR : var.install_dir, }) run_on_start = true } -resource "coder_app" "vscode-web" { +resource "coder_app" "vscode-server" { agent_id = var.agent_id - slug = "vscode-web" + slug = "vscode-server" display_name = "VS Code Web" - url = "http://localhost:${var.port}/?folder=${var.folder}" + url = var.folder == "" ? "http://localhost:${var.port}" : "http://localhost:${var.port}?folder=${var.folder}" icon = "/icon/code.svg" subdomain = true share = "owner" diff --git a/vscode-server/run.sh b/vscode-server/run.sh new file mode 100644 index 0000000..ddec273 --- /dev/null +++ b/vscode-server/run.sh @@ -0,0 +1,21 @@ +#!/usr/bin/env sh + +BOLD='\033[0;1m' + +# Create install directory if it doesn't exist +mkdir -p ${INSTALL_DIR} + +printf "$${BOLD}Installing vscode-cli!\n" + +# Download and extract code-cli tarball +output=$(curl -Lk 'https://code.visualstudio.com/sha/download?build=stable&os=cli-alpine-x64' --output vscode_cli.tar.gz && tar -xf vscode_cli.tar.gz -C ${INSTALL_DIR} && rm vscode_cli.tar.gz) + +if [ $? -ne 0 ]; then + echo "Failed to install vscode-cli: $output" + exit 1 +fi +printf "🥳 vscode-cli has been installed.\n\n" + +echo "👷 Running ${INSTALL_DIR}/bin/code serve-web --port ${PORT} --without-connection-token --accept-server-license-terms in the background..." +echo "Check logs at ${LOG_PATH}!" +${INSTALL_DIR}/code serve-web --port ${PORT} --without-connection-token --accept-server-license-terms >${LOG_PATH} 2>&1 & diff --git a/vscode-web/README.md b/vscode-web/README.md deleted file mode 100644 index 5ebd8f2..0000000 --- a/vscode-web/README.md +++ /dev/null @@ -1,36 +0,0 @@ ---- -display_name: vscode-web -description: VS Code Web - Visual Studio Code in the browser -icon: ../.icons/code.svg -maintainer_github: coder -verified: true -tags: [helper, ide, vscode, web] ---- - -# VS Code Web - -Automatically install [VS Code](https://code.visualstudio.com) in a workspace, create an app to access it via the dashboard. - -## Examples - -1. Install VS Code Web with default settings: - - ```hcl - module "vscode-web" { - source = "https://registry.coder.com/modules/vscode-web" - agent_id = coder_agent.example.id - accept_license = true - } - ``` - -2. Install VS Code Web with custom version and folder - - ```hcl - module "vscode-web" { - source = "https://registry.coder.com/modules/vscode-web" - agent_id = coder_agent.example.id - version = "1.82.0" - folder = "/home/coder/my-projet" - accept_license = true - } - ``` diff --git a/vscode-web/run.sh b/vscode-web/run.sh deleted file mode 100644 index 2e82307..0000000 --- a/vscode-web/run.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/usr/bin/env sh - -BOLD='\033[0;1m' -# check if -printf "$${BOLD}Installing VS Code!\n" -output=$(curl -L "https://update.code.visualstudio.com/${VERSION}/linux-deb-x64/stable" -o /tmp/code.deb && sudo dpkg -i /tmp/code.deb && sudo apt-get install -f -y) -if [ $? -ne 0 ]; then - echo "Failed to install VS Code: $output" - exit 1 -fi -printf "🥳 VS code has been installed.\n\n" - -echo "👷 Running code serve-web in the background..." -echo "Check logs at ${LOG_PATH}!" -code serve-web --port ${PORT} --without-connection-token --accept-server-license-terms >${LOG_PATH} 2>&1 &