Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 56eb722

Browse files
authored
feat(examples/templates/docker): switch code-server to a module and add jetbrains module (#15547)
1 parent 946328f commit 56eb722

File tree

1 file changed

+30
-19
lines changed

1 file changed

+30
-19
lines changed

examples/templates/docker/main.tf

+30-19
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,7 @@ resource "coder_agent" "main" {
4040
touch ~/.init_done
4141
fi
4242
43-
# Install the latest code-server.
44-
# Append "--version x.x.x" to install a specific version of code-server.
45-
curl -fsSL https://code-server.dev/install.sh | sh -s -- --method=standalone --prefix=/tmp/code-server
46-
47-
# Start code-server in the background.
48-
/tmp/code-server/bin/code-server --auth none --port 13337 >/tmp/code-server.log 2>&1 &
43+
# Add any commands that should be executed at workspace startup (e.g install requirements, start a program, etc) here
4944
EOT
5045

5146
# These environment variables allow you to make Git commits right away after creating a
@@ -126,20 +121,36 @@ resource "coder_agent" "main" {
126121
}
127122
}
128123

129-
resource "coder_app" "code-server" {
130-
agent_id = coder_agent.main.id
131-
slug = "code-server"
132-
display_name = "code-server"
133-
url = "http://localhost:13337/?folder=/home/${local.username}"
134-
icon = "/icon/code.svg"
135-
subdomain = false
136-
share = "owner"
124+
# See https://registry.coder.com/modules/code-server
125+
module "code-server" {
126+
count = data.coder_workspace.me.start_count
127+
source = "registry.coder.com/modules/code-server/coder"
137128

138-
healthcheck {
139-
url = "http://localhost:13337/healthz"
140-
interval = 5
141-
threshold = 6
142-
}
129+
# This ensures that the latest version of the module gets downloaded, you can also pin the module version to prevent breaking changes in production.
130+
version = ">= 1.0.0"
131+
132+
agent_id = coder_agent.main.id
133+
order = 1
134+
}
135+
136+
# See https://registry.coder.com/modules/jetbrains-gateway
137+
module "jetbrains_gateway" {
138+
count = data.coder_workspace.me.start_count
139+
source = "registry.coder.com/modules/jetbrains-gateway/coder"
140+
141+
# JetBrains IDEs to make available for the user to select
142+
jetbrains_ides = ["IU", "PY", "WS", "PS", "RD", "CL", "GO", "RM"]
143+
default = "IU"
144+
145+
# Default folder to open when starting a JetBrains IDE
146+
folder = "/home/coder"
147+
148+
# This ensures that the latest version of the module gets downloaded, you can also pin the module version to prevent breaking changes in production.
149+
version = ">= 1.0.0"
150+
151+
agent_id = coder_agent.main.id
152+
agent_name = "main"
153+
order = 2
143154
}
144155

145156
resource "docker_volume" "home_volume" {

0 commit comments

Comments
 (0)