|
| 1 | +## JetBrains Gateway |
| 2 | + |
| 3 | +JetBrains Gateway is a compact desktop app that allows you to work remotely with |
| 4 | +a JetBrains IDE without downloading one. Visit the |
| 5 | +[JetBrains Gateway website](https://www.jetbrains.com/remote-development/gateway/) |
| 6 | +to learn more about Gateway. |
| 7 | + |
| 8 | +Gateway can connect to a Coder workspace using Coder's Gateway plugin or through a |
| 9 | +manually configured SSH connection. |
| 10 | + |
| 11 | +You can ask your template administrator to [pre-install the JetBrains Gateway backend](../../../admin/templates/extending-templates/jetbrains-preinstall.md) in a template to help JetBrains load faster in workspaces. |
| 12 | + |
| 13 | +### How to use the plugin |
| 14 | + |
| 15 | +> If you experience problems, please |
| 16 | +> [create a GitHub issue](https://github.com/coder/coder/issues) or share in |
| 17 | +> [our Discord channel](https://discord.gg/coder). |
| 18 | +
|
| 19 | +1. [Install Gateway](https://www.jetbrains.com/help/idea/jetbrains-gateway.html) |
| 20 | + and open the application. |
| 21 | +1. Under **Install More Providers**, find the Coder icon and click **Install** |
| 22 | + to install the Coder plugin. |
| 23 | +1. After Gateway installs the plugin, it will appear in the **Run the IDE |
| 24 | + Remotely** section. |
| 25 | + |
| 26 | + Click **Connect to Coder** to launch the plugin: |
| 27 | + |
| 28 | +  |
| 29 | + |
| 30 | +1. Enter your Coder deployment's |
| 31 | + [Access Url](../../../admin/setup/index.md#access-url) and click **Connect**. |
| 32 | + |
| 33 | + Gateway opens your Coder deployment's `cli-auth` page with a session token. |
| 34 | + Click the copy button, paste the session token in the Gateway **Session |
| 35 | + Token** window, then click **OK**: |
| 36 | + |
| 37 | +  |
| 38 | + |
| 39 | +1. To create a new workspace: |
| 40 | + |
| 41 | + Click the <kbd>+</kbd> icon to open a browser and go to the templates page in |
| 42 | + your Coder deployment to create a workspace. |
| 43 | + |
| 44 | +1. If a workspace already exists but is stopped, select the workspace from the |
| 45 | + list, then click the green arrow to start the workspace. |
| 46 | + |
| 47 | +1. When the workspace status is **Running**, click **Select IDE and Project**: |
| 48 | + |
| 49 | +  |
| 50 | + |
| 51 | +1. Select the JetBrains IDE for your project and the project directory then |
| 52 | + click **Start IDE and connect**: |
| 53 | + |
| 54 | +  |
| 55 | + |
| 56 | + Gateway connects using the IDE you selected: |
| 57 | + |
| 58 | +  |
| 59 | + |
| 60 | + The JetBrains IDE is remotely installed into `~/.cache/JetBrains/RemoteDev/dist`. |
| 61 | + |
| 62 | +### Update a Coder plugin version |
| 63 | + |
| 64 | +1. Click the gear icon at the bottom left of the Gateway home screen, then |
| 65 | + **Settings**. |
| 66 | + |
| 67 | +1. In the **Marketplace** tab within Plugins, enter Coder and if a newer plugin |
| 68 | + release is available, click **Update** then **OK**: |
| 69 | + |
| 70 | +  |
| 71 | + |
| 72 | +### Configuring the Gateway plugin to use internal certificates |
| 73 | + |
| 74 | +When you attempt to connect to a Coder deployment that uses internally signed |
| 75 | +certificates, you might receive the following error in Gateway: |
| 76 | + |
| 77 | +```console |
| 78 | +Failed to configure connection to https://coder.internal.enterprise/: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target |
| 79 | +``` |
| 80 | + |
| 81 | +To resolve this issue, you will need to add Coder's certificate to the Java |
| 82 | +trust store present on your local machine as well as to the Coder plugin settings. |
| 83 | + |
| 84 | +1. Add the certificate to the Java trust store: |
| 85 | + |
| 86 | + <div class="tabs"> |
| 87 | + |
| 88 | + #### Linux |
| 89 | + |
| 90 | + ```none |
| 91 | + <Gateway installation directory>/jbr/lib/security/cacerts |
| 92 | + ``` |
| 93 | + |
| 94 | + Use the `keytool` utility that ships with Java: |
| 95 | + |
| 96 | + ```shell |
| 97 | + keytool -import -alias coder -file <certificate> -keystore /path/to/trust/store |
| 98 | + ``` |
| 99 | + |
| 100 | + #### macOS |
| 101 | + |
| 102 | + ```none |
| 103 | + <Gateway installation directory>/jbr/lib/security/cacerts |
| 104 | + /Library/Application Support/JetBrains/Toolbox/apps/JetBrainsGateway/ch-0/<app-id>/JetBrains Gateway.app/Contents/jbr/Contents/Home/lib/security/cacerts # Path for Toolbox installation |
| 105 | + ``` |
| 106 | + |
| 107 | + Use the `keytool` included in the JetBrains Gateway installation: |
| 108 | + |
| 109 | + ```shell |
| 110 | + keytool -import -alias coder -file cacert.pem -keystore /Applications/JetBrains\ Gateway.app/Contents/jbr/Contents/Home/lib/security/cacerts |
| 111 | + ``` |
| 112 | + |
| 113 | + #### Windows |
| 114 | + |
| 115 | + ```none |
| 116 | + C:\Program Files (x86)\<Gateway installation directory>\jre\lib\security\cacerts\%USERPROFILE%\AppData\Local\JetBrains\Toolbox\bin\jre\lib\security\cacerts # Path for Toolbox installation |
| 117 | + ``` |
| 118 | + |
| 119 | + Use the `keytool` included in the JetBrains Gateway installation: |
| 120 | + |
| 121 | + ```powershell |
| 122 | + & 'C:\Program Files\JetBrains\JetBrains Gateway <version>/jbr/bin/keytool.exe' 'C:\Program Files\JetBrains\JetBrains Gateway <version>/jre/lib/security/cacerts' -import -alias coder -file <cert> |
| 123 | +
|
| 124 | + # command for Toolbox installation |
| 125 | + & '%USERPROFILE%\AppData\Local\JetBrains\Toolbox\apps\Gateway\ch-0\<VERSION>\jbr\bin\keytool.exe' '%USERPROFILE%\AppData\Local\JetBrains\Toolbox\bin\jre\lib\security\cacerts' -import -alias coder -file <cert> |
| 126 | + ``` |
| 127 | + |
| 128 | + </div> |
| 129 | + |
| 130 | +1. In JetBrains, go to **Settings** > **Tools** > **Coder**. |
| 131 | + |
| 132 | +1. Paste the path to the certificate in **CA Path**. |
| 133 | + |
| 134 | +## Manually Configuring A JetBrains Gateway Connection |
| 135 | + |
| 136 | +This is in lieu of using Coder's Gateway plugin which automatically performs these steps. |
| 137 | + |
| 138 | +1. [Install Gateway](https://www.jetbrains.com/help/idea/jetbrains-gateway.html). |
| 139 | + |
| 140 | +1. [Configure the `coder` CLI](../index.md#configure-ssh). |
| 141 | + |
| 142 | +1. Open Gateway, make sure **SSH** is selected under **Remote Development**. |
| 143 | + |
| 144 | +1. Click **New Connection**: |
| 145 | + |
| 146 | +  |
| 147 | + |
| 148 | +1. In the resulting dialog, click the gear icon to the right of **Connection**: |
| 149 | + |
| 150 | +  |
| 151 | + |
| 152 | +1. Click <kbd>+</kbd> to add a new SSH connection: |
| 153 | + |
| 154 | +  |
| 155 | + |
| 156 | +1. For the Host, enter `coder.<workspace name>` |
| 157 | + |
| 158 | +1. For the Port, enter `22` (this is ignored by Coder) |
| 159 | + |
| 160 | +1. For the Username, enter your workspace username. |
| 161 | + |
| 162 | +1. For the Authentication Type, select **OpenSSH config and authentication |
| 163 | + agent**. |
| 164 | + |
| 165 | +1. Make sure the checkbox for **Parse config file ~/.ssh/config** is checked. |
| 166 | + |
| 167 | +1. Click **Test Connection** to validate these settings. |
| 168 | + |
| 169 | +1. Click **OK**: |
| 170 | + |
| 171 | +  |
| 172 | + |
| 173 | +1. Select the connection you just added: |
| 174 | + |
| 175 | +  |
| 176 | + |
| 177 | +1. Click **Check Connection and Continue**: |
| 178 | + |
| 179 | +  |
| 180 | + |
| 181 | +1. Select the JetBrains IDE for your project and the project directory. SSH into |
| 182 | + your server to create a directory or check out code if you haven't already. |
| 183 | + |
| 184 | +  |
| 185 | + |
| 186 | + The JetBrains IDE is remotely installed into `~/.cache/JetBrains/RemoteDev/dist` |
| 187 | + |
| 188 | +1. Click **Download and Start IDE** to connect. |
| 189 | + |
| 190 | +  |
| 191 | + |
| 192 | +## Using an existing JetBrains installation in the workspace |
| 193 | + |
| 194 | +For JetBrains IDEs, you can use an existing installation in the workspace. |
| 195 | +Please ask your administrator to install the JetBrains Gateway backend in the workspace by following the [preinstall guide](../../../admin/templates/extending-templates/jetbrains-preinstall.md). |
0 commit comments