TemplatesModules
Back to Modules
code-server Icon

code-server

By:
VS Code in the browser
README
Variables (15)
Scripts (1)
Apps (1)
Source

Automatically install code-server in a workspace, create an app to access it via the dashboard, install extensions, and pre-configure editor settings.

1module "code-server" {
2  source   = "registry.coder.com/modules/code-server/coder"
3  version  = "1.0.12"
4  agent_id = coder_agent.example.id
5}

Screenshot 1

Examples

Pin Versions

1module "code-server" {
2  source          = "registry.coder.com/modules/code-server/coder"
3  version         = "1.0.12"
4  agent_id        = coder_agent.example.id
5  install_version = "4.8.3"
6}

Pre-install Extensions

Install the Dracula theme from OpenVSX:

1module "code-server" {
2  source   = "registry.coder.com/modules/code-server/coder"
3  version  = "1.0.12"
4  agent_id = coder_agent.example.id
5  extensions = [
6    "dracula-theme.theme-dracula"
7  ]
8}

Enter the <author>.<name> into the extensions array and code-server will automatically install on start.

Pre-configure Settings

Configure VS Code's settings.json file:

1module "code-server" {
2  source     = "registry.coder.com/modules/code-server/coder"
3  version    = "1.0.12"
4  agent_id   = coder_agent.example.id
5  extensions = ["dracula-theme.theme-dracula"]
6  settings = {
7    "workbench.colorTheme" = "Dracula"
8  }
9}

Install multiple extensions

Just run code-server in the background, don't fetch it from GitHub:

1module "code-server" {
2  source     = "registry.coder.com/modules/code-server/coder"
3  version    = "1.0.12"
4  agent_id   = coder_agent.example.id
5  extensions = ["dracula-theme.theme-dracula", "ms-azuretools.vscode-docker"]
6}

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:

1module "code-server" {
2  source     = "registry.coder.com/modules/code-server/coder"
3  version    = "1.0.12"
4  agent_id   = coder_agent.example.id
5  use_cached = true
6  extensions = ["dracula-theme.theme-dracula", "ms-azuretools.vscode-docker"]
7}

Just run code-server in the background, don't fetch it from GitHub:

1module "code-server" {
2  source   = "registry.coder.com/modules/code-server/coder"
3  version  = "1.0.12"
4  agent_id = coder_agent.example.id
5  offline  = true
6}