Compare commits
8 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fc914626a2 | ||
|
|
fdbb2e30d0 | ||
|
|
ee80d1f64c | ||
|
|
017f007bde | ||
|
|
18810cc51e | ||
|
|
98a428ae89 | ||
|
|
dd072e261a | ||
|
|
7e3743739e |
@@ -17,7 +17,7 @@ Customize the preselected parameter value:
|
|||||||
```tf
|
```tf
|
||||||
module "aws-region" {
|
module "aws-region" {
|
||||||
source = "registry.coder.com/modules/aws-region/coder"
|
source = "registry.coder.com/modules/aws-region/coder"
|
||||||
version = "1.0.2"
|
version = "1.0.10"
|
||||||
default = "us-east-1"
|
default = "us-east-1"
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -37,7 +37,7 @@ Change the display name and icon for a region using the corresponding maps:
|
|||||||
```tf
|
```tf
|
||||||
module "aws-region" {
|
module "aws-region" {
|
||||||
source = "registry.coder.com/modules/aws-region/coder"
|
source = "registry.coder.com/modules/aws-region/coder"
|
||||||
version = "1.0.2"
|
version = "1.0.10"
|
||||||
default = "ap-south-1"
|
default = "ap-south-1"
|
||||||
|
|
||||||
custom_names = {
|
custom_names = {
|
||||||
@@ -63,7 +63,7 @@ Hide the Asia Pacific regions Seoul and Osaka:
|
|||||||
```tf
|
```tf
|
||||||
module "aws-region" {
|
module "aws-region" {
|
||||||
source = "registry.coder.com/modules/aws-region/coder"
|
source = "registry.coder.com/modules/aws-region/coder"
|
||||||
version = "1.0.2"
|
version = "1.0.10"
|
||||||
exclude = ["ap-northeast-2", "ap-northeast-3"]
|
exclude = ["ap-northeast-2", "ap-northeast-3"]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -56,6 +56,14 @@ locals {
|
|||||||
# frequently and including the `aws_regions` data source requires
|
# frequently and including the `aws_regions` data source requires
|
||||||
# the provider, which requires a region.
|
# the provider, which requires a region.
|
||||||
regions = {
|
regions = {
|
||||||
|
"af-south-1" = {
|
||||||
|
name = "Africa (Cape Town)"
|
||||||
|
icon = "/emojis/1f1ff-1f1e6.png"
|
||||||
|
}
|
||||||
|
"ap-east-1" = {
|
||||||
|
name = "Asia Pacific (Hong Kong)"
|
||||||
|
icon = "/emojis/1f1ed-1f1f0.png"
|
||||||
|
}
|
||||||
"ap-northeast-1" = {
|
"ap-northeast-1" = {
|
||||||
name = "Asia Pacific (Tokyo)"
|
name = "Asia Pacific (Tokyo)"
|
||||||
icon = "/emojis/1f1ef-1f1f5.png"
|
icon = "/emojis/1f1ef-1f1f5.png"
|
||||||
@@ -72,6 +80,10 @@ locals {
|
|||||||
name = "Asia Pacific (Mumbai)"
|
name = "Asia Pacific (Mumbai)"
|
||||||
icon = "/emojis/1f1ee-1f1f3.png"
|
icon = "/emojis/1f1ee-1f1f3.png"
|
||||||
}
|
}
|
||||||
|
"ap-south-2" = {
|
||||||
|
name = "Asia Pacific (Hyderabad)"
|
||||||
|
icon = "/emojis/1f1ee-1f1f3.png"
|
||||||
|
}
|
||||||
"ap-southeast-1" = {
|
"ap-southeast-1" = {
|
||||||
name = "Asia Pacific (Singapore)"
|
name = "Asia Pacific (Singapore)"
|
||||||
icon = "/emojis/1f1f8-1f1ec.png"
|
icon = "/emojis/1f1f8-1f1ec.png"
|
||||||
@@ -80,18 +92,42 @@ locals {
|
|||||||
name = "Asia Pacific (Sydney)"
|
name = "Asia Pacific (Sydney)"
|
||||||
icon = "/emojis/1f1e6-1f1fa.png"
|
icon = "/emojis/1f1e6-1f1fa.png"
|
||||||
}
|
}
|
||||||
|
"ap-southeast-3" = {
|
||||||
|
name = "Asia Pacific (Jakarta)"
|
||||||
|
icon = "/emojis/1f1ee-1f1e9.png"
|
||||||
|
}
|
||||||
|
"ap-southeast-4" = {
|
||||||
|
name = "Asia Pacific (Melbourne)"
|
||||||
|
icon = "/emojis/1f1e6-1f1fa.png"
|
||||||
|
}
|
||||||
"ca-central-1" = {
|
"ca-central-1" = {
|
||||||
name = "Canada (Central)"
|
name = "Canada (Central)"
|
||||||
icon = "/emojis/1f1e8-1f1e6.png"
|
icon = "/emojis/1f1e8-1f1e6.png"
|
||||||
}
|
}
|
||||||
|
"ca-west-1" = {
|
||||||
|
name = "Canada West (Calgary)"
|
||||||
|
icon = "/emojis/1f1e8-1f1e6.png"
|
||||||
|
}
|
||||||
"eu-central-1" = {
|
"eu-central-1" = {
|
||||||
name = "EU (Frankfurt)"
|
name = "EU (Frankfurt)"
|
||||||
icon = "/emojis/1f1ea-1f1fa.png"
|
icon = "/emojis/1f1ea-1f1fa.png"
|
||||||
}
|
}
|
||||||
|
"eu-central-2" = {
|
||||||
|
name = "Europe (Zurich)"
|
||||||
|
icon = "/emojis/1f1ea-1f1fa.png"
|
||||||
|
}
|
||||||
"eu-north-1" = {
|
"eu-north-1" = {
|
||||||
name = "EU (Stockholm)"
|
name = "EU (Stockholm)"
|
||||||
icon = "/emojis/1f1ea-1f1fa.png"
|
icon = "/emojis/1f1ea-1f1fa.png"
|
||||||
}
|
}
|
||||||
|
"eu-south-1" = {
|
||||||
|
name = "Europe (Milan)"
|
||||||
|
icon = "/emojis/1f1ea-1f1fa.png"
|
||||||
|
}
|
||||||
|
"eu-south-2" = {
|
||||||
|
name = "Europe (Spain)"
|
||||||
|
icon = "/emojis/1f1ea-1f1fa.png"
|
||||||
|
}
|
||||||
"eu-west-1" = {
|
"eu-west-1" = {
|
||||||
name = "EU (Ireland)"
|
name = "EU (Ireland)"
|
||||||
icon = "/emojis/1f1ea-1f1fa.png"
|
icon = "/emojis/1f1ea-1f1fa.png"
|
||||||
@@ -104,6 +140,14 @@ locals {
|
|||||||
name = "EU (Paris)"
|
name = "EU (Paris)"
|
||||||
icon = "/emojis/1f1ea-1f1fa.png"
|
icon = "/emojis/1f1ea-1f1fa.png"
|
||||||
}
|
}
|
||||||
|
"il-central-1" = {
|
||||||
|
name = "Israel (Tel Aviv)"
|
||||||
|
icon = "/emojis/1f1ee-1f1f1.png"
|
||||||
|
}
|
||||||
|
"me-south-1" = {
|
||||||
|
name = "Middle East (Bahrain)"
|
||||||
|
icon = "/emojis/1f1e7-1f1ed.png"
|
||||||
|
}
|
||||||
"sa-east-1" = {
|
"sa-east-1" = {
|
||||||
name = "South America (São Paulo)"
|
name = "South America (São Paulo)"
|
||||||
icon = "/emojis/1f1e7-1f1f7.png"
|
icon = "/emojis/1f1e7-1f1f7.png"
|
||||||
|
|||||||
@@ -79,3 +79,30 @@ module "code-server" {
|
|||||||
extensions = ["dracula-theme.theme-dracula", "ms-azuretools.vscode-docker"]
|
extensions = ["dracula-theme.theme-dracula", "ms-azuretools.vscode-docker"]
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Offline and Use Cached Modes
|
||||||
|
|
||||||
|
By default the module looks for code-server at `/tmp/code-server` but this can be changed with `install_prefix`.
|
||||||
|
|
||||||
|
Run an existing copy of code-server if found, otherwise download from GitHub:
|
||||||
|
|
||||||
|
```tf
|
||||||
|
module "code-server" {
|
||||||
|
source = "registry.coder.com/modules/code-server/coder"
|
||||||
|
version = "1.0.8"
|
||||||
|
agent_id = coder_agent.example.id
|
||||||
|
use_cached = true
|
||||||
|
extensions = ["dracula-theme.theme-dracula", "ms-azuretools.vscode-docker"]
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
Just run code-server in the background, don't fetch it from GitHub:
|
||||||
|
|
||||||
|
```tf
|
||||||
|
module "code-server" {
|
||||||
|
source = "registry.coder.com/modules/code-server/coder"
|
||||||
|
version = "1.0.8"
|
||||||
|
agent_id = coder_agent.example.id
|
||||||
|
offline = true
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|||||||
@@ -1,5 +1,9 @@
|
|||||||
import { describe, expect, it } from "bun:test";
|
import { describe, expect, it } from "bun:test";
|
||||||
import { runTerraformInit, testRequiredVariables } from "../test";
|
import {
|
||||||
|
runTerraformApply,
|
||||||
|
runTerraformInit,
|
||||||
|
testRequiredVariables,
|
||||||
|
} from "../test";
|
||||||
|
|
||||||
describe("code-server", async () => {
|
describe("code-server", async () => {
|
||||||
await runTerraformInit(import.meta.dir);
|
await runTerraformInit(import.meta.dir);
|
||||||
@@ -8,5 +12,27 @@ describe("code-server", async () => {
|
|||||||
agent_id: "foo",
|
agent_id: "foo",
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("use_cached and offline can not be used together", () => {
|
||||||
|
const t = async () => {
|
||||||
|
await runTerraformApply(import.meta.dir, {
|
||||||
|
agent_id: "foo",
|
||||||
|
use_cached: "true",
|
||||||
|
offline: "true",
|
||||||
|
});
|
||||||
|
};
|
||||||
|
expect(t).toThrow("Offline and Use Cached can not be used together");
|
||||||
|
});
|
||||||
|
|
||||||
|
it("offline and extensions can not be used together", () => {
|
||||||
|
const t = async () => {
|
||||||
|
await runTerraformApply(import.meta.dir, {
|
||||||
|
agent_id: "foo",
|
||||||
|
offline: "true",
|
||||||
|
extensions: '["1", "2"]',
|
||||||
|
});
|
||||||
|
};
|
||||||
|
expect(t).toThrow("Offline mode does not allow extensions to be installed");
|
||||||
|
});
|
||||||
|
|
||||||
// More tests depend on shebang refactors
|
// More tests depend on shebang refactors
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -83,6 +83,18 @@ variable "order" {
|
|||||||
default = null
|
default = null
|
||||||
}
|
}
|
||||||
|
|
||||||
|
variable "offline" {
|
||||||
|
type = bool
|
||||||
|
description = "Just run code-server in the background, don't fetch it from GitHub"
|
||||||
|
default = false
|
||||||
|
}
|
||||||
|
|
||||||
|
variable "use_cached" {
|
||||||
|
type = bool
|
||||||
|
description = "Uses cached copy code-server in the background, otherwise fetched it from GitHub"
|
||||||
|
default = false
|
||||||
|
}
|
||||||
|
|
||||||
resource "coder_script" "code-server" {
|
resource "coder_script" "code-server" {
|
||||||
agent_id = var.agent_id
|
agent_id = var.agent_id
|
||||||
display_name = "code-server"
|
display_name = "code-server"
|
||||||
@@ -96,8 +108,22 @@ resource "coder_script" "code-server" {
|
|||||||
INSTALL_PREFIX : var.install_prefix,
|
INSTALL_PREFIX : var.install_prefix,
|
||||||
// This is necessary otherwise the quotes are stripped!
|
// This is necessary otherwise the quotes are stripped!
|
||||||
SETTINGS : replace(jsonencode(var.settings), "\"", "\\\""),
|
SETTINGS : replace(jsonencode(var.settings), "\"", "\\\""),
|
||||||
|
OFFLINE : var.offline,
|
||||||
|
USE_CACHED : var.use_cached,
|
||||||
})
|
})
|
||||||
run_on_start = true
|
run_on_start = true
|
||||||
|
|
||||||
|
lifecycle {
|
||||||
|
precondition {
|
||||||
|
condition = !var.offline || length(var.extensions) == 0
|
||||||
|
error_message = "Offline mode does not allow extensions to be installed"
|
||||||
|
}
|
||||||
|
|
||||||
|
precondition {
|
||||||
|
condition = !var.offline || !var.use_cached
|
||||||
|
error_message = "Offline and Use Cached can not be used together"
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
resource "coder_app" "code-server" {
|
resource "coder_app" "code-server" {
|
||||||
|
|||||||
@@ -4,6 +4,34 @@ EXTENSIONS=("${EXTENSIONS}")
|
|||||||
BOLD='\033[0;1m'
|
BOLD='\033[0;1m'
|
||||||
CODE='\033[36;40;1m'
|
CODE='\033[36;40;1m'
|
||||||
RESET='\033[0m'
|
RESET='\033[0m'
|
||||||
|
CODE_SERVER="${INSTALL_PREFIX}/bin/code-server"
|
||||||
|
|
||||||
|
function run_code_server() {
|
||||||
|
echo "👷 Running code-server in the background..."
|
||||||
|
echo "Check logs at ${LOG_PATH}!"
|
||||||
|
$CODE_SERVER --auth none --port "${PORT}" --app-name "${APP_NAME}" > "${LOG_PATH}" 2>&1 &
|
||||||
|
}
|
||||||
|
|
||||||
|
# Check if the settings file exists...
|
||||||
|
if [ ! -f ~/.local/share/code-server/User/settings.json ]; then
|
||||||
|
echo "⚙️ Creating settings file..."
|
||||||
|
mkdir -p ~/.local/share/code-server/User
|
||||||
|
echo "${SETTINGS}" > ~/.local/share/code-server/User/settings.json
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Check if code-server is already installed for offline or cached mode
|
||||||
|
if [ -f "$CODE_SERVER" ]; then
|
||||||
|
if [ "${OFFLINE}" = true ] || [ "${USE_CACHED}" = true ]; then
|
||||||
|
echo "🥳 Found a copy of code-server"
|
||||||
|
run_code_server
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
# Offline mode always expects a copy of code-server to be present
|
||||||
|
if [ "${OFFLINE}" = true ]; then
|
||||||
|
echo "Failed to find a copy of code-server"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
printf "$${BOLD}Installing code-server!\n"
|
printf "$${BOLD}Installing code-server!\n"
|
||||||
|
|
||||||
@@ -22,8 +50,6 @@ if [ $? -ne 0 ]; then
|
|||||||
fi
|
fi
|
||||||
printf "🥳 code-server has been installed in ${INSTALL_PREFIX}\n\n"
|
printf "🥳 code-server has been installed in ${INSTALL_PREFIX}\n\n"
|
||||||
|
|
||||||
CODE_SERVER="${INSTALL_PREFIX}/bin/code-server"
|
|
||||||
|
|
||||||
# Install each extension...
|
# Install each extension...
|
||||||
IFS=',' read -r -a EXTENSIONLIST <<< "$${EXTENSIONS}"
|
IFS=',' read -r -a EXTENSIONLIST <<< "$${EXTENSIONS}"
|
||||||
for extension in "$${EXTENSIONLIST[@]}"; do
|
for extension in "$${EXTENSIONLIST[@]}"; do
|
||||||
@@ -38,13 +64,4 @@ for extension in "$${EXTENSIONLIST[@]}"; do
|
|||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
# Check if the settings file exists...
|
run_code_server
|
||||||
if [ ! -f ~/.local/share/code-server/User/settings.json ]; then
|
|
||||||
echo "⚙️ Creating settings file..."
|
|
||||||
mkdir -p ~/.local/share/code-server/User
|
|
||||||
echo "${SETTINGS}" > ~/.local/share/code-server/User/settings.json
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "👷 Running code-server in the background..."
|
|
||||||
echo "Check logs at ${LOG_PATH}!"
|
|
||||||
$CODE_SERVER --auth none --port ${PORT} --app-name "${APP_NAME}" > ${LOG_PATH} 2>&1 &
|
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ This module has a chance of conflicting with the user's dotfiles / the personali
|
|||||||
```tf
|
```tf
|
||||||
module "git-commit-signing" {
|
module "git-commit-signing" {
|
||||||
source = "registry.coder.com/modules/git-commit-signing/coder"
|
source = "registry.coder.com/modules/git-commit-signing/coder"
|
||||||
version = "1.0.3"
|
version = "1.0.9"
|
||||||
agent_id = coder_agent.example.id
|
agent_id = coder_agent.example.id
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|||||||
@@ -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.8"
|
version = "1.0.9"
|
||||||
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", "IU", "PY", "PS", "CL", "RM", "RD"]
|
jetbrains_ides = ["CL", "GO", "IU", "PY", "WS"]
|
||||||
default = "PY"
|
default = "GO"
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -32,7 +32,7 @@ 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.8"
|
version = "1.0.9"
|
||||||
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"
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ Install the JF CLI and authenticate package managers with Artifactory using Arti
|
|||||||
```tf
|
```tf
|
||||||
module "jfrog" {
|
module "jfrog" {
|
||||||
source = "registry.coder.com/modules/jfrog-token/coder"
|
source = "registry.coder.com/modules/jfrog-token/coder"
|
||||||
version = "1.0.5"
|
version = "1.0.10"
|
||||||
agent_id = coder_agent.example.id
|
agent_id = coder_agent.example.id
|
||||||
jfrog_url = "https://XXXX.jfrog.io"
|
jfrog_url = "https://XXXX.jfrog.io"
|
||||||
artifactory_access_token = var.artifactory_access_token
|
artifactory_access_token = var.artifactory_access_token
|
||||||
@@ -41,7 +41,7 @@ For detailed instructions, please see this [guide](https://coder.com/docs/v2/lat
|
|||||||
```tf
|
```tf
|
||||||
module "jfrog" {
|
module "jfrog" {
|
||||||
source = "registry.coder.com/modules/jfrog-token/coder"
|
source = "registry.coder.com/modules/jfrog-token/coder"
|
||||||
version = "1.0.5"
|
version = "1.0.10"
|
||||||
agent_id = coder_agent.example.id
|
agent_id = coder_agent.example.id
|
||||||
jfrog_url = "https://YYYY.jfrog.io"
|
jfrog_url = "https://YYYY.jfrog.io"
|
||||||
artifactory_access_token = var.artifactory_access_token # An admin access token
|
artifactory_access_token = var.artifactory_access_token # An admin access token
|
||||||
@@ -74,7 +74,7 @@ The [JFrog extension](https://open-vsx.org/extension/JFrog/jfrog-vscode-extensio
|
|||||||
```tf
|
```tf
|
||||||
module "jfrog" {
|
module "jfrog" {
|
||||||
source = "registry.coder.com/modules/jfrog-token/coder"
|
source = "registry.coder.com/modules/jfrog-token/coder"
|
||||||
version = "1.0.5"
|
version = "1.0.10"
|
||||||
agent_id = coder_agent.example.id
|
agent_id = coder_agent.example.id
|
||||||
jfrog_url = "https://XXXX.jfrog.io"
|
jfrog_url = "https://XXXX.jfrog.io"
|
||||||
artifactory_access_token = var.artifactory_access_token
|
artifactory_access_token = var.artifactory_access_token
|
||||||
@@ -87,6 +87,26 @@ module "jfrog" {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Add a custom token description
|
||||||
|
|
||||||
|
```tf
|
||||||
|
data "coder_workspace" "me" {}
|
||||||
|
|
||||||
|
module "jfrog" {
|
||||||
|
source = "registry.coder.com/modules/jfrog-token/coder"
|
||||||
|
version = "1.0.10"
|
||||||
|
agent_id = coder_agent.example.id
|
||||||
|
jfrog_url = "https://XXXX.jfrog.io"
|
||||||
|
artifactory_access_token = var.artifactory_access_token
|
||||||
|
token_description = "Token for Coder workspace: ${data.coder_workspace.me.owner}/${data.coder_workspace.me.name}"
|
||||||
|
package_managers = {
|
||||||
|
"npm" : "npm",
|
||||||
|
"go" : "go",
|
||||||
|
"pypi" : "pypi"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
### Using the access token in other terraform resources
|
### Using the access token in other terraform resources
|
||||||
|
|
||||||
JFrog Access token is also available as a terraform output. You can use it in other terraform resources. For example, you can use it to configure an [Artifactory docker registry](https://jfrog.com/help/r/jfrog-artifactory-documentation/docker-registry) with the [docker terraform provider](https://registry.terraform.io/providers/kreuzwerker/docker/latest/docs).
|
JFrog Access token is also available as a terraform output. You can use it in other terraform resources. For example, you can use it to configure an [Artifactory docker registry](https://jfrog.com/help/r/jfrog-artifactory-documentation/docker-registry) with the [docker terraform provider](https://registry.terraform.io/providers/kreuzwerker/docker/latest/docs).
|
||||||
|
|||||||
@@ -34,6 +34,12 @@ variable "artifactory_access_token" {
|
|||||||
description = "The admin-level access token to use for JFrog."
|
description = "The admin-level access token to use for JFrog."
|
||||||
}
|
}
|
||||||
|
|
||||||
|
variable "token_description" {
|
||||||
|
type = string
|
||||||
|
description = "Free text token description. Useful for filtering and managing tokens."
|
||||||
|
default = "Token for Coder workspace"
|
||||||
|
}
|
||||||
|
|
||||||
variable "check_license" {
|
variable "check_license" {
|
||||||
type = bool
|
type = bool
|
||||||
description = "Toggle for pre-flight checking of Artifactory license. Default to `true`."
|
description = "Toggle for pre-flight checking of Artifactory license. Default to `true`."
|
||||||
@@ -107,6 +113,7 @@ resource "artifactory_scoped_token" "me" {
|
|||||||
scopes = ["applied-permissions/user"]
|
scopes = ["applied-permissions/user"]
|
||||||
refreshable = var.refreshable
|
refreshable = var.refreshable
|
||||||
expires_in = var.expires_in
|
expires_in = var.expires_in
|
||||||
|
description = var.token_description
|
||||||
}
|
}
|
||||||
|
|
||||||
data "coder_workspace" "me" {}
|
data "coder_workspace" "me" {}
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ Automatically installs [Node.js](https://github.com/nodejs/node) via [nvm](https
|
|||||||
```tf
|
```tf
|
||||||
module "nodejs" {
|
module "nodejs" {
|
||||||
source = "registry.coder.com/modules/nodejs/coder"
|
source = "registry.coder.com/modules/nodejs/coder"
|
||||||
version = "1.0.8"
|
version = "1.0.10"
|
||||||
agent_id = coder_agent.example.id
|
agent_id = coder_agent.example.id
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
@@ -26,7 +26,7 @@ This installs multiple versions of Node.js:
|
|||||||
```tf
|
```tf
|
||||||
module "nodejs" {
|
module "nodejs" {
|
||||||
source = "registry.coder.com/modules/nodejs/coder"
|
source = "registry.coder.com/modules/nodejs/coder"
|
||||||
version = "1.0.8"
|
version = "1.0.10"
|
||||||
agent_id = coder_agent.example.id
|
agent_id = coder_agent.example.id
|
||||||
node_versions = [
|
node_versions = [
|
||||||
"18",
|
"18",
|
||||||
@@ -44,7 +44,7 @@ A example with all available options:
|
|||||||
```tf
|
```tf
|
||||||
module "nodejs" {
|
module "nodejs" {
|
||||||
source = "registry.coder.com/modules/nodejs/coder"
|
source = "registry.coder.com/modules/nodejs/coder"
|
||||||
version = "1.0.8"
|
version = "1.0.10"
|
||||||
agent_id = coder_agent.example.id
|
agent_id = coder_agent.example.id
|
||||||
nvm_version = "v0.39.7"
|
nvm_version = "v0.39.7"
|
||||||
nvm_install_prefix = "/opt/nvm"
|
nvm_install_prefix = "/opt/nvm"
|
||||||
|
|||||||
@@ -22,8 +22,8 @@ variable "nvm_version" {
|
|||||||
|
|
||||||
variable "nvm_install_prefix" {
|
variable "nvm_install_prefix" {
|
||||||
type = string
|
type = string
|
||||||
description = "The prefix to install nvm to."
|
description = "The prefix to install nvm to (relative to $HOME)."
|
||||||
default = "$HOME/.nvm"
|
default = ".nvm"
|
||||||
}
|
}
|
||||||
|
|
||||||
variable "node_versions" {
|
variable "node_versions" {
|
||||||
|
|||||||
@@ -10,7 +10,8 @@ RESET='\033[0m'
|
|||||||
|
|
||||||
printf "$${BOLD}Installing nvm!$${RESET}\n"
|
printf "$${BOLD}Installing nvm!$${RESET}\n"
|
||||||
|
|
||||||
export NVM_DIR="$${INSTALL_PREFIX}/nvm"
|
export NVM_DIR="$HOME/$${INSTALL_PREFIX}/nvm"
|
||||||
|
mkdir -p "$NVM_DIR"
|
||||||
|
|
||||||
script="$(curl -sS -o- "https://raw.githubusercontent.com/nvm-sh/nvm/$${NVM_VERSION}/install.sh" 2>&1)"
|
script="$(curl -sS -o- "https://raw.githubusercontent.com/nvm-sh/nvm/$${NVM_VERSION}/install.sh" 2>&1)"
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
|
|||||||
@@ -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.8"
|
version = "1.0.10"
|
||||||
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.8"
|
version = "1.0.10"
|
||||||
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,9 +42,26 @@ 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.8"
|
version = "1.0.10"
|
||||||
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
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Pre-configure Settings
|
||||||
|
|
||||||
|
Configure VS Code's [settings.json](https://code.visualstudio.com/docs/getstarted/settings#_settingsjson) file:
|
||||||
|
|
||||||
|
```tf
|
||||||
|
module "vscode-web" {
|
||||||
|
source = "registry.coder.com/modules/vscode-web/coder"
|
||||||
|
version = "1.0.10"
|
||||||
|
agent_id = coder_agent.example.id
|
||||||
|
extensions = ["dracula-theme.theme-dracula"]
|
||||||
|
settings = {
|
||||||
|
"workbench.colorTheme" = "Dracula"
|
||||||
|
}
|
||||||
|
accept_license = true
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|||||||
@@ -91,6 +91,12 @@ variable "order" {
|
|||||||
default = null
|
default = null
|
||||||
}
|
}
|
||||||
|
|
||||||
|
variable "settings" {
|
||||||
|
type = map(string)
|
||||||
|
description = "A map of settings to apply to VS Code web."
|
||||||
|
default = {}
|
||||||
|
}
|
||||||
|
|
||||||
resource "coder_script" "vscode-web" {
|
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"
|
||||||
@@ -101,6 +107,8 @@ resource "coder_script" "vscode-web" {
|
|||||||
INSTALL_PREFIX : var.install_prefix,
|
INSTALL_PREFIX : var.install_prefix,
|
||||||
EXTENSIONS : join(",", var.extensions),
|
EXTENSIONS : join(",", var.extensions),
|
||||||
TELEMETRY_LEVEL : var.telemetry_level,
|
TELEMETRY_LEVEL : var.telemetry_level,
|
||||||
|
// This is necessary otherwise the quotes are stripped!
|
||||||
|
SETTINGS : replace(jsonencode(var.settings), "\"", "\\\""),
|
||||||
})
|
})
|
||||||
run_on_start = true
|
run_on_start = true
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,8 +19,8 @@ case "$ARCH" in
|
|||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
HASH=$(curl https://update.code.visualstudio.com/api/commits/stable/server-linux-$ARCH-web | cut -d '"' -f 2)
|
HASH=$(curl -fsSL https://update.code.visualstudio.com/api/commits/stable/server-linux-$ARCH-web | cut -d '"' -f 2)
|
||||||
output=$(curl -sL https://vscode.download.prss.microsoft.com/dbazure/download/stable/$HASH/vscode-server-linux-$ARCH-web.tar.gz | tar -xz -C ${INSTALL_PREFIX} --strip-components 1)
|
output=$(curl -fsSL https://vscode.download.prss.microsoft.com/dbazure/download/stable/$HASH/vscode-server-linux-$ARCH-web.tar.gz | tar -xz -C ${INSTALL_PREFIX} --strip-components 1)
|
||||||
|
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
echo "Failed to install Microsoft Visual Studio Code Server: $output"
|
echo "Failed to install Microsoft Visual Studio Code Server: $output"
|
||||||
@@ -44,6 +44,13 @@ for extension in "$${EXTENSIONLIST[@]}"; do
|
|||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
# Check if the settings file exists...
|
||||||
|
if [ ! -f ~/.vscode-server/data/Machine/settings.json ]; then
|
||||||
|
echo "⚙️ Creating settings file..."
|
||||||
|
mkdir -p ~/.vscode-server/data/Machine
|
||||||
|
echo "${SETTINGS}" > ~/.vscode-server/data/Machine/settings.json
|
||||||
|
fi
|
||||||
|
|
||||||
echo "👷 Running ${INSTALL_PREFIX}/bin/code-server serve-local --port ${PORT} --accept-server-license-terms serve-local --without-connection-token --telemetry-level ${TELEMETRY_LEVEL} in the background..."
|
echo "👷 Running ${INSTALL_PREFIX}/bin/code-server serve-local --port ${PORT} --accept-server-license-terms serve-local --without-connection-token --telemetry-level ${TELEMETRY_LEVEL} in the background..."
|
||||||
echo "Check logs at ${LOG_PATH}!"
|
echo "Check logs at ${LOG_PATH}!"
|
||||||
"${INSTALL_PREFIX}/bin/code-server" serve-local --port "${PORT}" --accept-server-license-terms serve-local --without-connection-token --telemetry-level "${TELEMETRY_LEVEL}" > "${LOG_PATH}" 2>&1 &
|
"${INSTALL_PREFIX}/bin/code-server" serve-local --port "${PORT}" --accept-server-license-terms serve-local --without-connection-token --telemetry-level "${TELEMETRY_LEVEL}" > "${LOG_PATH}" 2>&1 &
|
||||||
|
|||||||
Reference in New Issue
Block a user