Getting started with remote development
You can connect to a remote server using the SSH connection to develop, run and deploy your project.
Prerequisites
Before you start developing on the remote machine, make sure you have the following:
You have installed a compatible SSH server on the Linux platform.
The Linux platform has any recent Linux x86 distribution such as Ubuntu 16.04+, RHEL/Centos 7+, and so on. There is no arm64 support yet. We recommend that you use Remote Development on machines with 2+ cores, 4GB+ of RAM, and 5GB+ of disk space.
You need to have the
sftp
subsystem enabled on the remote server. In the current implementation, we use it for the backend deployment.
JetBrains Gateway
JetBrains Gateway is a lightweight launcher that connects a remote server with your local machine, downloads necessary components on the backend, and opens your project in JetBrains Client.
Check out the quick video on how to start working with JetBrains Gateway.
You can use JetBrains Gateway as a standalone launcher or as an entry point from your IDE to connect to a remote server.
You can use one of the following ways to launch JetBrains Gateway:
Use the JetBrains Toolbox App to download JetBrains Gateway.
Separately download and install JetBrains Gateway.
Depending on your local OS, use one of the following installers:
Download the JetBrains Gateway EAP.dmg.
Download the JetBrains Gateway release.dmg.
Download the JetBrains Gateway EAP.dmg.
Download the JetBrains Gateway release.dmg.
Download the JetBrains Gateway EAP.exe.
Download the JetBrains Gateway release.exe.
Download the JetBrains Gateway EAP.tar.gz.
Download the JetBrains Gateway release.tar.gz.
Launch JetBrains Gateway and connect to a remote server
Download and install the JetBrains Gateway launcher.
Alternatively, you can access JetBrains Gateway from the welcome screen of your IDE through the Remote Development option.
In the Remote Development wizard, click Connect via SSH.
On the next page of the wizard, specify the SSH configuration through which you want to connect to a remote server.
Alternatively, click to open the SSH Configurations dialog and configure the SSH settings.
In the SSH Configurations dialog, add the following information:
Host: specify the address of your remote server.
Port: specify the SSH port, which defaults to
22
.Local port: specify the outgoing port.
For example,
TCP 10.101.0.1:50705->13.49.137.87:22 (ESTABLISHED)
.User name: specify the name of a user on a remote server.
Authentication type: select one of the following authentication methods:
Password: to access the host with a password. To save the password in IntelliJ IDEA, select the Save password checkbox.
Key pair (OpenSSH or PuTTY): to use SSH authentication with a key pair. To apply this authentication method, you must have a private key on the client machine and a public key on the remote server. IntelliJ IDEA supports private keys that are generated with the OpenSSH utility.
Specify the path to the file where your private key is stored and type the passphrase (if any) in the corresponding fields. To have IntelliJ IDEA remember the passphrase, select the Save passphrase checkbox.
Parse config file ~/.ssh/config: select this option if you want JetBrains Gateway to use the
.ssh/config
file.
Test Connection: click this button to see whether the connection is established.
Connection Parameters: use this section to configure additional parameters for the connection.
HTTP/SOCKS Proxy: use this section to configure proxy settings. For more information, refer to Proxy settings.
Click OK to save the changes and return to the Welcome to JetBrains Gateway dialog.
Click Check Connection and Continue to check whether the connection is established.
On the next page, specify the IntelliJ IDEA version to download to the remote server. JetBrains Gateway displays a list of the IDEs versions that are available for downloading and the already installed ones. The versions on JetBrains Client and the remote host must be the same.
Add the path to your project on the remote host.
Click Download and Start IDE.
JetBrains Gateway downloads the IDE, and opens your remote project in JetBrains Client. The connection is shown in the JetBrains Gateway window, from which you can connect to other IDEs or disable the connection. This window is hidden to tray by default.
Open recent projects
In the JetBrains Gateway wizard, select SSH from the options on the left.
In the search field enter the name of your project to quickly navigate to it.
If you need to quickly access the terminal, click .
Stop the running instance
In the JetBrains Gateway wizard, select SSH from the options on the left.
When your remote session is active, the Running indicator is displayed against the project.
Click against the project and select Stop Instance to stop the remote session for the project in question.
You can also select Remove from Recent Projects to remove the project listed on the page altogether.
Connect to a remote project from the local IDE
If you have IntelliJ IDEA installed on your remote server, you can quickly connect to your remote project from the local IDE. It works the same as from JetBrains Gateway.
Connect from the local IDE
Make sure you have downloaded and installed JetBrains Gateway on your local machine.
Make sure you have an SSH connection and the IntelliJ IDEA IDE on the remote host.
In the terminal, run the following command:
remote-dev-server.sh run <path/to/project> --ssh-link-host <host>For example,
~/ideaIU-213.3469/bin/remote-dev-server.sh run ~/development/spring-boot-example/ --ssh-link-host ec2-13-50-136-85.eu-north-1.compute.amazonaws.com
The
remote-dev-server.sh
script, along with the downloaded IDE and the IDE logs are located in thebin
directory on the remote server. To locate it, you can run the following command:find ~ -iname 'remote-dev-server.sh'which will output the path to the
remote-dev-server.sh
script:/home/ubuntu/.cache/JetBrains/RemoteDev/dist/247c8fb97bb32_ideaIU-213.5281.20/bin/remote-dev-server.shAs an output, you should receive the following link:
Http link: https://code-with-me...
Copy the generated link and paste it into your local browser.
In the dialog that opens, click Open JetBrains Gateway.
The JetBrains Gateway welcome screen opens.
In the Connect to Remote Host with a Link section, enter the same generated link to start a remote session.
Click Connect. IntelliJ IDEA opens the remote project in JetBrains Client.
Connect through Space
You can perform a custom orchestration on your remote server and use, for example, a Docker file, or any other automation that fits with your practices. This could be creating a new virtual image every night, taking the empty environment, and checking out the latest source code, with a fresh clean image ready to use in the morning.
However, if you work in Space, the integration with JetBrains Gateway lets you automate all processes in configuring your dev environment that you can use for software development.
Space automates for you the following processes:
Creating a remote virtual machine
Starting a Docker image with appropriate libraries and tools
Downloading and warming up the backend IDE so you can easily open your project and dive into coding right away.
Connect via Space
Launch JetBrains Gateway.
On the JetBrains Gateway starting page, select JetBrains Space and click Connect to Space.
Log in to JetBrains Space with your credentials.
Click Continue in Browser and make sure you are connected.
Click Allow to get back to JetBrains Gateway.
In JetBrains Gateway, click Browse Dev Environments.
In Space, configure the dev environment you want to use.
Find the project you want to open remotely and click Open in IDE.
In the dialog that opens, in the Select IDE drop-down, select IntelliJ IDEA with Gateway, configure other options if you need, and click Create.
On the page that opens, click Open JetBrains Gateway.
JetBrains Gateway launches, downloads all the necessary backend components, and opens JetBrains Client with your project where you can work further.
Install plugins
You can install plugins that you need on the remote server. Note that plugins are installed per project. Each time you create a remote connection for a new project, you need to install a plugin that you need.
Based on the scenario that you use for downloading IntelliJ IDEA on the remote server, you either install the plugin via the command line or use the UI of a remote project for your installation.
Install a plugin via the command line
If you manually configure IntelliJ IDEA on the remote server, use the following steps to add plugins:
From the JetBrains Marketplace page, find a page of the required plugin, select "Versions" tab, click any version to copy
pluginId
(short name such asorg.rust.lang
) of the plugin you want to install.Open of the remote server and add the following command:
bin/remote-dev-server.sh installPlugins PROJECT_PATH pluginId(where
PROJECT_PATH
is a path to your remote project andpluginId
is an ID you got from the JetBrains Marketplace page.)Continue with launching JetBrains Gateway and opening the remote project with the remotely installed plugin.
Install a plugin via UI
If you use JetBrains Gateway to download IntelliJ IDEA to a remote server, use the following steps to install plugins.
Open a remote project in JetBrains Client.
Press Ctrl+Alt+S to open the IDE settings and select Plugins On Host.
Download the needed plugin the same way as you would in a regular IntelliJ IDEA project.
For more information on regular plugin installation, refer to Install plugins.
After you download and enable the plugin, click OK to save the changes.
The plugin is installed remotely. However, keep in mind that the plugin is installed per project.
Alternatively, on the main toolbar, click and select Plugins. In this case the remote Plugins settings page will be opened.
Work inside the remote project
A remote project gets opened in JetBrains Client as it would be opened in your local IntelliJ IDEA IDE. You can develop it like any other local project: edit code, run applications, debug, and deploy.
If you want to find more about the Remote Development processes and architecture in general, refer to Remote development overview.
Add an SDK to the opened project
When you first open a project, IntelliJ IDEA displays a notification suggesting to add the project SDK.
Open the remote session.
From the main menu, select
.In the Project Structure dialog, select Project, and from the available options, configure the project's SDK.
Click OK to save the changes. IntelliJ IDEA downloads the configured SDK to the remote server. The next time you open your project, the downloaded SDK will be used automatically in the remote session.
Add VM options
You can adjust VM options for the remote project, especially if you want to increase the -Xmx
memory size when working with a larger project. You need to perform those actions and save your changes on the remote server.
In the command line, run the following command:
$IDE_BIN_DIR/${IDE_PRODUCT_VM_OPTIONS}.vmoptionsCheck the following example:
./.cache/JetBrains/RemoteDev/dist/a17ad99f7faf8_ideaIU-2021.3.1/bin/idea64.vmoptionsEdit the
idea64.vmoptions
file.For example, change the
-Xmx2048
option to-Xmx3072
.For more detailed information on VM options, refer to Advanced configuration.
Save the changes and restart your IDE on the remote server. Your changes will appear in your remote project.
Access the backend IDE UI
If you encounter a problem working in JetBrains Client, you can open a main tool window of the backend IDE and try to fix your problem there.
On the main toolbar, click next to IDE Backend.
Select Open main tool window.
The main window of the backend IDE gets projected. Now you can use it to access remote settings and configure various remote options if you couldn't do that in JetBrains Client.
Close the Remote Development session
Click to close the remote session window.
You are returned to the JetBrains Gateway welcome screen where you can use the Recent SSH projects page to reconnect to your remote session or stop the running instance.
Create multiple connections
You can create multiple connections to the same remote host and the same version of the IDE. You can also have connections with different IDE versions and remote hosts.
Connect and open a remote session.
Since JetBrains Gateway is constantly active once you have connected to the remote server, you can click its icon to open the JetBrains Gateway welcome screen and configure other connections.
If you connect to the same IDE version, then JetBrains Client will be opened as an instance of the same process. If you connect to a different remote host or IDE version, a different remote session will be launched.