Skip to content

Commit 77f4ab1

Browse files
authored
feat: update IDE docs with advanced examples with pods and custom images (coder#3002)
1 parent 7f54628 commit 77f4ab1

File tree

3 files changed

+100
-6
lines changed

3 files changed

+100
-6
lines changed

docs/ides/configuring-web-ides.md

+100-6
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,9 @@ 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:
121119

122120
- CLion
123121
- pyCharm
@@ -132,6 +130,102 @@ As a starting point, see the [projector-container](https://github.com/bpmct/code
132130
- WebStorm
133131
- ➕ code-server (just in case!)
134132

133+
134+
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.
135+
136+
137+
![IntelliJ in Coder](../images/projector-intellij.png)
138+
139+
140+
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.
141+
142+
> There is a known issue passing query string parameters when opening a JetBrains IDE from an icon in your workspace ([#2669](https://github.com/coder/coder/issues/2669)). Note the `grep` statement to remove an optional password token from the configuration so a query string parameter is not passed.
143+
144+
```hcl
145+
146+
variable "jetbrains-ide" {
147+
description = "JetBrains IntelliJ IDE"
148+
default = "IntelliJ IDEA Community Edition 2022.1.3"
149+
validation {
150+
condition = contains([
151+
"IntelliJ IDEA Community Edition 2022.1.3",
152+
"IntelliJ IDEA Community Edition 2021.3",
153+
"IntelliJ IDEA Ultimate 2022.1.3",
154+
"IntelliJ IDEA Ultimate 2021.3"
155+
], var.jetbrains-ide)
156+
# Find all compatible IDEs with the `projector IDE find` command
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+
209+
**Pre-built templates:**
210+
211+
You can also reference/use to these pre-built templates with JetBrains projector:
212+
213+
- IntelliJ ([Docker](https://github.com/mark-theshark/v2-templates/tree/main/docker-with-intellij), [Kubernetes](https://github.com/mark-theshark/v2-templates/tree/main/pod-with-intellij))
214+
215+
- PyCharm ([Docker](https://github.com/mark-theshark/v2-templates/tree/main/docker-with-pycharm), [Kubernetes](https://github.com/mark-theshark/v2-templates/tree/main/pod-with-pycharm)
216+
217+
- GoLand ([Docker](https://github.com/mark-theshark/v2-templates/tree/main/docker-with-goland), [Kubernetes](https://github.com/mark-theshark/v2-templates/tree/main/pod-with-goland))
218+
219+
> 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.
220+
221+
![PyCharm in Coder](../images/projector-pycharm.png)
222+
223+
> 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.
224+
225+
> Coder OSS currently does not perform a health check([#2662](https://github.com/coder/coder/issues/2662)) 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.
226+
227+
228+
135229
## JupyterLab
136230

137231
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)