Skip to content

Commit 8f412c3

Browse files
committed
feat: update IDE docs with advanced examples with pods and custom images
1 parent 680e24a commit 8f412c3

File tree

3 files changed

+93
-6
lines changed

3 files changed

+93
-6
lines changed

docs/ides/configuring-web-ides.md

Lines changed: 93 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,10 @@ resource "coder_app" "code-server" {
7777
```
7878

7979
<blockquote class="warning">
80-
If the `code-server` integrated terminal fails to load, (i.e., xterm fails to load), go to DevTools to ensure xterm is loaded, clear your browser cache and refresh.
80+
If the code-server integrated terminal fails to load, (i.e., xterm fails to load), go to DevTools to ensure xterm is loaded, clear your browser cache and refresh.
8181
</blockquote>
8282

83+
8384
## VNC Desktop
8485

8586
![VNC Desktop in Coder](../images/vnc-desktop.png)
@@ -112,12 +113,10 @@ As a starting point, see the [desktop-container](https://github.com/bpmct/coder-
112113
113114
Workspace requirements:
114115

115-
- JetBrains server
116-
- IDE (e.g IntelliJ IDEA, pyCharm)
117-
118-
Installation instructions will vary depending on your workspace's operating system, platform, and build system.
116+
- JetBrains projector CLI
117+
- At least 4 CPU cores and 4 GB RAM
119118

120-
As a starting point, see the [projector-container](https://github.com/bpmct/coder-templates/tree/main/projector-container) community template. It builds & provisions a Dockerized workspaces for the following IDEs:
119+
If you would like to use a Docker host to run a JetBrains IDE, see the [projector-container](https://github.com/bpmct/coder-templates/tree/main/projector-container) community template. It builds Docker images based on JetBrains-provided images & provisions Dockerized workspaces for the following IDEs:
121120

122121
- CLion
123122
- pyCharm
@@ -132,6 +131,94 @@ As a starting point, see the [projector-container](https://github.com/bpmct/code
132131
- WebStorm
133132
- ➕ code-server (just in case!)
134133

134+
135+
For advanced users who want to make a custom image, you can install the Projector CLI in the `startup_script` of the `coder_agent` resource in a Coder template. Using the Projector CLI, you can use `projector ide autoinstall` and `projector run` to download and start a JetBrains IDE in your workspace.
136+
137+
138+
![IntelliJ in Coder](../images/projector-intellij.png)
139+
140+
141+
In this example, the version of JetBrains IntelliJ IDE is passed in from a Terraform input variable. You create a JetBrains icon in the workspace using a `coder_app` resource.
142+
143+
> There is known issue passing query string parameters when opening a JetBrains IDE from an icon in your workspace. Note the `grep` statement to remove an optional password token from the configuration so a query string parameter is not passed.
144+
145+
```hcl
146+
147+
variable "jetbrains-ide" {
148+
description = "JetBrains IntelliJ IDE"
149+
default = "IntelliJ IDEA Community Edition 2022.1.3"
150+
validation {
151+
condition = contains([
152+
"IntelliJ IDEA Community Edition 2022.1.3",
153+
"IntelliJ IDEA Community Edition 2021.3",
154+
"IntelliJ IDEA Ultimate 2022.1.3",
155+
"IntelliJ IDEA Ultimate 2021.3"
156+
], var.jetbrains-ide)
157+
error_message = "Invalid JetBrains IDE!"
158+
}
159+
}
160+
161+
resource "coder_agent" "coder" {
162+
dir = "/home/coder"
163+
startup_script = <<EOT
164+
#!/bin/bash
165+
166+
# install projector
167+
PROJECTOR_BINARY=/home/coder/.local/bin/projector
168+
if [ -f $PROJECTOR_BINARY ]; then
169+
echo 'projector has already been installed - check for update'
170+
/home/coder/.local/bin/projector self-update 2>&1 | tee projector.log
171+
else
172+
echo 'installing projector'
173+
pip3 install projector-installer --user 2>&1 | tee projector.log
174+
fi
175+
176+
echo 'access projector license terms'
177+
/home/coder/.local/bin/projector --accept-license 2>&1 | tee -a projector.log
178+
179+
PROJECTOR_CONFIG_PATH=/home/coder/.projector/configs/intellij
180+
181+
if [ -d "$PROJECTOR_CONFIG_PATH" ]; then
182+
echo 'projector has already been configured and the JetBrains IDE downloaded - skip step' 2>&1 | tee -a projector.log
183+
else
184+
echo 'autoinstalling IDE and creating projector config folder'
185+
/home/coder/.local/bin/projector ide autoinstall --config-name "intellij" --ide-name "${var.jetbrains-ide}" --hostname=localhost --port 8997 --use-separate-config --password coder 2>&1 | tee -a projector.log
186+
187+
# delete the configuration's run.sh input parameters that check password tokens since tokens do not work with coder_app yet passed in the querystring
188+
grep -iv "HANDSHAKE_TOKEN" $PROJECTOR_CONFIG_PATH/run.sh > temp && mv temp $PROJECTOR_CONFIG_PATH/run.sh 2>&1 | tee -a projector.log
189+
chmod +x $PROJECTOR_CONFIG_PATH/run.sh 2>&1 | tee -a projector.log
190+
191+
echo "creation of intellij configuration complete" 2>&1 | tee -a projector.log
192+
fi
193+
# start JetBrains projector-based IDE
194+
/home/coder/.local/bin/projector run intellij &
195+
196+
EOT
197+
}
198+
199+
resource "coder_app" "intellij" {
200+
agent_id = coder_agent.coder.id
201+
name = "${var.jetbrains-ide}"
202+
icon = "/icon/intellij.svg"
203+
url = "http://localhost:8997/"
204+
relative_path = true
205+
}
206+
```
207+
208+
Here are [Kubernetes pod](https://github.com/mark-theshark/v2-templates/tree/main/pod-with-intellij) and [Docker container](https://github.com/mark-theshark/v2-templates/tree/main/docker-with-intellij) examples with a JetBrains IntelliJ IDE.
209+
210+
Here are [Kubernetes pod](https://github.com/mark-theshark/v2-templates/tree/main/pod-with-pycharm) and [Docker container](https://github.com/mark-theshark/v2-templates/tree/main/docker-with-pycharm) examples with a JetBrains PyCharm IDE.
211+
212+
![PyCharm in Coder](../images/projector-pycharm.png)
213+
214+
Here are [Kubernetes pod](https://github.com/mark-theshark/v2-templates/tree/main/pod-with-goland) and [Docker container](https://github.com/mark-theshark/v2-templates/tree/main/docker-with-goland) examples with a JetBrains GoLand IDE.
215+
216+
> You need to have a valid `~/.kube/config` on your Coder host and a namespace on a Kubernetes cluster to use the Kubernetes pod template examples.
217+
218+
> Coder OSS currently does not perform a health check that any IDE or commands in the `startup_script` have completed, so wait a minute or so before opening the JetBrains or code-server icons. As a precaution, you can open Terminal and run `htop` to see if the processes have completed.
219+
220+
221+
135222
## JupyterLab
136223

137224
Configure your agent and `coder_app` like so to use Jupyter:

docs/images/projector-intellij.png

623 KB
Loading

docs/images/projector-pycharm.png

593 KB
Loading

0 commit comments

Comments
 (0)