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