Compare commits
10 Commits
atif/qol-i
...
atif/jetbr
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
271c0bf6c1 | ||
|
|
734f4a7009 | ||
|
|
b57d7f170c | ||
|
|
630a92966c | ||
|
|
309c7eb24b | ||
|
|
ef10dcfc67 | ||
|
|
f5ab7995d1 | ||
|
|
528a8a9fea | ||
|
|
87854707bc | ||
|
|
b53554b4e4 |
@@ -45,23 +45,11 @@ module "filebrowser" {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
### Serve on a subpath (no wildcard subdomain)
|
### Serve from the same domain (no subdomain)
|
||||||
|
|
||||||
```tf
|
|
||||||
module "filebrowser" {
|
|
||||||
source = "registry.coder.com/modules/filebrowser/coder"
|
|
||||||
version = "1.0.23"
|
|
||||||
agent_id = coder_agent.example.id
|
|
||||||
subdomain = false
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
### Serve on a subpath with a specific agent name (multiple agents)
|
|
||||||
|
|
||||||
```tf
|
```tf
|
||||||
module "filebrowser" {
|
module "filebrowser" {
|
||||||
source = "registry.coder.com/modules/filebrowser/coder"
|
source = "registry.coder.com/modules/filebrowser/coder"
|
||||||
version = "1.0.23"
|
|
||||||
agent_id = coder_agent.example.id
|
agent_id = coder_agent.example.id
|
||||||
agent_name = "main"
|
agent_name = "main"
|
||||||
subdomain = false
|
subdomain = false
|
||||||
|
|||||||
@@ -120,4 +120,4 @@ locals {
|
|||||||
server_base_path = var.subdomain ? "" : format("/@%s/%s%s/apps/%s", data.coder_workspace_owner.me.name, data.coder_workspace.me.name, var.agent_name != null ? ".${var.agent_name}" : "", var.slug)
|
server_base_path = var.subdomain ? "" : format("/@%s/%s%s/apps/%s", data.coder_workspace_owner.me.name, data.coder_workspace.me.name, var.agent_name != null ? ".${var.agent_name}" : "", var.slug)
|
||||||
url = "http://localhost:${var.port}${local.server_base_path}"
|
url = "http://localhost:${var.port}${local.server_base_path}"
|
||||||
healthcheck_url = "http://localhost:${var.port}${local.server_base_path}/health"
|
healthcheck_url = "http://localhost:${var.port}${local.server_base_path}/health"
|
||||||
}
|
}
|
||||||
@@ -1,9 +1,13 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
BOLD='\033[0;1m'
|
BOLD='\033[0;1m'
|
||||||
|
|
||||||
printf "$${BOLD}Installing filebrowser \n\n"
|
printf "$${BOLD}Installing filebrowser \n\n"
|
||||||
|
|
||||||
curl -fsSL https://raw.githubusercontent.com/filebrowser/get/master/get.sh | bash
|
# Check if filebrowser is installed
|
||||||
|
if ! command -v filebrowser &> /dev/null; then
|
||||||
|
curl -fsSL https://raw.githubusercontent.com/filebrowser/get/master/get.sh | bash
|
||||||
|
fi
|
||||||
|
|
||||||
printf "🥳 Installation complete! \n\n"
|
printf "🥳 Installation complete! \n\n"
|
||||||
|
|
||||||
|
|||||||
@@ -14,12 +14,12 @@ This module adds a JetBrains Gateway Button to open any workspace with a single
|
|||||||
```tf
|
```tf
|
||||||
module "jetbrains_gateway" {
|
module "jetbrains_gateway" {
|
||||||
source = "registry.coder.com/modules/jetbrains-gateway/coder"
|
source = "registry.coder.com/modules/jetbrains-gateway/coder"
|
||||||
version = "1.0.23"
|
version = "1.0.24"
|
||||||
agent_id = coder_agent.example.id
|
agent_id = coder_agent.example.id
|
||||||
agent_name = "example"
|
agent_name = "example"
|
||||||
folder = "/home/coder/example"
|
folder = "/home/coder/example"
|
||||||
jetbrains_ides = ["CL", "GO", "IU", "PY", "WS"]
|
jetbrains_ides = ["CL", "GO", "IU", "PY", "WS"]
|
||||||
default = "GO"
|
default = ["GO"]
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -32,12 +32,12 @@ module "jetbrains_gateway" {
|
|||||||
```tf
|
```tf
|
||||||
module "jetbrains_gateway" {
|
module "jetbrains_gateway" {
|
||||||
source = "registry.coder.com/modules/jetbrains-gateway/coder"
|
source = "registry.coder.com/modules/jetbrains-gateway/coder"
|
||||||
version = "1.0.23"
|
version = "1.0.24"
|
||||||
agent_id = coder_agent.example.id
|
agent_id = coder_agent.example.id
|
||||||
agent_name = "example"
|
agent_name = "example"
|
||||||
folder = "/home/coder/example"
|
folder = "/home/coder/example"
|
||||||
jetbrains_ides = ["GO", "WS"]
|
jetbrains_ides = ["GO", "WS"]
|
||||||
default = "GO"
|
default = ["GO"]
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -46,12 +46,12 @@ module "jetbrains_gateway" {
|
|||||||
```tf
|
```tf
|
||||||
module "jetbrains_gateway" {
|
module "jetbrains_gateway" {
|
||||||
source = "registry.coder.com/modules/jetbrains-gateway/coder"
|
source = "registry.coder.com/modules/jetbrains-gateway/coder"
|
||||||
version = "1.0.23"
|
version = "1.0.24"
|
||||||
agent_id = coder_agent.example.id
|
agent_id = coder_agent.example.id
|
||||||
agent_name = "example"
|
agent_name = "example"
|
||||||
folder = "/home/coder/example"
|
folder = "/home/coder/example"
|
||||||
jetbrains_ides = ["GO", "WS"]
|
jetbrains_ides = ["GO", "WS"]
|
||||||
default = "GO"
|
default = ["GO"]
|
||||||
latest = true
|
latest = true
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
@@ -61,17 +61,49 @@ module "jetbrains_gateway" {
|
|||||||
```tf
|
```tf
|
||||||
module "jetbrains_gateway" {
|
module "jetbrains_gateway" {
|
||||||
source = "registry.coder.com/modules/jetbrains-gateway/coder"
|
source = "registry.coder.com/modules/jetbrains-gateway/coder"
|
||||||
version = "1.0.23"
|
version = "1.0.24"
|
||||||
agent_id = coder_agent.example.id
|
agent_id = coder_agent.example.id
|
||||||
agent_name = "example"
|
agent_name = "example"
|
||||||
folder = "/home/coder/example"
|
folder = "/home/coder/example"
|
||||||
jetbrains_ides = ["GO", "WS"]
|
jetbrains_ides = ["GO", "WS"]
|
||||||
default = "GO"
|
default = ["GO"]
|
||||||
latest = true
|
latest = true
|
||||||
channel = "eap"
|
channel = "eap"
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Add Multiple IDEs with the default set to GoLand
|
||||||
|
|
||||||
|
```tf
|
||||||
|
module "jetbrains_gateway" {
|
||||||
|
source = "registry.coder.com/modules/jetbrains-gateway/coder"
|
||||||
|
version = "1.0.24"
|
||||||
|
agent_id = coder_agent.example.id
|
||||||
|
agent_name = "example"
|
||||||
|
folder = "/home/coder/example"
|
||||||
|
jetbrains_ides = ["GO", "WS", "RD", "PY"]
|
||||||
|
default = ["GO", "PY"]
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Custom release download link
|
||||||
|
|
||||||
|
Due to the highest priority of the `ide_download_link` parameter in the `(jetbrains-gateway://...` within IDEA, the pre-configured download address will be overridden when using [IDEA's offline mode](https://www.jetbrains.com/help/idea/fully-offline-mode.html). Therefore, it is necessary to configure the `download_base_link` parameter for the `jetbrains_gateway` module to change the value of `ide_download_link`.
|
||||||
|
|
||||||
|
```tf
|
||||||
|
module "jetbrains_gateway" {
|
||||||
|
source = "registry.coder.com/modules/jetbrains-gateway/coder"
|
||||||
|
version = "1.0.24"
|
||||||
|
agent_id = coder_agent.example.id
|
||||||
|
agent_name = "example"
|
||||||
|
folder = "/home/coder/example"
|
||||||
|
jetbrains_ides = ["GO", "WS"]
|
||||||
|
releases_base_link = "https://releases.internal.site/"
|
||||||
|
download_base_link = "https://download.internal.site/"
|
||||||
|
default = ["GO"]
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
## Supported IDEs
|
## Supported IDEs
|
||||||
|
|
||||||
This module and JetBrains Gateway support the following JetBrains IDEs:
|
This module and JetBrains Gateway support the following JetBrains IDEs:
|
||||||
|
|||||||
@@ -20,13 +20,13 @@ variable "agent_id" {
|
|||||||
|
|
||||||
variable "slug" {
|
variable "slug" {
|
||||||
type = string
|
type = string
|
||||||
description = "The slug for the coder_app resource."
|
description = "The slug for the coder_app"
|
||||||
default = "gateway"
|
default = "gateway"
|
||||||
}
|
}
|
||||||
|
|
||||||
variable "agent_name" {
|
variable "agent_name" {
|
||||||
type = string
|
type = string
|
||||||
description = "The name of the coder_agent resource."
|
description = "Agent name."
|
||||||
}
|
}
|
||||||
|
|
||||||
variable "folder" {
|
variable "folder" {
|
||||||
@@ -39,9 +39,9 @@ variable "folder" {
|
|||||||
}
|
}
|
||||||
|
|
||||||
variable "default" {
|
variable "default" {
|
||||||
default = ""
|
default = []
|
||||||
type = string
|
type = list(string)
|
||||||
description = "Default IDE"
|
description = "Default IDEs to be added to the Workspace page."
|
||||||
}
|
}
|
||||||
|
|
||||||
variable "order" {
|
variable "order" {
|
||||||
@@ -146,9 +146,35 @@ variable "jetbrains_ides" {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
variable "releases_base_link" {
|
||||||
|
type = string
|
||||||
|
description = ""
|
||||||
|
default = "https://data.services.jetbrains.com"
|
||||||
|
validation {
|
||||||
|
condition = can(regex("^https?://.+$", var.releases_base_link))
|
||||||
|
error_message = "The releases_base_link must be a valid HTTP/S address."
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
variable "download_base_link" {
|
||||||
|
type = string
|
||||||
|
description = ""
|
||||||
|
default = "https://download.jetbrains.com"
|
||||||
|
validation {
|
||||||
|
condition = can(regex("^https?://.+$", var.download_base_link))
|
||||||
|
error_message = "The download_base_link must be a valid HTTP/S address."
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
variable "provide_options" {
|
||||||
|
type = bool
|
||||||
|
description = "Whether to provide coder_parameter options."
|
||||||
|
default = true
|
||||||
|
}
|
||||||
|
|
||||||
data "http" "jetbrains_ide_versions" {
|
data "http" "jetbrains_ide_versions" {
|
||||||
for_each = var.latest ? toset(var.jetbrains_ides) : toset([])
|
for_each = var.latest ? toset(var.jetbrains_ides) : toset([])
|
||||||
url = "https://data.services.jetbrains.com/products/releases?code=${each.key}&latest=true&type=${var.channel}"
|
url = "${var.releases_base_link}/products/releases?code=${each.key}&latest=true&type=${var.channel}"
|
||||||
}
|
}
|
||||||
|
|
||||||
locals {
|
locals {
|
||||||
@@ -158,7 +184,7 @@ locals {
|
|||||||
name = "GoLand",
|
name = "GoLand",
|
||||||
identifier = "GO",
|
identifier = "GO",
|
||||||
build_number = var.jetbrains_ide_versions["GO"].build_number,
|
build_number = var.jetbrains_ide_versions["GO"].build_number,
|
||||||
download_link = "https://download.jetbrains.com/go/goland-${var.jetbrains_ide_versions["GO"].version}.tar.gz"
|
download_link = "${var.download_base_link}/go/goland-${var.jetbrains_ide_versions["GO"].version}.tar.gz"
|
||||||
version = var.jetbrains_ide_versions["GO"].version
|
version = var.jetbrains_ide_versions["GO"].version
|
||||||
},
|
},
|
||||||
"WS" = {
|
"WS" = {
|
||||||
@@ -166,7 +192,7 @@ locals {
|
|||||||
name = "WebStorm",
|
name = "WebStorm",
|
||||||
identifier = "WS",
|
identifier = "WS",
|
||||||
build_number = var.jetbrains_ide_versions["WS"].build_number,
|
build_number = var.jetbrains_ide_versions["WS"].build_number,
|
||||||
download_link = "https://download.jetbrains.com/webstorm/WebStorm-${var.jetbrains_ide_versions["WS"].version}.tar.gz"
|
download_link = "${var.download_base_link}/webstorm/WebStorm-${var.jetbrains_ide_versions["WS"].version}.tar.gz"
|
||||||
version = var.jetbrains_ide_versions["WS"].version
|
version = var.jetbrains_ide_versions["WS"].version
|
||||||
},
|
},
|
||||||
"IU" = {
|
"IU" = {
|
||||||
@@ -174,7 +200,7 @@ locals {
|
|||||||
name = "IntelliJ IDEA Ultimate",
|
name = "IntelliJ IDEA Ultimate",
|
||||||
identifier = "IU",
|
identifier = "IU",
|
||||||
build_number = var.jetbrains_ide_versions["IU"].build_number,
|
build_number = var.jetbrains_ide_versions["IU"].build_number,
|
||||||
download_link = "https://download.jetbrains.com/idea/ideaIU-${var.jetbrains_ide_versions["IU"].version}.tar.gz"
|
download_link = "${var.download_base_link}/idea/ideaIU-${var.jetbrains_ide_versions["IU"].version}.tar.gz"
|
||||||
version = var.jetbrains_ide_versions["IU"].version
|
version = var.jetbrains_ide_versions["IU"].version
|
||||||
},
|
},
|
||||||
"PY" = {
|
"PY" = {
|
||||||
@@ -182,7 +208,7 @@ locals {
|
|||||||
name = "PyCharm Professional",
|
name = "PyCharm Professional",
|
||||||
identifier = "PY",
|
identifier = "PY",
|
||||||
build_number = var.jetbrains_ide_versions["PY"].build_number,
|
build_number = var.jetbrains_ide_versions["PY"].build_number,
|
||||||
download_link = "https://download.jetbrains.com/python/pycharm-professional-${var.jetbrains_ide_versions["PY"].version}.tar.gz"
|
download_link = "${var.download_base_link}/python/pycharm-professional-${var.jetbrains_ide_versions["PY"].version}.tar.gz"
|
||||||
version = var.jetbrains_ide_versions["PY"].version
|
version = var.jetbrains_ide_versions["PY"].version
|
||||||
},
|
},
|
||||||
"CL" = {
|
"CL" = {
|
||||||
@@ -190,7 +216,7 @@ locals {
|
|||||||
name = "CLion",
|
name = "CLion",
|
||||||
identifier = "CL",
|
identifier = "CL",
|
||||||
build_number = var.jetbrains_ide_versions["CL"].build_number,
|
build_number = var.jetbrains_ide_versions["CL"].build_number,
|
||||||
download_link = "https://download.jetbrains.com/cpp/CLion-${var.jetbrains_ide_versions["CL"].version}.tar.gz"
|
download_link = "${var.download_base_link}/cpp/CLion-${var.jetbrains_ide_versions["CL"].version}.tar.gz"
|
||||||
version = var.jetbrains_ide_versions["CL"].version
|
version = var.jetbrains_ide_versions["CL"].version
|
||||||
},
|
},
|
||||||
"PS" = {
|
"PS" = {
|
||||||
@@ -198,7 +224,7 @@ locals {
|
|||||||
name = "PhpStorm",
|
name = "PhpStorm",
|
||||||
identifier = "PS",
|
identifier = "PS",
|
||||||
build_number = var.jetbrains_ide_versions["PS"].build_number,
|
build_number = var.jetbrains_ide_versions["PS"].build_number,
|
||||||
download_link = "https://download.jetbrains.com/webide/PhpStorm-${var.jetbrains_ide_versions["PS"].version}.tar.gz"
|
download_link = "${var.download_base_link}/webide/PhpStorm-${var.jetbrains_ide_versions["PS"].version}.tar.gz"
|
||||||
version = var.jetbrains_ide_versions["PS"].version
|
version = var.jetbrains_ide_versions["PS"].version
|
||||||
},
|
},
|
||||||
"RM" = {
|
"RM" = {
|
||||||
@@ -206,7 +232,7 @@ locals {
|
|||||||
name = "RubyMine",
|
name = "RubyMine",
|
||||||
identifier = "RM",
|
identifier = "RM",
|
||||||
build_number = var.jetbrains_ide_versions["RM"].build_number,
|
build_number = var.jetbrains_ide_versions["RM"].build_number,
|
||||||
download_link = "https://download.jetbrains.com/ruby/RubyMine-${var.jetbrains_ide_versions["RM"].version}.tar.gz"
|
download_link = "${var.download_base_link}/ruby/RubyMine-${var.jetbrains_ide_versions["RM"].version}.tar.gz"
|
||||||
version = var.jetbrains_ide_versions["RM"].version
|
version = var.jetbrains_ide_versions["RM"].version
|
||||||
}
|
}
|
||||||
"RD" = {
|
"RD" = {
|
||||||
@@ -214,28 +240,24 @@ locals {
|
|||||||
name = "Rider",
|
name = "Rider",
|
||||||
identifier = "RD",
|
identifier = "RD",
|
||||||
build_number = var.jetbrains_ide_versions["RD"].build_number,
|
build_number = var.jetbrains_ide_versions["RD"].build_number,
|
||||||
download_link = "https://download.jetbrains.com/rider/JetBrains.Rider-${var.jetbrains_ide_versions["RD"].version}.tar.gz"
|
download_link = "${var.download_base_link}/rider/JetBrains.Rider-${var.jetbrains_ide_versions["RD"].version}.tar.gz"
|
||||||
version = var.jetbrains_ide_versions["RD"].version
|
version = var.jetbrains_ide_versions["RD"].version
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
icon = local.jetbrains_ides[data.coder_parameter.jetbrains_ide.value].icon
|
default_ide_map = {
|
||||||
json_data = var.latest ? jsondecode(data.http.jetbrains_ide_versions[data.coder_parameter.jetbrains_ide.value].response_body) : {}
|
for ide in var.default : ide => local.jetbrains_ides[ide]
|
||||||
key = var.latest ? keys(local.json_data)[0] : ""
|
}
|
||||||
display_name = local.jetbrains_ides[data.coder_parameter.jetbrains_ide.value].name
|
|
||||||
identifier = data.coder_parameter.jetbrains_ide.value
|
|
||||||
download_link = var.latest ? local.json_data[local.key][0].downloads.linux.link : local.jetbrains_ides[data.coder_parameter.jetbrains_ide.value].download_link
|
|
||||||
build_number = var.latest ? local.json_data[local.key][0].build : local.jetbrains_ides[data.coder_parameter.jetbrains_ide.value].build_number
|
|
||||||
version = var.latest ? local.json_data[local.key][0].version : var.jetbrains_ide_versions[data.coder_parameter.jetbrains_ide.value].version
|
|
||||||
}
|
}
|
||||||
|
|
||||||
data "coder_parameter" "jetbrains_ide" {
|
data "coder_parameter" "jetbrains_ide" {
|
||||||
|
for_each = local.default_ide_map
|
||||||
type = "string"
|
type = "string"
|
||||||
name = "jetbrains_ide"
|
name = "jetbrains_ide_${each.key}"
|
||||||
display_name = "JetBrains IDE"
|
display_name = "JetBrains IDE ${each.key}"
|
||||||
icon = "/icon/gateway.svg"
|
icon = "/icon/gateway.svg"
|
||||||
mutable = true
|
mutable = true
|
||||||
default = var.default == "" ? var.jetbrains_ides[0] : var.default
|
default = each.key
|
||||||
order = var.coder_parameter_order
|
order = var.coder_parameter_order
|
||||||
|
|
||||||
dynamic "option" {
|
dynamic "option" {
|
||||||
@@ -252,50 +274,44 @@ data "coder_workspace" "me" {}
|
|||||||
data "coder_workspace_owner" "me" {}
|
data "coder_workspace_owner" "me" {}
|
||||||
|
|
||||||
resource "coder_app" "gateway" {
|
resource "coder_app" "gateway" {
|
||||||
|
for_each = local.default_ide_map
|
||||||
agent_id = var.agent_id
|
agent_id = var.agent_id
|
||||||
slug = var.slug
|
slug = "${var.slug}-${lower(each.key)}"
|
||||||
display_name = local.display_name
|
display_name = each.value.name
|
||||||
icon = local.icon
|
icon = each.value.icon
|
||||||
external = true
|
external = true
|
||||||
order = var.order
|
order = var.order
|
||||||
url = format(
|
url = join("", [
|
||||||
"jetbrains-gateway://connect#type=coder&workspace=%s&owner=%s&agent=%s&folder=%s&url=%s&token=%s&ide_product_code=%s&ide_build_number=%s&ide_download_link=%s",
|
"jetbrains-gateway://connect#type=coder&workspace=",
|
||||||
data.coder_workspace.me.name,
|
data.coder_workspace.me.name,
|
||||||
|
"&owner=",
|
||||||
data.coder_workspace_owner.me.name,
|
data.coder_workspace_owner.me.name,
|
||||||
|
"&agent=",
|
||||||
var.agent_name,
|
var.agent_name,
|
||||||
|
"&folder=",
|
||||||
var.folder,
|
var.folder,
|
||||||
|
"&url=",
|
||||||
data.coder_workspace.me.access_url,
|
data.coder_workspace.me.access_url,
|
||||||
|
"&token=",
|
||||||
"$SESSION_TOKEN",
|
"$SESSION_TOKEN",
|
||||||
data.coder_parameter.jetbrains_ide.value,
|
"&ide_product_code=",
|
||||||
local.build_number,
|
each.key,
|
||||||
local.download_link
|
"&ide_build_number=",
|
||||||
)
|
each.value.build_number,
|
||||||
|
"&ide_download_link=",
|
||||||
|
each.value.download_link,
|
||||||
|
])
|
||||||
}
|
}
|
||||||
|
|
||||||
output "identifier" {
|
output "coder_apps" {
|
||||||
value = local.identifier
|
value = {
|
||||||
}
|
for key, app in coder_app.gateway : key => {
|
||||||
|
identifier = key
|
||||||
output "display_name" {
|
display_name = app.display_name
|
||||||
value = local.display_name
|
icon = local.jetbrains_ides[key].icon
|
||||||
}
|
download_link = local.jetbrains_ides[key].download_link
|
||||||
|
build_number = local.jetbrains_ides[key].build_number
|
||||||
output "icon" {
|
version = local.jetbrains_ides[key].version
|
||||||
value = local.icon
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
output "download_link" {
|
|
||||||
value = local.download_link
|
|
||||||
}
|
|
||||||
|
|
||||||
output "build_number" {
|
|
||||||
value = local.build_number
|
|
||||||
}
|
|
||||||
|
|
||||||
output "version" {
|
|
||||||
value = local.version
|
|
||||||
}
|
|
||||||
|
|
||||||
output "url" {
|
|
||||||
value = coder_app.gateway.url
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,36 +11,12 @@ tags: [jupyter, helper, ide, web]
|
|||||||
|
|
||||||
A module that adds Jupyter Notebook in your Coder template.
|
A module that adds Jupyter Notebook in your Coder template.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
```tf
|
```tf
|
||||||
module "jupyter-notebook" {
|
module "jupyter-notebook" {
|
||||||
source = "registry.coder.com/modules/jupyter-notebook/coder"
|
source = "registry.coder.com/modules/jupyter-notebook/coder"
|
||||||
version = "1.0.23"
|
version = "1.0.19"
|
||||||
agent_id = coder_agent.example.id
|
agent_id = coder_agent.example.id
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
## Examples
|
|
||||||
|
|
||||||
### Serve on a subpath (no wildcard subdomain)
|
|
||||||
|
|
||||||
```tf
|
|
||||||
module "jupyter-notebook" {
|
|
||||||
source = "registry.coder.com/modules/jupyter-notebook/coder"
|
|
||||||
version = "1.0.23"
|
|
||||||
agent_id = coder_agent.example.id
|
|
||||||
subdomain = false
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
### Serve on a subpath with a specific agent name (multiple agents)
|
|
||||||
|
|
||||||
```tf
|
|
||||||
module "jupyter-notebook" {
|
|
||||||
source = "registry.coder.com/modules/jupyter-notebook/coder"
|
|
||||||
version = "1.0.23"
|
|
||||||
agent_id = coder_agent.example.id
|
|
||||||
agent_name = "main"
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|||||||
@@ -42,30 +42,9 @@ variable "order" {
|
|||||||
default = null
|
default = null
|
||||||
}
|
}
|
||||||
|
|
||||||
variable "agent_name" {
|
|
||||||
type = string
|
|
||||||
description = "The name of the coder_agent resource. (Only required if subdomain is false and the template uses multiple agents.)"
|
|
||||||
default = null
|
|
||||||
}
|
|
||||||
|
|
||||||
variable "slug" {
|
|
||||||
type = string
|
|
||||||
description = "The slug of the coder_app resource."
|
|
||||||
default = "jupyter-notebook"
|
|
||||||
}
|
|
||||||
|
|
||||||
variable "subdomain" {
|
|
||||||
type = bool
|
|
||||||
description = <<-EOT
|
|
||||||
Determines whether the app will be accessed via it's own subdomain or whether it will be accessed via a path on Coder.
|
|
||||||
If wildcards have not been setup by the administrator then apps with "subdomain" set to true will not be accessible.
|
|
||||||
EOT
|
|
||||||
default = true
|
|
||||||
}
|
|
||||||
|
|
||||||
resource "coder_script" "jupyter-notebook" {
|
resource "coder_script" "jupyter-notebook" {
|
||||||
agent_id = var.agent_id
|
agent_id = var.agent_id
|
||||||
display_name = "Jupyter Notebook"
|
display_name = "jupyter-notebook"
|
||||||
icon = "/icon/jupyter.svg"
|
icon = "/icon/jupyter.svg"
|
||||||
script = templatefile("${path.module}/run.sh", {
|
script = templatefile("${path.module}/run.sh", {
|
||||||
LOG_PATH : var.log_path,
|
LOG_PATH : var.log_path,
|
||||||
@@ -76,26 +55,11 @@ resource "coder_script" "jupyter-notebook" {
|
|||||||
|
|
||||||
resource "coder_app" "jupyter-notebook" {
|
resource "coder_app" "jupyter-notebook" {
|
||||||
agent_id = var.agent_id
|
agent_id = var.agent_id
|
||||||
slug = var.slug
|
slug = "jupyter-notebook"
|
||||||
display_name = "Jupyter Notebook"
|
display_name = "Jupyter Notebook"
|
||||||
url = local.url
|
url = "http://localhost:${var.port}"
|
||||||
icon = "/icon/jupyter.svg"
|
icon = "/icon/jupyter.svg"
|
||||||
subdomain = true
|
subdomain = true
|
||||||
share = var.share
|
share = var.share
|
||||||
order = var.order
|
order = var.order
|
||||||
|
|
||||||
healthcheck {
|
|
||||||
url = local.healthcheck_url
|
|
||||||
interval = 5
|
|
||||||
threshold = 6
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
data "coder_workspace_owner" "me" {}
|
|
||||||
data "coder_workspace" "me" {}
|
|
||||||
|
|
||||||
locals {
|
|
||||||
server_base_path = var.subdomain ? "" : format("/@%s/%s%s/apps/%s", data.coder_workspace_owner.me.name, data.coder_workspace.me.name, var.agent_name != null ? ".${var.agent_name}" : "", var.slug)
|
|
||||||
url = "http://localhost:${var.port}${local.server_base_path}"
|
|
||||||
healthcheck_url = "http://localhost:${var.port}${local.server_base_path}/api"
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,6 +11,8 @@ tags: [jupyter, helper, ide, web]
|
|||||||
|
|
||||||
A module that adds JupyterLab in your Coder template.
|
A module that adds JupyterLab in your Coder template.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
```tf
|
```tf
|
||||||
module "jupyterlab" {
|
module "jupyterlab" {
|
||||||
source = "registry.coder.com/modules/jupyterlab/coder"
|
source = "registry.coder.com/modules/jupyterlab/coder"
|
||||||
@@ -18,29 +20,3 @@ module "jupyterlab" {
|
|||||||
agent_id = coder_agent.example.id
|
agent_id = coder_agent.example.id
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
## Examples
|
|
||||||
|
|
||||||
### Serve on a subpath (no wildcard subdomain)
|
|
||||||
|
|
||||||
```tf
|
|
||||||
module "jupyterlab" {
|
|
||||||
source = "registry.coder.com/modules/jupyterlab/coder"
|
|
||||||
version = "1.0.23"
|
|
||||||
agent_id = coder_agent.example.id
|
|
||||||
subdomain = false
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
### Serve on a subpath with a specific agent name (multiple agents)
|
|
||||||
|
|
||||||
```tf
|
|
||||||
module "jupyterlab" {
|
|
||||||
source = "registry.coder.com/modules/jupyterlab/coder"
|
|
||||||
version = "1.0.23"
|
|
||||||
agent_id = coder_agent.example.id
|
|
||||||
agent_name = "main"
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|||||||
@@ -41,10 +41,7 @@ variable "share" {
|
|||||||
|
|
||||||
variable "subdomain" {
|
variable "subdomain" {
|
||||||
type = bool
|
type = bool
|
||||||
description = <<-EOT
|
description = "Determines whether JupyterLab will be accessed via its own subdomain or whether it will be accessed via a path on Coder."
|
||||||
Determines whether the app will be accessed via it's own subdomain or whether it will be accessed via a path on Coder.
|
|
||||||
If wildcards have not been setup by the administrator then apps with "subdomain" set to true will not be accessible.
|
|
||||||
EOT
|
|
||||||
default = true
|
default = true
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -54,18 +51,6 @@ variable "order" {
|
|||||||
default = null
|
default = null
|
||||||
}
|
}
|
||||||
|
|
||||||
variable "agent_name" {
|
|
||||||
type = string
|
|
||||||
description = "The name of the coder_agent resource. (Only required if subdomain is false and the template uses multiple agents.)"
|
|
||||||
default = null
|
|
||||||
}
|
|
||||||
|
|
||||||
variable "slug" {
|
|
||||||
type = string
|
|
||||||
description = "The slug of the coder_app resource."
|
|
||||||
default = "jupyterlab"
|
|
||||||
}
|
|
||||||
|
|
||||||
resource "coder_script" "jupyterlab" {
|
resource "coder_script" "jupyterlab" {
|
||||||
agent_id = var.agent_id
|
agent_id = var.agent_id
|
||||||
display_name = "jupyterlab"
|
display_name = "jupyterlab"
|
||||||
@@ -73,24 +58,18 @@ resource "coder_script" "jupyterlab" {
|
|||||||
script = templatefile("${path.module}/run.sh", {
|
script = templatefile("${path.module}/run.sh", {
|
||||||
LOG_PATH : var.log_path,
|
LOG_PATH : var.log_path,
|
||||||
PORT : var.port
|
PORT : var.port
|
||||||
BASE_URL : local.server_base_path
|
BASE_URL : var.subdomain ? "" : "/@${data.coder_workspace_owner.me.name}/${data.coder_workspace.me.name}/apps/jupyterlab"
|
||||||
})
|
})
|
||||||
run_on_start = true
|
run_on_start = true
|
||||||
}
|
}
|
||||||
|
|
||||||
resource "coder_app" "jupyterlab" {
|
resource "coder_app" "jupyterlab" {
|
||||||
agent_id = var.agent_id
|
agent_id = var.agent_id
|
||||||
slug = var.slug
|
slug = "jupyterlab" # sync with the usage in URL
|
||||||
display_name = "JupyterLab"
|
display_name = "JupyterLab"
|
||||||
url = local.url
|
url = var.subdomain ? "http://localhost:${var.port}" : "http://localhost:${var.port}/@${data.coder_workspace_owner.me.name}/${data.coder_workspace.me.name}/apps/jupyterlab"
|
||||||
icon = "/icon/jupyter.svg"
|
icon = "/icon/jupyter.svg"
|
||||||
subdomain = var.subdomain
|
subdomain = var.subdomain
|
||||||
share = var.share
|
share = var.share
|
||||||
order = var.order
|
order = var.order
|
||||||
}
|
}
|
||||||
|
|
||||||
locals {
|
|
||||||
server_base_path = var.subdomain ? "" : format("/@%s/%s%s/apps/%s", data.coder_workspace_owner.me.name, data.coder_workspace.me.name, var.agent_name != null ? ".${var.agent_name}" : "", var.slug)
|
|
||||||
url = "http://localhost:${var.port}${local.server_base_path}"
|
|
||||||
healthcheck_url = "http://localhost:${var.port}${local.server_base_path}/api"
|
|
||||||
}
|
|
||||||
@@ -9,7 +9,7 @@ BOLD='\033[0;1m'
|
|||||||
printf "$${BOLD}Installing jupyterlab!\n"
|
printf "$${BOLD}Installing jupyterlab!\n"
|
||||||
|
|
||||||
# check if jupyterlab is installed
|
# check if jupyterlab is installed
|
||||||
if ! command -v jupyterlab > /dev/null 2>&1; then
|
if ! command -v jupyter-lab > /dev/null 2>&1; then
|
||||||
# install jupyterlab
|
# install jupyterlab
|
||||||
# check if pipx is installed
|
# check if pipx is installed
|
||||||
if ! command -v pipx > /dev/null 2>&1; then
|
if ! command -v pipx > /dev/null 2>&1; then
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ Automatically install [KasmVNC](https://kasmweb.com/kasmvnc) in a workspace, and
|
|||||||
```tf
|
```tf
|
||||||
module "kasmvnc" {
|
module "kasmvnc" {
|
||||||
source = "registry.coder.com/modules/kasmvnc/coder"
|
source = "registry.coder.com/modules/kasmvnc/coder"
|
||||||
version = "1.0.22"
|
version = "1.0.23"
|
||||||
agent_id = coder_agent.example.id
|
agent_id = coder_agent.example.id
|
||||||
desktop_environment = "xfce"
|
desktop_environment = "xfce"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ resource "coder_script" "kasm_vnc" {
|
|||||||
script = templatefile("${path.module}/run.sh", {
|
script = templatefile("${path.module}/run.sh", {
|
||||||
PORT : var.port,
|
PORT : var.port,
|
||||||
DESKTOP_ENVIRONMENT : var.desktop_environment,
|
DESKTOP_ENVIRONMENT : var.desktop_environment,
|
||||||
VERSION : var.kasm_version
|
KASM_VERSION : var.kasm_version
|
||||||
})
|
})
|
||||||
run_on_start = true
|
run_on_start = true
|
||||||
}
|
}
|
||||||
|
|||||||
270
kasmvnc/run.sh
270
kasmvnc/run.sh
@@ -1,6 +1,7 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
#!/bin/bash
|
# Exit on error, undefined variables, and pipe failures
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
# Function to check if vncserver is already installed
|
# Function to check if vncserver is already installed
|
||||||
check_installed() {
|
check_installed() {
|
||||||
@@ -14,143 +15,167 @@ check_installed() {
|
|||||||
|
|
||||||
# Function to download a file using wget, curl, or busybox as a fallback
|
# Function to download a file using wget, curl, or busybox as a fallback
|
||||||
download_file() {
|
download_file() {
|
||||||
local url=$1
|
local url="$1"
|
||||||
local output=$2
|
local output="$2"
|
||||||
if command -v wget &> /dev/null; then
|
local download_tool
|
||||||
wget $url -O $output
|
|
||||||
elif command -v curl &> /dev/null; then
|
if command -v curl &> /dev/null; then
|
||||||
curl -fsSL $url -o $output
|
# shellcheck disable=SC2034
|
||||||
|
download_tool=(curl -fsSL)
|
||||||
|
elif command -v wget &> /dev/null; then
|
||||||
|
# shellcheck disable=SC2034
|
||||||
|
download_tool=(wget -q -O-)
|
||||||
elif command -v busybox &> /dev/null; then
|
elif command -v busybox &> /dev/null; then
|
||||||
busybox wget -O $output $url
|
# shellcheck disable=SC2034
|
||||||
|
download_tool=(busybox wget -O-)
|
||||||
else
|
else
|
||||||
echo "Neither wget, curl, nor busybox is installed. Please install one of them to proceed."
|
echo "ERROR: No download tool available (curl, wget, or busybox required)"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# shellcheck disable=SC2288
|
||||||
|
"$${download_tool[@]}" "$url" > "$output" || {
|
||||||
|
echo "ERROR: Failed to download $url"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# Function to install kasmvncserver for debian-based distros
|
# Function to install kasmvncserver for debian-based distros
|
||||||
install_deb() {
|
install_deb() {
|
||||||
local url=$1
|
local url=$1
|
||||||
download_file $url /tmp/kasmvncserver.deb
|
local kasmdeb="/tmp/kasmvncserver.deb"
|
||||||
sudo apt-get update
|
|
||||||
DEBIAN_FRONTEND=noninteractive sudo apt-get install --yes -qq --no-install-recommends --no-install-suggests /tmp/kasmvncserver.deb
|
|
||||||
sudo adduser $USER ssl-cert
|
|
||||||
rm /tmp/kasmvncserver.deb
|
|
||||||
}
|
|
||||||
|
|
||||||
# Function to install kasmvncserver for Oracle 8
|
download_file "$url" "$kasmdeb"
|
||||||
install_rpm_oracle8() {
|
|
||||||
local url=$1
|
|
||||||
download_file $url /tmp/kasmvncserver.rpm
|
|
||||||
sudo dnf config-manager --set-enabled ol8_codeready_builder
|
|
||||||
sudo dnf install oracle-epel-release-el8 -y
|
|
||||||
sudo dnf localinstall /tmp/kasmvncserver.rpm -y
|
|
||||||
sudo usermod -aG kasmvnc-cert $USER
|
|
||||||
rm /tmp/kasmvncserver.rpm
|
|
||||||
}
|
|
||||||
|
|
||||||
# Function to install kasmvncserver for CentOS 7
|
CACHE_DIR="/var/lib/apt/lists/partial"
|
||||||
install_rpm_centos7() {
|
# Check if the directory exists and was modified in the last 60 minutes
|
||||||
local url=$1
|
if [[ ! -d "$CACHE_DIR" ]] || ! find "$CACHE_DIR" -mmin -60 -print -quit &> /dev/null; then
|
||||||
download_file $url /tmp/kasmvncserver.rpm
|
echo "Stale package cache, updating..."
|
||||||
sudo yum install epel-release -y
|
# Update package cache with a 300-second timeout for dpkg lock
|
||||||
sudo yum install /tmp/kasmvncserver.rpm -y
|
sudo apt-get -o DPkg::Lock::Timeout=300 -qq update
|
||||||
sudo usermod -aG kasmvnc-cert $USER
|
fi
|
||||||
rm /tmp/kasmvncserver.rpm
|
|
||||||
|
DEBIAN_FRONTEND=noninteractive sudo apt-get -o DPkg::Lock::Timeout=300 install --yes -qq --no-install-recommends --no-install-suggests "$kasmdeb"
|
||||||
|
rm "$kasmdeb"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Function to install kasmvncserver for rpm-based distros
|
# Function to install kasmvncserver for rpm-based distros
|
||||||
install_rpm() {
|
install_rpm() {
|
||||||
local url=$1
|
local url=$1
|
||||||
download_file $url /tmp/kasmvncserver.rpm
|
local kasmrpm="/tmp/kasmvncserver.rpm"
|
||||||
sudo rpm -i /tmp/kasmvncserver.rpm
|
local package_manager
|
||||||
rm /tmp/kasmvncserver.rpm
|
|
||||||
|
if command -v dnf &> /dev/null; then
|
||||||
|
# shellcheck disable=SC2034
|
||||||
|
package_manager=(dnf localinstall -y)
|
||||||
|
elif command -v zypper &> /dev/null; then
|
||||||
|
# shellcheck disable=SC2034
|
||||||
|
package_manager=(zypper install -y)
|
||||||
|
elif command -v yum &> /dev/null; then
|
||||||
|
# shellcheck disable=SC2034
|
||||||
|
package_manager=(yum localinstall -y)
|
||||||
|
elif command -v rpm &> /dev/null; then
|
||||||
|
# Do we need to manually handle missing dependencies?
|
||||||
|
# shellcheck disable=SC2034
|
||||||
|
package_manager=(rpm -i)
|
||||||
|
else
|
||||||
|
echo "ERROR: No supported package manager available (dnf, zypper, yum, or rpm required)"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
download_file "$url" "$kasmrpm"
|
||||||
|
|
||||||
|
# shellcheck disable=SC2288
|
||||||
|
sudo "$${package_manager[@]}" "$kasmrpm" || {
|
||||||
|
echo "ERROR: Failed to install $kasmrpm"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
rm "$kasmrpm"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Function to install kasmvncserver for Alpine Linux
|
# Function to install kasmvncserver for Alpine Linux
|
||||||
install_alpine() {
|
install_alpine() {
|
||||||
local url=$1
|
local url=$1
|
||||||
download_file $url /tmp/kasmvncserver.tgz
|
local kasmtgz="/tmp/kasmvncserver.tgz"
|
||||||
tar -xzf /tmp/kasmvncserver.tgz -C /usr/local/bin/
|
|
||||||
rm /tmp/kasmvncserver.tgz
|
download_file "$url" "$kasmtgz"
|
||||||
|
|
||||||
|
tar -xzf "$kasmtgz" -C /usr/local/bin/
|
||||||
|
rm "$kasmtgz"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Detect system information
|
# Detect system information
|
||||||
distro=$(grep "^ID=" /etc/os-release | awk -F= '{print $2}')
|
if [[ ! -f /etc/os-release ]]; then
|
||||||
version=$(grep "^VERSION_ID=" /etc/os-release | awk -F= '{print $2}' | tr -d '"')
|
echo "ERROR: Cannot detect OS: /etc/os-release not found"
|
||||||
arch=$(uname -m)
|
|
||||||
|
|
||||||
echo "Detected Distribution: $distro"
|
|
||||||
echo "Detected Version: $version"
|
|
||||||
echo "Detected Architecture: $arch"
|
|
||||||
|
|
||||||
# Map arch to package arch
|
|
||||||
if [[ "$arch" == "x86_64" ]]; then
|
|
||||||
if [[ "$distro" == "ubuntu" || "$distro" == "debian" || "$distro" == "kali" ]]; then
|
|
||||||
arch="amd64"
|
|
||||||
else
|
|
||||||
arch="x86_64"
|
|
||||||
fi
|
|
||||||
elif [[ "$arch" == "aarch64" || "$arch" == "arm64" ]]; then
|
|
||||||
if [[ "$distro" == "ubuntu" || "$distro" == "debian" || "$distro" == "kali" ]]; then
|
|
||||||
arch="arm64"
|
|
||||||
else
|
|
||||||
arch="aarch64"
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
echo "Unsupported architecture: $arch"
|
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# shellcheck disable=SC1091
|
||||||
|
source /etc/os-release
|
||||||
|
distro="$ID"
|
||||||
|
distro_version="$VERSION_ID"
|
||||||
|
codename="$VERSION_CODENAME"
|
||||||
|
arch="$(uname -m)"
|
||||||
|
if [[ "$ID" == "ol" ]]; then
|
||||||
|
distro="oracle"
|
||||||
|
distro_version="$${distro_version%%.*}"
|
||||||
|
elif [[ "$ID" == "fedora" ]]; then
|
||||||
|
distro_version="$(grep -oP '\(\K[\w ]+' /etc/fedora-release | tr '[:upper:]' '[:lower:]' | tr -d ' ')"
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Detected Distribution: $distro"
|
||||||
|
echo "Detected Version: $distro_version"
|
||||||
|
echo "Detected Codename: $codename"
|
||||||
|
echo "Detected Architecture: $arch"
|
||||||
|
|
||||||
|
# Map arch to package arch
|
||||||
|
case "$arch" in
|
||||||
|
x86_64)
|
||||||
|
if [[ "$distro" =~ ^(ubuntu|debian|kali)$ ]]; then
|
||||||
|
arch="amd64"
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
aarch64)
|
||||||
|
if [[ "$distro" =~ ^(ubuntu|debian|kali)$ ]]; then
|
||||||
|
arch="arm64"
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
arm64)
|
||||||
|
: # This is effectively a noop
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "ERROR: Unsupported architecture: $arch"
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
# Check if vncserver is installed, and install if not
|
# Check if vncserver is installed, and install if not
|
||||||
if ! check_installed; then
|
if ! check_installed; then
|
||||||
echo "Installing KASM version: ${VERSION}"
|
# Check for NOPASSWD sudo (required)
|
||||||
|
if ! command -v sudo &> /dev/null || ! sudo -n true 2> /dev/null; then
|
||||||
|
echo "ERROR: sudo NOPASSWD access required!"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
base_url="https://github.com/kasmtech/KasmVNC/releases/download/v${KASM_VERSION}"
|
||||||
|
|
||||||
|
echo "Installing KASM version: ${KASM_VERSION}"
|
||||||
case $distro in
|
case $distro in
|
||||||
ubuntu | debian | kali)
|
ubuntu | debian | kali)
|
||||||
case $version in
|
bin_name="kasmvncserver_$${codename}_${KASM_VERSION}_$${arch}.deb"
|
||||||
"20.04")
|
install_deb "$base_url/$bin_name"
|
||||||
install_deb "https://github.com/kasmtech/KasmVNC/releases/download/v${VERSION}/kasmvncserver_focal_${VERSION}_$${arch}.deb"
|
|
||||||
;;
|
|
||||||
"22.04")
|
|
||||||
install_deb "https://github.com/kasmtech/KasmVNC/releases/download/v${VERSION}/kasmvncserver_jammy_${VERSION}_$${arch}.deb"
|
|
||||||
;;
|
|
||||||
"24.04")
|
|
||||||
install_deb "https://github.com/kasmtech/KasmVNC/releases/download/v${VERSION}/kasmvncserver_noble_${VERSION}_$${arch}.deb"
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
echo "Unsupported Ubuntu/Debian/Kali version: $${version}"
|
|
||||||
exit 1
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
;;
|
;;
|
||||||
oracle)
|
oracle | fedora | opensuse)
|
||||||
if [[ "$version" == "8" ]]; then
|
bin_name="kasmvncserver_$${distro}_$${distro_version}_${KASM_VERSION}_$${arch}.rpm"
|
||||||
install_rpm_oracle8 "https://github.com/kasmtech/KasmVNC/releases/download/v${VERSION}/kasmvncserver_oracle_8_${VERSION}_$${arch}.rpm"
|
install_rpm "$base_url/$bin_name"
|
||||||
else
|
|
||||||
echo "Unsupported Oracle version: $${version}"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
centos)
|
|
||||||
if [[ "$version" == "7" ]]; then
|
|
||||||
install_rpm_centos7 "https://github.com/kasmtech/KasmVNC/releases/download/v${VERSION}/kasmvncserver_centos_core_${VERSION}_$${arch}.rpm"
|
|
||||||
else
|
|
||||||
install_rpm "https://github.com/kasmtech/KasmVNC/releases/download/v${VERSION}/kasmvncserver_centos_core_${VERSION}_$${arch}.rpm"
|
|
||||||
fi
|
|
||||||
;;
|
;;
|
||||||
alpine)
|
alpine)
|
||||||
if [[ "$version" == "3.17" || "$version" == "3.18" || "$version" == "3.19" || "$version" == "3.20" ]]; then
|
bin_name="kasmvnc.alpine_$${distro_version//./}_$${arch}.tgz"
|
||||||
install_alpine "https://github.com/kasmtech/KasmVNC/releases/download/v${VERSION}/kasmvnc.alpine_$${version}_$${arch}.tgz"
|
install_alpine "$base_url/$bin_name"
|
||||||
else
|
|
||||||
echo "Unsupported Alpine version: $${version}"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
fedora | opensuse)
|
|
||||||
install_rpm "https://github.com/kasmtech/KasmVNC/releases/download/v${VERSION}/kasmvncserver_$${distro}_$${version}_${VERSION}_$${arch}.rpm"
|
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
echo "Unsupported distribution: $${distro}"
|
echo "Unsupported distribution: $distro"
|
||||||
exit 1
|
exit 1
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
@@ -158,22 +183,53 @@ else
|
|||||||
echo "vncserver already installed. Skipping installation."
|
echo "vncserver already installed. Skipping installation."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Coder port-forwarding from dashboard only supports HTTP
|
if command -v sudo &> /dev/null && sudo -n true 2> /dev/null; then
|
||||||
sudo bash -c "cat > /etc/kasmvnc/kasmvnc.yaml <<EOF
|
kasm_config_file="/etc/kasmvnc/kasmvnc.yaml"
|
||||||
|
SUDO=sudo
|
||||||
|
else
|
||||||
|
kasm_config_file="$HOME/.vnc/kasmvnc.yaml"
|
||||||
|
SUDO=
|
||||||
|
|
||||||
|
echo "WARNING: Sudo access not available, using user config dir!"
|
||||||
|
|
||||||
|
if [[ -f "$kasm_config_file" ]]; then
|
||||||
|
echo "WARNING: Custom user KasmVNC config exists, not overwriting!"
|
||||||
|
echo "WARNING: Ensure that you manually configure the appropriate settings."
|
||||||
|
kasm_config_file="/dev/stderr"
|
||||||
|
else
|
||||||
|
echo "WARNING: This may prevent custom user KasmVNC settings from applying!"
|
||||||
|
mkdir -p "$HOME/.vnc"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Writing KasmVNC config to $kasm_config_file"
|
||||||
|
$SUDO tee "$kasm_config_file" > /dev/null << EOF
|
||||||
network:
|
network:
|
||||||
protocol: http
|
protocol: http
|
||||||
websocket_port: ${PORT}
|
websocket_port: ${PORT}
|
||||||
ssl:
|
ssl:
|
||||||
require_ssl: false
|
require_ssl: false
|
||||||
|
pem_certificate:
|
||||||
|
pem_key:
|
||||||
udp:
|
udp:
|
||||||
public_ip: 127.0.0.1
|
public_ip: 127.0.0.1
|
||||||
EOF"
|
EOF
|
||||||
|
|
||||||
# This password is not used since we start the server without auth.
|
# This password is not used since we start the server without auth.
|
||||||
# The server is protected via the Coder session token / tunnel
|
# The server is protected via the Coder session token / tunnel
|
||||||
# and does not listen publicly
|
# and does not listen publicly
|
||||||
echo -e "password\npassword\n" | vncpasswd -wo -u $USER
|
echo -e "password\npassword\n" | vncpasswd -wo -u "$USER"
|
||||||
|
|
||||||
# Start the server
|
# Start the server
|
||||||
printf "🚀 Starting KasmVNC server...\n"
|
printf "🚀 Starting KasmVNC server...\n"
|
||||||
sudo -u $USER bash -c "vncserver -select-de ${DESKTOP_ENVIRONMENT} -disableBasicAuth" > /tmp/kasmvncserver.log 2>&1 &
|
vncserver -select-de "${DESKTOP_ENVIRONMENT}" -disableBasicAuth > /tmp/kasmvncserver.log 2>&1 &
|
||||||
|
pid=$!
|
||||||
|
|
||||||
|
# Wait for server to start
|
||||||
|
sleep 5
|
||||||
|
grep -v '^[[:space:]]*$' /tmp/kasmvncserver.log | tail -n 10
|
||||||
|
if ps -p $pid | grep -q "^$pid"; then
|
||||||
|
echo "ERROR: Failed to start KasmVNC server. Check full logs at /tmp/kasmvncserver.log"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
printf "🚀 KasmVNC server started successfully!\n"
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ Uses the [Coder Remote VS Code Extension](https://github.com/coder/vscode-coder)
|
|||||||
```tf
|
```tf
|
||||||
module "vscode" {
|
module "vscode" {
|
||||||
source = "registry.coder.com/modules/vscode-desktop/coder"
|
source = "registry.coder.com/modules/vscode-desktop/coder"
|
||||||
version = "1.0.23"
|
version = "1.0.15"
|
||||||
agent_id = coder_agent.example.id
|
agent_id = coder_agent.example.id
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
@@ -28,7 +28,7 @@ module "vscode" {
|
|||||||
```tf
|
```tf
|
||||||
module "vscode" {
|
module "vscode" {
|
||||||
source = "registry.coder.com/modules/vscode-desktop/coder"
|
source = "registry.coder.com/modules/vscode-desktop/coder"
|
||||||
version = "1.0.23"
|
version = "1.0.15"
|
||||||
agent_id = coder_agent.example.id
|
agent_id = coder_agent.example.id
|
||||||
folder = "/home/coder/project"
|
folder = "/home/coder/project"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,12 +20,6 @@ variable "folder" {
|
|||||||
default = ""
|
default = ""
|
||||||
}
|
}
|
||||||
|
|
||||||
variable "slug" {
|
|
||||||
type = string
|
|
||||||
description = "The slug of the coder_app resource."
|
|
||||||
default = "vscode-desktop"
|
|
||||||
}
|
|
||||||
|
|
||||||
variable "open_recent" {
|
variable "open_recent" {
|
||||||
type = bool
|
type = bool
|
||||||
description = "Open the most recent workspace or folder. Falls back to the folder if there is no recent workspace or folder to open."
|
description = "Open the most recent workspace or folder. Falls back to the folder if there is no recent workspace or folder to open."
|
||||||
@@ -45,17 +39,21 @@ resource "coder_app" "vscode" {
|
|||||||
agent_id = var.agent_id
|
agent_id = var.agent_id
|
||||||
external = true
|
external = true
|
||||||
icon = "/icon/code.svg"
|
icon = "/icon/code.svg"
|
||||||
slug = var.slug
|
slug = "vscode"
|
||||||
display_name = "VS Code Desktop"
|
display_name = "VS Code Desktop"
|
||||||
order = var.order
|
order = var.order
|
||||||
url = format(
|
url = join("", [
|
||||||
"vscode://coder.coder-remote/open?owner=%s&workspace=%s%s%s&url=%s&token=$SESSION_TOKEN",
|
"vscode://coder.coder-remote/open",
|
||||||
|
"?owner=",
|
||||||
data.coder_workspace_owner.me.name,
|
data.coder_workspace_owner.me.name,
|
||||||
|
"&workspace=",
|
||||||
data.coder_workspace.me.name,
|
data.coder_workspace.me.name,
|
||||||
var.folder != "" ? "&folder=${var.folder}" : "",
|
var.folder != "" ? join("", ["&folder=", var.folder]) : "",
|
||||||
var.open_recent ? "&openRecent" : "",
|
var.open_recent ? "&openRecent" : "",
|
||||||
data.coder_workspace.me.access_url
|
"&url=",
|
||||||
)
|
data.coder_workspace.me.access_url,
|
||||||
|
"&token=$SESSION_TOKEN",
|
||||||
|
])
|
||||||
}
|
}
|
||||||
|
|
||||||
output "vscode_url" {
|
output "vscode_url" {
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ Automatically install [Visual Studio Code Server](https://code.visualstudio.com/
|
|||||||
```tf
|
```tf
|
||||||
module "vscode-web" {
|
module "vscode-web" {
|
||||||
source = "registry.coder.com/modules/vscode-web/coder"
|
source = "registry.coder.com/modules/vscode-web/coder"
|
||||||
version = "1.0.23"
|
version = "1.0.22"
|
||||||
agent_id = coder_agent.example.id
|
agent_id = coder_agent.example.id
|
||||||
accept_license = true
|
accept_license = true
|
||||||
}
|
}
|
||||||
@@ -29,7 +29,7 @@ module "vscode-web" {
|
|||||||
```tf
|
```tf
|
||||||
module "vscode-web" {
|
module "vscode-web" {
|
||||||
source = "registry.coder.com/modules/vscode-web/coder"
|
source = "registry.coder.com/modules/vscode-web/coder"
|
||||||
version = "1.0.23"
|
version = "1.0.22"
|
||||||
agent_id = coder_agent.example.id
|
agent_id = coder_agent.example.id
|
||||||
install_prefix = "/home/coder/.vscode-web"
|
install_prefix = "/home/coder/.vscode-web"
|
||||||
folder = "/home/coder"
|
folder = "/home/coder"
|
||||||
@@ -42,7 +42,7 @@ module "vscode-web" {
|
|||||||
```tf
|
```tf
|
||||||
module "vscode-web" {
|
module "vscode-web" {
|
||||||
source = "registry.coder.com/modules/vscode-web/coder"
|
source = "registry.coder.com/modules/vscode-web/coder"
|
||||||
version = "1.0.23"
|
version = "1.0.22"
|
||||||
agent_id = coder_agent.example.id
|
agent_id = coder_agent.example.id
|
||||||
extensions = ["github.copilot", "ms-python.python", "ms-toolsai.jupyter"]
|
extensions = ["github.copilot", "ms-python.python", "ms-toolsai.jupyter"]
|
||||||
accept_license = true
|
accept_license = true
|
||||||
@@ -56,7 +56,7 @@ Configure VS Code's [settings.json](https://code.visualstudio.com/docs/getstarte
|
|||||||
```tf
|
```tf
|
||||||
module "vscode-web" {
|
module "vscode-web" {
|
||||||
source = "registry.coder.com/modules/vscode-web/coder"
|
source = "registry.coder.com/modules/vscode-web/coder"
|
||||||
version = "1.0.23"
|
version = "1.0.22"
|
||||||
agent_id = coder_agent.example.id
|
agent_id = coder_agent.example.id
|
||||||
extensions = ["dracula-theme.theme-dracula"]
|
extensions = ["dracula-theme.theme-dracula"]
|
||||||
settings = {
|
settings = {
|
||||||
@@ -65,26 +65,3 @@ module "vscode-web" {
|
|||||||
accept_license = true
|
accept_license = true
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
### Serve on a subpath (no wildcard subdomain)
|
|
||||||
|
|
||||||
```tf
|
|
||||||
module "vscode-web" {
|
|
||||||
source = "registry.coder.com/modules/vscode-web/coder"
|
|
||||||
version = "1.0.23"
|
|
||||||
agent_id = coder_agent.example.id
|
|
||||||
subdomain = false
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
### Serve on a subpath with a specific agent name (multiple agents)
|
|
||||||
|
|
||||||
```tf
|
|
||||||
module "vscode-web" {
|
|
||||||
source = "registry.coder.com/modules/vscode-web/coder"
|
|
||||||
version = "1.0.23"
|
|
||||||
agent_id = coder_agent.example.id
|
|
||||||
agent_name = "main"
|
|
||||||
subdomain = false
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|||||||
@@ -130,12 +130,6 @@ variable "subdomain" {
|
|||||||
default = true
|
default = true
|
||||||
}
|
}
|
||||||
|
|
||||||
variable "agent_name" {
|
|
||||||
type = string
|
|
||||||
description = "The name of the coder_agent resource. (Only required if subdomain is false and the template uses multiple agents.)"
|
|
||||||
default = null
|
|
||||||
}
|
|
||||||
|
|
||||||
data "coder_workspace_owner" "me" {}
|
data "coder_workspace_owner" "me" {}
|
||||||
data "coder_workspace" "me" {}
|
data "coder_workspace" "me" {}
|
||||||
|
|
||||||
@@ -191,7 +185,7 @@ resource "coder_app" "vscode-web" {
|
|||||||
}
|
}
|
||||||
|
|
||||||
locals {
|
locals {
|
||||||
server_base_path = var.subdomain ? "" : format("/@%s/%s%s/apps/%s", data.coder_workspace_owner.me.name, data.coder_workspace.me.name, var.agent_name != null ? ".${var.agent_name}" : "", var.slug)
|
server_base_path = var.subdomain ? "" : format("/@%s/%s/apps/%s/", data.coder_workspace_owner.me.name, data.coder_workspace.me.name, var.slug)
|
||||||
url = var.folder == "" ? "http://localhost:${var.port}${local.server_base_path}" : "http://localhost:${var.port}${local.server_base_path}?folder=${var.folder}"
|
url = var.folder == "" ? "http://localhost:${var.port}${local.server_base_path}" : "http://localhost:${var.port}${local.server_base_path}?folder=${var.folder}"
|
||||||
healthcheck_url = "http://localhost:${var.port}${local.server_base_path}/healthz"
|
healthcheck_url = var.subdomain ? "http://localhost:${var.port}/healthz" : "http://localhost:${var.port}${local.server_base_path}/healthz"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ Enable Remote Desktop + a web based client on Windows workspaces, powered by [de
|
|||||||
# AWS example. See below for examples of using this module with other providers
|
# AWS example. See below for examples of using this module with other providers
|
||||||
module "windows_rdp" {
|
module "windows_rdp" {
|
||||||
source = "registry.coder.com/modules/windows-rdp/coder"
|
source = "registry.coder.com/modules/windows-rdp/coder"
|
||||||
version = "1.0.23"
|
version = "1.0.18"
|
||||||
count = data.coder_workspace.me.start_count
|
count = data.coder_workspace.me.start_count
|
||||||
agent_id = resource.coder_agent.main.id
|
agent_id = resource.coder_agent.main.id
|
||||||
resource_id = resource.aws_instance.dev.id
|
resource_id = resource.aws_instance.dev.id
|
||||||
@@ -33,7 +33,7 @@ module "windows_rdp" {
|
|||||||
```tf
|
```tf
|
||||||
module "windows_rdp" {
|
module "windows_rdp" {
|
||||||
source = "registry.coder.com/modules/windows-rdp/coder"
|
source = "registry.coder.com/modules/windows-rdp/coder"
|
||||||
version = "1.0.23"
|
version = "1.0.18"
|
||||||
count = data.coder_workspace.me.start_count
|
count = data.coder_workspace.me.start_count
|
||||||
agent_id = resource.coder_agent.main.id
|
agent_id = resource.coder_agent.main.id
|
||||||
resource_id = resource.aws_instance.dev.id
|
resource_id = resource.aws_instance.dev.id
|
||||||
@@ -45,7 +45,7 @@ module "windows_rdp" {
|
|||||||
```tf
|
```tf
|
||||||
module "windows_rdp" {
|
module "windows_rdp" {
|
||||||
source = "registry.coder.com/modules/windows-rdp/coder"
|
source = "registry.coder.com/modules/windows-rdp/coder"
|
||||||
version = "1.0.23"
|
version = "1.0.18"
|
||||||
count = data.coder_workspace.me.start_count
|
count = data.coder_workspace.me.start_count
|
||||||
agent_id = resource.coder_agent.main.id
|
agent_id = resource.coder_agent.main.id
|
||||||
resource_id = resource.google_compute_instance.dev[0].id
|
resource_id = resource.google_compute_instance.dev[0].id
|
||||||
|
|||||||
@@ -39,18 +39,6 @@ variable "admin_password" {
|
|||||||
sensitive = true
|
sensitive = true
|
||||||
}
|
}
|
||||||
|
|
||||||
variable "port" {
|
|
||||||
type = number
|
|
||||||
description = "The port to run the Devolutions Gateway on."
|
|
||||||
default = 7171
|
|
||||||
}
|
|
||||||
|
|
||||||
variable "slug" {
|
|
||||||
type = string
|
|
||||||
description = "The slug of the coder_app resource."
|
|
||||||
default = "web-rdp"
|
|
||||||
}
|
|
||||||
|
|
||||||
resource "coder_script" "windows-rdp" {
|
resource "coder_script" "windows-rdp" {
|
||||||
agent_id = var.agent_id
|
agent_id = var.agent_id
|
||||||
display_name = "windows-rdp"
|
display_name = "windows-rdp"
|
||||||
@@ -59,7 +47,6 @@ resource "coder_script" "windows-rdp" {
|
|||||||
script = templatefile("${path.module}/powershell-installation-script.tftpl", {
|
script = templatefile("${path.module}/powershell-installation-script.tftpl", {
|
||||||
admin_username = var.admin_username
|
admin_username = var.admin_username
|
||||||
admin_password = var.admin_password
|
admin_password = var.admin_password
|
||||||
port = var.port
|
|
||||||
|
|
||||||
# Wanted to have this be in the powershell template file, but Terraform
|
# Wanted to have this be in the powershell template file, but Terraform
|
||||||
# doesn't allow recursive calls to the templatefile function. Have to feed
|
# doesn't allow recursive calls to the templatefile function. Have to feed
|
||||||
@@ -76,14 +63,14 @@ resource "coder_script" "windows-rdp" {
|
|||||||
resource "coder_app" "windows-rdp" {
|
resource "coder_app" "windows-rdp" {
|
||||||
agent_id = var.agent_id
|
agent_id = var.agent_id
|
||||||
share = var.share
|
share = var.share
|
||||||
slug = var.slug
|
slug = "web-rdp"
|
||||||
display_name = "Web RDP"
|
display_name = "Web RDP"
|
||||||
url = "http://localhost:${var.port}"
|
url = "http://localhost:7171"
|
||||||
icon = "/icon/desktop.svg"
|
icon = "/icon/desktop.svg"
|
||||||
subdomain = true
|
subdomain = true
|
||||||
|
|
||||||
healthcheck {
|
healthcheck {
|
||||||
url = "http://localhost:${var.port}"
|
url = "http://localhost:7171"
|
||||||
interval = 5
|
interval = 5
|
||||||
threshold = 15
|
threshold = 15
|
||||||
}
|
}
|
||||||
@@ -93,7 +80,7 @@ resource "coder_app" "rdp-docs" {
|
|||||||
agent_id = var.agent_id
|
agent_id = var.agent_id
|
||||||
display_name = "Local RDP"
|
display_name = "Local RDP"
|
||||||
slug = "rdp-docs"
|
slug = "rdp-docs"
|
||||||
icon = "/icon/windows.svg"
|
icon = "https://raw.githubusercontent.com/matifali/logos/main/windows.svg"
|
||||||
url = "https://coder.com/docs/user-guides/workspace-access/remote-desktops#rdp-desktop"
|
url = "https://coder.com/docs/ides/remote-desktops#rdp-desktop"
|
||||||
external = true
|
external = true
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ Install-DGatewayPackage
|
|||||||
|
|
||||||
# Configure Devolutions Gateway
|
# Configure Devolutions Gateway
|
||||||
$Hostname = "localhost"
|
$Hostname = "localhost"
|
||||||
$HttpListener = New-DGatewayListener "http://*:${port}" "http://*:${port}"
|
$HttpListener = New-DGatewayListener 'http://*:7171' 'http://*:7171'
|
||||||
$WebApp = New-DGatewayWebAppConfig -Enabled $true -Authentication None
|
$WebApp = New-DGatewayWebAppConfig -Enabled $true -Authentication None
|
||||||
$ConfigParams = @{
|
$ConfigParams = @{
|
||||||
Hostname = $Hostname
|
Hostname = $Hostname
|
||||||
|
|||||||
Reference in New Issue
Block a user