Skip to content

Commit 37fdb17

Browse files
committed
move gateway and update pre-install
1 parent 3e9dd48 commit 37fdb17

File tree

4 files changed

+128
-8
lines changed

4 files changed

+128
-8
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
# Pre-install JetBrains Gateway in a template
2+
3+
For a faster JetBrains Gateway experience, pre-install the IDEs backend in your template.
4+
5+
> [!NOTE]
6+
> This guide only talks about installing the IDEs backend. For a complete guide on setting up JetBrains Gateway with client IDEs, refer to the [JetBrains Gateway air-gapped guide](../../../user-guides/workspace-access/jetbrains/jetbrains-airgapped.md).
7+
8+
## Install the Client Downloader
9+
10+
Install the JetBrains Client Downloader binary:
11+
12+
```shell
13+
wget https://download.jetbrains.com/idea/code-with-me/backend/jetbrains-clients-downloader-linux-x86_64-1867.tar.gz && \
14+
tar -xzvf jetbrains-clients-downloader-linux-x86_64-1867.tar.gz
15+
rm jetbrains-clients-downloader-linux-x86_64-1867.tar.gz
16+
```
17+
18+
## Install Gateway backend
19+
20+
```shell
21+
mkdir ~/JetBrains
22+
./jetbrains-clients-downloader-linux-x86_64-1867/bin/jetbrains-clients-downloader --products-filter <product-code> --build-filter <build-number> --platforms-filter linux-x64 --download-backends ~/JetBrains
23+
```
24+
25+
For example, to install the build `243.26053.27` of IntelliJ IDEA:
26+
27+
```shell
28+
./jetbrains-clients-downloader-linux-x86_64-1867/bin/jetbrains-clients-downloader --products-filter IU --build-filter 243.26053.27 --platforms-filter linux-x64 --download-backends ~/JetBrains
29+
tar -xzvf ~/JetBrains/backends/IU/*.tar.gz -C ~/JetBrains/backends/IU
30+
rm -rf ~/JetBrains/backends/IU/*.tar.gz
31+
```
32+
33+
## Register the Gateway backend
34+
35+
Add the following command to your template's `startup_script`:
36+
37+
```shell
38+
~/JetBrains/backends/IU/ideaIU-243.26053.27/bin/remote-dev-server.sh registerBackendLocationForGateway
39+
```
40+
41+
## Configure JetBrains Gateway Module
42+
43+
If you are using our [jetbrains-gateway](https://registry.coder.com/modules/jetbrains-gateway) module, you can configure it by adding the following snippet to your template:
44+
45+
```tf
46+
module "jetbrains_gateway" {
47+
count = data.coder_workspace.me.start_count
48+
source = "registry.coder.com/modules/jetbrains-gateway/coder"
49+
version = "1.0.28"
50+
agent_id = coder_agent.main.id
51+
folder = "/home/coder/example"
52+
jetbrains_ides = ["IU"]
53+
default = "IU"
54+
latest = false
55+
jetbrains_ide_versions = {
56+
"IU" = {
57+
build_number = "243.26053.27"
58+
version = "2024.3"
59+
}
60+
}
61+
}
62+
63+
resource "coder_agent" "main" {
64+
...
65+
startup_script = <<-EOF
66+
~/JetBrains/backends/IU/ideaIU-243.26053.27/bin/remote-dev-server.sh registerBackendLocationForGateway
67+
EOF
68+
}
69+
```
70+
71+
## Dockerfile example
72+
73+
If you are using Docker based workspaces, you can add the command to your Dockerfile:
74+
75+
```dockerfile
76+
FROM ubuntu
77+
78+
# Combine all apt operations in a single RUN command
79+
# Install only necessary packages
80+
# Clean up apt cache in the same layer
81+
RUN apt-get update \
82+
&& apt-get install -y --no-install-recommends \
83+
curl \
84+
git \
85+
golang \
86+
sudo \
87+
vim \
88+
wget \
89+
&& apt-get clean \
90+
&& rm -rf /var/lib/apt/lists/*
91+
92+
# Create user in a single layer
93+
ARG USER=coder
94+
RUN useradd --groups sudo --no-create-home --shell /bin/bash ${USER} \
95+
&& echo "${USER} ALL=(ALL) NOPASSWD:ALL" >/etc/sudoers.d/${USER} \
96+
&& chmod 0440 /etc/sudoers.d/${USER}
97+
98+
USER ${USER}
99+
WORKDIR /home/${USER}
100+
101+
# Install JetBrains Gateway in a single RUN command to reduce layers
102+
# Download, extract, use, and clean up in the same layer
103+
RUN mkdir -p ~/JetBrains \
104+
&& wget -q https://download.jetbrains.com/idea/code-with-me/backend/jetbrains-clients-downloader-linux-x86_64-1867.tar.gz -P /tmp \
105+
&& tar -xzf /tmp/jetbrains-clients-downloader-linux-x86_64-1867.tar.gz -C /tmp \
106+
&& /tmp/jetbrains-clients-downloader-linux-x86_64-1867/bin/jetbrains-clients-downloader \
107+
--products-filter IU \
108+
--build-filter 243.26053.27 \
109+
--platforms-filter linux-x64 \
110+
--download-backends ~/JetBrains \
111+
&& tar -xzf ~/JetBrains/backends/IU/*.tar.gz -C ~/JetBrains/backends/IU \
112+
&& rm -f ~/JetBrains/backends/IU/*.tar.gz \
113+
&& rm -rf /tmp/jetbrains-clients-downloader-linux-x86_64-1867* \
114+
&& rm -rf /tmp/*.tar.gz
115+
```
116+
117+
## Next steps
118+
119+
- [Pre-install the Client IDEs](../../../user-guides/workspace-access/jetbrains/jetbrains-airgapped.md#1-deploy-the-server-and-install-the-client-downloader)

docs/manifest.json

+5-5
Original file line numberDiff line numberDiff line change
@@ -139,11 +139,6 @@
139139
"description": "Use JetBrains IDEs with Gateway",
140140
"path": "./user-guides/workspace-access/jetbrains/index.md",
141141
"children": [
142-
{
143-
"title": "Pre-install JetBrains Gateway in a template",
144-
"description": "Pre-install JetBrains Gateway in a template",
145-
"path": "./user-guides/workspace-access/jetbrains/jetbrains-pre-install.md"
146-
},
147142
{
148143
"title": "JetBrains Gateway in an air-gapped environment",
149144
"description": "Use JetBrains Gateway in an air-gapped offline environment",
@@ -461,6 +456,11 @@
461456
"description": "Add and configure Web IDEs in your templates as coder apps",
462457
"path": "./admin/templates/extending-templates/web-ides.md"
463458
},
459+
{
460+
"title": "Pre-install JetBrains Gateway",
461+
"description": "Pre-install JetBrains Gateway in a template for faster IDE startup",
462+
"path": "./admin/templates/extending-templates/jetbrains-gateway.md"
463+
},
464464
{
465465
"title": "Docker in Workspaces",
466466
"description": "Use Docker in your workspaces",

docs/user-guides/workspace-access/jetbrains/index.md

+3-2
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ to learn more about Gateway.
2525
Gateway can connect to a Coder workspace using Coder's Gateway plugin or through a
2626
manually configured SSH connection.
2727

28-
You can [pre-install the JetBrains Gateway backend](./jetbrains-pre-install.md) in a template to help JetBrains load faster in workspaces.
28+
You can [pre-install the JetBrains Gateway backend](../../../admin/templates/extending-templates/jetbrains-gateway.md) in a template to help JetBrains load faster in workspaces.
2929

3030
### How to use the plugin
3131

@@ -208,7 +208,8 @@ This is in lieu of using Coder's Gateway plugin which automatically performs the
208208

209209
## Using an existing JetBrains installation in the workspace
210210

211-
For JetBrains IDEs, you can use an existing installation in the workspace. Please ask you administrator to install the JetBrains Gateway backend in the workspace by following the [pre-install guide](./jetbrains-pre-install.md).
211+
For JetBrains IDEs, you can use an existing installation in the workspace.
212+
Please ask your administrator to install the JetBrains Gateway backend in the workspace by following the [pre-install guide](../../../admin/templates/extending-templates/jetbrains-gateway.md).
212213

213214
> [!NOTE]
214215
> Gateway only works with paid versions of JetBrains IDEs so the script will not

docs/user-guides/workspace-access/jetbrains/jetbrains-airgapped.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -161,4 +161,4 @@ respectively.
161161

162162
## Next steps
163163

164-
- [Pre install the JetBrains IDEs backend in your workspace](./jetbrains-pre-install.md)
164+
- [Pre-install the JetBrains IDEs backend in your workspace](../../../admin/templates/extending-templates/jetbrains-gateway.md)

0 commit comments

Comments
 (0)