Skip to content

Commit 2f6fe18

Browse files
authored
feat: Config steps for multiple JetBrains IDEs in a browser (coder#912)
* feat: multiple JetBrains IDEs in a browser * feat: multiple JetBrains IDEs - heading and Projector links * feat: multiple JetBrains IDEs - 80 char width changes * feat: multiple JetBrains IDEs - fenced blocks language * feat: multiple JetBrains IDEs - 80 char width changes
1 parent 5a9a721 commit 2f6fe18

File tree

3 files changed

+229
-0
lines changed

3 files changed

+229
-0
lines changed
Loading

workspaces/editors.md

+22
Original file line numberDiff line numberDiff line change
@@ -291,6 +291,28 @@ participants. If they do, click **Accept** to proceed.
291291
At this point, you'll be able to share your project and work with your partner
292292
in real-time.
293293

294+
## Muliple Instances of the same JetBrains IDE
295+
296+
Some JetBrains users like to have multiple projects open when coding which
297+
requires multiple JetBrains IDEs open at the same time. When using JetBrains in
298+
a browser, this requires additional configuration steps.
299+
300+
### Multiple JetBrains in a browser
301+
302+
To the user, they will use the default JetBrains IDE that Coder detects in the
303+
custom image, and one or more additional JetBrains IDEs will also appear in the
304+
workspace dashboard.
305+
306+
![Multiple IntelliJ icons in a workspace](../assets/workspaces/multi-intellij-icons-smaller.png)
307+
308+
The configuration requires installing the JetBrains Projector CLI with a
309+
configure script and a custom image. The configure script installs the Projector
310+
CLI then uses it to install as many additional IDE instances you require.
311+
Coder's [Workspace Applications](./applications.md) feature then surfaces the
312+
additional IDE icons in the workspace.
313+
314+
[Steps to configure additional JetBrains IDEs in a browser](./multi-jetbrains-in-browser.md)
315+
294316
## RStudio
295317

296318
Coder supports [RStudio](rstudio.com). To create a workspace that lets you use
+207
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,207 @@
1+
---
2+
title: "Multiple JetBrains Instances"
3+
description:
4+
Learn how to configure multiple instances of JetBrains IDEs in a browser.
5+
---
6+
7+
These are the steps to build a custom image, configure script, and config.yaml
8+
(using Workspace Applications) to surface additional JetBrains IDE instances in
9+
a browser. This example uses IntelliJ IDEA Ultimate but other JetBrains IDEs can
10+
be used.
11+
12+
> Using additional JetBrains IDEs consume additional workspace compute resources
13+
> so ensure the workspace compute resources settings are large enough.
14+
15+
![Multiple IntelliJ icons in a
16+
workspace](../assets/workspaces/multi-intellij-icons-smaller.png)
17+
18+
1. Build a custom image that installs the primary JetBrains IDE, copies the
19+
configure script, .profile script, and the config.yaml file into the image.
20+
21+
```Dockerfile
22+
FROM codercom/enterprise-java:ubuntu
23+
24+
USER root
25+
26+
# Install IntelliJ IDEA Ultimate
27+
RUN mkdir -p /opt/idea
28+
RUN curl -L \
29+
"https://download.jetbrains.com/product?code=IU&latest&distribution=linux" \
30+
| tar -C /opt/idea --strip-components 1 -xzvf -
31+
32+
# Create a symbolic link in PATH that points to the Intellij startup script.
33+
RUN ln -s /opt/idea/bin/idea.sh /usr/bin/intellij-idea-ultimate
34+
35+
# bash .profile so projector can be added to the path
36+
COPY [".profile", "/coder/.profile"]
37+
38+
# configure script
39+
COPY ["configure", "/coder/configure"]
40+
RUN chmod +x /coder/configure
41+
42+
# copy custom apps info (config.yaml)
43+
COPY ["./coder", "/coder"]
44+
45+
# Set back to coder user
46+
USER coder
47+
```
48+
49+
This is the .profile script to add the Projector CLI to the workspace's
50+
path. In this example, .profile is located in a coder directory within the
51+
directory that has the image Dockerfile.
52+
53+
```console
54+
export PATH=$PATH:$HOME/.local/bin
55+
```
56+
57+
1. The configure script installs the Projector CLI into `/home/coder` and uses
58+
the CLI to install additional JetBrains IDEs. Each IDE configuration has a
59+
different directory in `/home/coder/.projector/configs`. In this example, the
60+
configure script in the directory that has the image Dockerfile.
61+
62+
> Note that each additional IDE needs a different port number
63+
64+
```console
65+
# install projector into /home/coder/ pvc
66+
pip3 install projector-installer --user
67+
68+
# put projector CLI into path
69+
cp /coder/.profile $HOME
70+
source $HOME/.profile
71+
72+
# autoinstall intellij version specifying config name and port
73+
$HOME/.local/bin/projector --accept-license
74+
75+
PROJECTOR_CONFIG_PATH=$HOME/.projector/configs/IntelliJ_2
76+
77+
if [ -d $PROJECTOR_CONFIG_PATH ]; then
78+
echo 'projector has already been configured - skip step'
79+
else
80+
$HOME/.local/bin/projector ide autoinstall --config-name IntelliJ_2 \
81+
--ide-name "IntelliJ IDEA Ultimate 2021.3.2" --port 8997 \
82+
--use-separate-config
83+
$HOME/.local/bin/projector ide autoinstall --config-name IntelliJ_3 \
84+
--ide-name "IntelliJ IDEA Ultimate 2021.3.2" --port 8998 \
85+
--use-separate-config
86+
$HOME/.local/bin/projector ide autoinstall --config-name IntelliJ_4 \
87+
--ide-name "IntelliJ IDEA Ultimate 2021.3.2" --port 8999 \
88+
--use-separate-config
89+
fi
90+
```
91+
92+
1. This is the `config.yaml` file used by Workspace Applications to surface
93+
icons for each additional JetBrains IDE in the workspace dashboard. The
94+
configuration uses the JetBrains icon used with the initial JetBrains IDE
95+
installed. In this example, config.yaml is located in a coder/apps directory
96+
within the directory that has the image Dockerfile.
97+
98+
> Note that each workspace application name must be unique so that Projector
99+
> knows which config directory to point to
100+
101+
```yaml
102+
# /coder/apps/config.yaml
103+
apps:
104+
# Name of application in launcher. Name may consist of alphanumeric
105+
# characters, dashes, underscores. Names must begin with an alphanumeric
106+
# character. Names must be unique per application. Required.
107+
- name: IntelliJ IDEA Ultimate 2
108+
# Application scheme - must be http or https. Required.
109+
scheme: http
110+
# Application port. Required.
111+
port: 8997
112+
# Host of the application to use when dialing. Defaults to localhost.
113+
# Optional.
114+
host: "localhost"
115+
# Working directory for the start command. Required.
116+
working-directory: /home/coder
117+
# File path to icon used in application launcher. Icons should be either
118+
# PNG, SVG, or JPG. Required.
119+
icon-path: /opt/idea/bin/idea.svg
120+
# Command to start the application. Required.
121+
command: /home/coder/.projector/configs/IntelliJ_2/run.sh
122+
# Array of arguments for command. Optional.
123+
args: [""]
124+
# Health checks to get running application status. Can use exec or http
125+
# health checks to localhost. Optional, but we recommend specifying a
126+
# health check. If you don't supply one, then an http request is sent to
127+
# the application root path "/".
128+
health-check:
129+
http:
130+
# Scheme must be "http" or "https". If not specified it inherits
131+
# the application scheme. Optional.
132+
scheme: "http"
133+
# The host to use when dialing the address. If not specified it
134+
# inherits the application host. Optional.
135+
host: "localhost"
136+
# Port to use when dialing the application. If not specified it
137+
# inherits the application port. Optional.
138+
port: 8997
139+
- name: IntelliJ IDEA Ultimate 3
140+
# Application scheme - must be http or https. Required.
141+
scheme: http
142+
# Application port. Required.
143+
port: 8998
144+
# Host of the application to use when dialing. Defaults to localhost.
145+
# Optional.
146+
host: "localhost"
147+
# Working directory for the start command. Required.
148+
working-directory: /home/coder
149+
# File path to icon used in application launcher. Icons should be either
150+
# PNG, SVG, or JPG. Required.
151+
icon-path: /opt/idea/bin/idea.svg
152+
# Command to start the application. Required.
153+
command: /home/coder/.projector/configs/IntelliJ_3/run.sh
154+
# Array of arguments for command. Optional.
155+
args: [""]
156+
# Health checks to get running application status. Can use exec or http
157+
# health checks to localhost. Optional, but we recommend specifying a
158+
# health check. If you don't supply one, then an http request is sent to
159+
# the application root path "/".
160+
health-check:
161+
http:
162+
# Scheme must be "http" or "https". If not specified it inherits
163+
# the application scheme. Optional.
164+
scheme: "http"
165+
# The host to use when dialing the address. If not specified it
166+
# inherits the application host. Optional.
167+
host: "localhost"
168+
# Port to use when dialing the application. If not specified it
169+
# inherits the application port. Optional.
170+
port: 8998
171+
- name: IntelliJ IDEA Ultimate 4
172+
# Application scheme - must be http or https. Required.
173+
scheme: http
174+
# Application port. Required.
175+
port: 8999
176+
# Host of the application to use when dialing. Defaults to localhost.
177+
# Optional.
178+
host: "localhost"
179+
# Working directory for the start command. Required.
180+
working-directory: /home/coder
181+
# File path to icon used in application launcher. Icons should be either
182+
# PNG, SVG, or JPG. Required.
183+
icon-path: /opt/idea/bin/idea.svg
184+
# Command to start the application. Required.
185+
command: /home/coder/.projector/configs/IntelliJ_4/run.sh
186+
# Array of arguments for command. Optional.
187+
args: [""]
188+
# Health checks to get running application status. Can use exec or http
189+
# health checks to localhost. Optional, but we recommend specifying a
190+
# health check. If you don't supply one, then an http request is sent to
191+
# the application root path "/".
192+
health-check:
193+
http:
194+
# Scheme must be "http" or "https". If not specified it inherits
195+
# the application scheme. Optional.
196+
scheme: "http"
197+
# The host to use when dialing the address. If not specified it
198+
# inherits the application host. Optional.
199+
host: "localhost"
200+
# Port to use when dialing the application. If not specified it
201+
# inherits the application port. Optional.
202+
port: 8999
203+
204+
> Here are links to Projector CLI documentation for
205+
> [installation](https://github.com/JetBrains/projector-installer#Installation)
206+
> and [CLI
207+
> commands](https://github.com/JetBrains/projector-installer/blob/master/COMMANDS.md)

0 commit comments

Comments
 (0)