fix: update tags and fix module bugs, rewrite vscode-server (#42)
This commit is contained in:
committed by
GitHub
parent
f066d5422d
commit
d3d9a9f135
BIN
.images/jetbrains-gateway.png
Normal file
BIN
.images/jetbrains-gateway.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 20 KiB |
BIN
.images/vscode-server.gif
Normal file
BIN
.images/vscode-server.gif
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 5.2 MiB |
@@ -4,7 +4,7 @@ description: A parameter with human region names and icons
|
|||||||
icon: ../.icons/aws.svg
|
icon: ../.icons/aws.svg
|
||||||
maintainer_github: coder
|
maintainer_github: coder
|
||||||
verified: true
|
verified: true
|
||||||
tags: [helper, parameter]
|
tags: [helper, parameter, regions, aws]
|
||||||
---
|
---
|
||||||
|
|
||||||
# AWS Region
|
# AWS Region
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ description: A parameter with human region names and icons
|
|||||||
icon: ../.icons/azure.svg
|
icon: ../.icons/azure.svg
|
||||||
maintainer_github: coder
|
maintainer_github: coder
|
||||||
verified: true
|
verified: true
|
||||||
tags: [helper, parameter, azure]
|
tags: [helper, parameter, azure, regions]
|
||||||
---
|
---
|
||||||
|
|
||||||
# Azure Region
|
# Azure Region
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ description: VS Code in the browser
|
|||||||
icon: ../.icons/code.svg
|
icon: ../.icons/code.svg
|
||||||
maintainer_github: coder
|
maintainer_github: coder
|
||||||
verified: true
|
verified: true
|
||||||
tags: [helper, ide]
|
tags: [helper, ide, web]
|
||||||
---
|
---
|
||||||
|
|
||||||
# code-server
|
# code-server
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
---
|
---
|
||||||
display_name: GCP Regions
|
display_name: GCP Region
|
||||||
description: Add Google Cloud Platform regions to your Coder template.
|
description: Add Google Cloud Platform regions to your Coder template.
|
||||||
icon: ../.icons/gcp.svg
|
icon: ../.icons/gcp.svg
|
||||||
maintainer_github: coder
|
maintainer_github: coder
|
||||||
verified: true
|
verified: true
|
||||||
tags: [gcp, regions, zones, helper]
|
tags: [gcp, regions, parameter, helper]
|
||||||
---
|
---
|
||||||
# Google Cloud Platform Regions
|
# 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:
|
1. Add only GPU zones in the US West 1 region:
|
||||||
|
|
||||||
```hcl
|
```hcl
|
||||||
module "gcp_regions" {
|
module "gcp_region" {
|
||||||
source = "git::https://github.com/coder/modules.git//gcp-region?branch=gcp-region"
|
source = "https://registry.coder.com/modules/gcp-region"
|
||||||
default = ["us-west1-a"]
|
default = ["us-west1-a"]
|
||||||
regions = ["us-west1"]
|
regions = ["us-west1"]
|
||||||
gpu_only = false
|
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:
|
2. Add all zones in the Europe West region:
|
||||||
|
|
||||||
```hcl
|
```hcl
|
||||||
module "regions" {
|
module "gcp_region" {
|
||||||
source = "https://registry.coder.com/modules/gcp-regions"
|
source = "https://registry.coder.com/modules/gcp-region"
|
||||||
regions = ["europe-west"]
|
regions = ["europe-west"]
|
||||||
single_zone_per_region = false
|
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
|
3. Add a single zone from each region in US and Europe that laos has GPUs
|
||||||
|
|
||||||
```hcl
|
```hcl
|
||||||
module "regions" {
|
module "gcp_region" {
|
||||||
source = "https://registry.coder.com/modules/gcp-regions"
|
source = "https://registry.coder.com/modules/gcp-region"
|
||||||
regions = ["us", "europe"]
|
regions = ["us", "europe"]
|
||||||
gpu_only = true
|
gpu_only = true
|
||||||
single_zone_per_region = true
|
single_zone_per_region = true
|
||||||
|
|||||||
@@ -4,29 +4,32 @@ description: Add a one-click button to launch JetBrains Gateway IDEs in the dash
|
|||||||
icon: ../.icons/gateway.svg
|
icon: ../.icons/gateway.svg
|
||||||
maintainer_github: coder
|
maintainer_github: coder
|
||||||
verified: true
|
verified: true
|
||||||
tags: [ide, jetbrains, gateway, goland, webstorm, intellij, pycharm, phpstorm, clion, rubymine, datagrip, rider]
|
tags: [ide, jetbrains, helper, parameter]
|
||||||
---
|
---
|
||||||
# JetBrains Gateway
|
# 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
|

|
||||||
|
|
||||||
To use this module, add the following snippet to your template manifest:
|
## Examples
|
||||||
|
|
||||||
|
### Add GoLand and WebStorm with the default set to GoLand
|
||||||
|
|
||||||
```hcl
|
```hcl
|
||||||
module "jetbrains_gateway" {
|
module "jetbrains_gateway" {
|
||||||
source = "https://registry.coder.com/modules/jetbrains-gateway"
|
source = "https://registry.coder.com/modules/jetbrains-gateway"
|
||||||
agent_id = coder_agent.main.id
|
agent_id = coder_agent.example.id
|
||||||
agent_name = "main"
|
agent_name = "example"
|
||||||
project_directory = "/home/coder/project"
|
project_directory = "/home/coder/example"
|
||||||
gateway_ide_product_code = ["GO","WS"] # A list of JetBrains product codes use ["ALL"] for all products
|
jetbrains_ides = ["GO", "WS"]
|
||||||
|
default = "GO"
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
## Supported IDEs
|
## Supported IDEs
|
||||||
|
|
||||||
The following JetBrains IDEs are supported:
|
This module and JetBrains Gateway support the following JetBrains IDEs:
|
||||||
|
|
||||||
- GoLand (`GO`)
|
- GoLand (`GO`)
|
||||||
- WebStorm (`WS`)
|
- WebStorm (`WS`)
|
||||||
|
|||||||
@@ -24,23 +24,26 @@ variable "project_directory" {
|
|||||||
description = "The directory to open in the IDE. e.g. /home/coder/project"
|
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)
|
type = list(string)
|
||||||
description = "The list of IDE product codes, e.g. ['GO', 'WS'] or ['ALL']"
|
description = "The list of IDE product codes."
|
||||||
default = ["ALL"]
|
|
||||||
validation {
|
validation {
|
||||||
condition = (
|
condition = (
|
||||||
length(var.gateway_ide_product_code) == 1 && var.gateway_ide_product_code[0] == "ALL" ||
|
|
||||||
alltrue([
|
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 {
|
locals {
|
||||||
gateway_ides = {
|
jetbrains_ides = {
|
||||||
"GO" = {
|
"GO" = {
|
||||||
icon = "/icon/goland.svg",
|
icon = "/icon/goland.svg",
|
||||||
name = "GoLand",
|
name = "GoLand",
|
||||||
@@ -105,10 +108,10 @@ data "coder_parameter" "jetbrains_ide" {
|
|||||||
display_name = "JetBrains IDE"
|
display_name = "JetBrains IDE"
|
||||||
icon = "/icon/gateway.svg"
|
icon = "/icon/gateway.svg"
|
||||||
mutable = true
|
mutable = true
|
||||||
default = local.gateway_ides["GO"].value
|
default = var.default != null && var.default != "" ? local.jetbrains_ides[var.default].value : null
|
||||||
|
|
||||||
dynamic "option" {
|
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 {
|
content {
|
||||||
icon = option.value.icon
|
icon = option.value.icon
|
||||||
name = option.value.name
|
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
|
icon = data.coder_parameter.jetbrains_ide.option[index(data.coder_parameter.jetbrains_ide.option.*.value, data.coder_parameter.jetbrains_ide.value)].icon
|
||||||
external = true
|
external = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
output "jetbrains_ides" {
|
||||||
|
value = data.coder_parameter.jetbrains_ide.value
|
||||||
|
}
|
||||||
|
|||||||
@@ -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
|
|
||||||
@@ -4,7 +4,7 @@ description: A module that adds JupyterLab in your Coder template.
|
|||||||
icon: ../.icons/jupyter.svg
|
icon: ../.icons/jupyter.svg
|
||||||
maintainer_github: coder
|
maintainer_github: coder
|
||||||
verified: true
|
verified: true
|
||||||
tags: [jupyter, helper]
|
tags: [jupyter, helper, ide, web]
|
||||||
---
|
---
|
||||||
|
|
||||||
# JupyterLab
|
# JupyterLab
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ description: A modern open source VNC server
|
|||||||
icon: ../.icons/kasmvnc.svg
|
icon: ../.icons/kasmvnc.svg
|
||||||
maintainer_github: coder
|
maintainer_github: coder
|
||||||
verified: true
|
verified: true
|
||||||
tags: [helper, ide, VNC]
|
tags: [helper, VNC, web]
|
||||||
---
|
---
|
||||||
|
|
||||||
# KasmVNC
|
# KasmVNC
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ description: Add a one-click button to launch VS Code Desktop
|
|||||||
icon: ../.icons/code.svg
|
icon: ../.icons/code.svg
|
||||||
maintainer_github: coder
|
maintainer_github: coder
|
||||||
verified: true
|
verified: true
|
||||||
|
tags: [ide, vscode, helper]
|
||||||
---
|
---
|
||||||
|
|
||||||
# VS Code Desktop
|
# VS Code Desktop
|
||||||
|
|||||||
38
vscode-server/README.md
Normal file
38
vscode-server/README.md
Normal file
@@ -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.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
## 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
|
||||||
|
}
|
||||||
|
```
|
||||||
@@ -16,20 +16,26 @@ variable "agent_id" {
|
|||||||
|
|
||||||
variable "port" {
|
variable "port" {
|
||||||
type = number
|
type = number
|
||||||
description = "The port to run VS Code Wbe on."
|
description = "The port to run VS Code Web on."
|
||||||
default = 13338
|
default = 13338
|
||||||
}
|
}
|
||||||
|
|
||||||
variable "folder" {
|
variable "folder" {
|
||||||
type = string
|
type = string
|
||||||
description = "The folder to open in VS Code Web."
|
description = "The folder to open in vscode-server."
|
||||||
default = ""
|
default = ""
|
||||||
}
|
}
|
||||||
|
|
||||||
variable "log_path" {
|
variable "log_path" {
|
||||||
type = string
|
type = string
|
||||||
description = "The path to log."
|
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" {
|
variable "accept_license" {
|
||||||
@@ -42,34 +48,23 @@ variable "accept_license" {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
variable "version" {
|
resource "coder_script" "vscode-server" {
|
||||||
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" {
|
|
||||||
agent_id = var.agent_id
|
agent_id = var.agent_id
|
||||||
display_name = "VS Code Web"
|
display_name = "VS Code Web"
|
||||||
icon = "/icon/code.svg"
|
icon = "/icon/code.svg"
|
||||||
script = templatefile("${path.module}/run.sh", {
|
script = templatefile("${path.module}/run.sh", {
|
||||||
PORT : var.port,
|
PORT : var.port,
|
||||||
LOG_PATH : var.log_path,
|
LOG_PATH : var.log_path,
|
||||||
VERSION : var.version,
|
INSTALL_DIR : var.install_dir,
|
||||||
})
|
})
|
||||||
run_on_start = true
|
run_on_start = true
|
||||||
}
|
}
|
||||||
|
|
||||||
resource "coder_app" "vscode-web" {
|
resource "coder_app" "vscode-server" {
|
||||||
agent_id = var.agent_id
|
agent_id = var.agent_id
|
||||||
slug = "vscode-web"
|
slug = "vscode-server"
|
||||||
display_name = "VS Code Web"
|
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"
|
icon = "/icon/code.svg"
|
||||||
subdomain = true
|
subdomain = true
|
||||||
share = "owner"
|
share = "owner"
|
||||||
21
vscode-server/run.sh
Normal file
21
vscode-server/run.sh
Normal file
@@ -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 &
|
||||||
@@ -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
|
|
||||||
}
|
|
||||||
```
|
|
||||||
@@ -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 &
|
|
||||||
Reference in New Issue
Block a user