JetBrains Space Help

Develop in a Dev Environment

Prerequisites

Before you start developing in a dev environment, do the following:

  1. Install JetBrains Toolbox App to your local machine. If you're going to use an IntelliJ-based IDE, install JetBrains Gateway with the help of the Toolbox App.

  2. (Optional) Configure a dev environment for your project. If you skip this step, the project will be opened in the default dev environment.

  3. Make sure you have at least the Project member role in the project that you want to open in a dev environment. By default, the Project member role provides the Create dev environments permission. If you don't have this permission, the Open in IDE button will not be available to you.

Open a project in a dev environment

  1. Open the required project.

  2. Do one of the following:

    • Open then the required project repository, then click Open in IDE.

    • On the project sidebar, select Dev Environments, then click New environment.

  3. In the New Dev Environment window, specify the environment settings:

    • From the list of project branches, select the branch you want to work with.

    • In Devfile, select the devfile with the required dev environment configuration. All other dev environment settings will be taken from this devfile. If necessary, you can override values from the devfile, for example, select another instance type or IDE.

    • If the devfile requires users to provide values for particular Environment variables (e.g., a dev environment needs credentials to an external service), assign personal secrets and parameters to the corresponding environment variables.

    • From the Warm-up snapshot list, select a warm-up snapshot with prebuilt project data. Learn more about warm-up snapshots.

    New dev environment
  4. Click Create.

  5. After this, Space will open the project in the selected IDE.

Perform code review in a dev environment

If you're assigned to perform a code review, you can do this in a dev environment.

  1. Open the required project.

  2. On the project sidebar, select Code Reviews, then select the required review.

  3. In the top right corner, click Open in IDE.

    Open code review in a dev environment
  4. In the New Dev Environment window, specify the environment settings:

    • From the list of project branches, select the branch you want to work with.

    • In Devfile, select the devfile with the required dev environment configuration. All other dev environment settings will be taken from this devfile. If necessary, you can override values from the devfile, for example, select another instance type or IDE.

    • If the devfile requires users to provide values for particular Environment variables (e.g., a dev environment needs credentials to an external service), assign personal secrets and parameters to the corresponding environment variables.

    • From the Warm-up snapshot list, select a warm-up snapshot with prebuilt project data. Learn more about warm-up snapshots.

  5. Click Create.

  6. After this, Space will open the project in the selected IDE.

Share a dev environment with other team members

Dev environments let you collaboratively review, edit, and debug code with your colleagues in real time. To start collaborative work, you must share your dev environment. Note that you can share the environment only with those team members who have the Git Repositories: Write permission in your project. By default, these are members with the Project Admin, Project Member, and Project Collaborator roles.

To share a dev environment with a team member

  1. Open the project.

  2. In the sidebar, select Dev Environments.

  3. Find the dev environment you want to share and in the dev environment menu Menu, click Share.

  4. In the Sharing Options window, click Shared. Space will generate a sharing link.

  5. Copy the link and share it with a team member.

Develop GUI applications in a dev environment

With dev environments you can develop not only web applications but also applications with native user interface. This is possible with the help of VNC or RDP technologies. The idea is to install a VNC server to a dev environment, forward the server port to your localhost, and use a local VNC client to work with the dev environment's remote desktop.

To start developing a GUI application in a dev environment

  1. On your local machine, install a VNC client. For example, VNC Viewer from RealVNC.

  2. Open your project in a dev environment.

  3. Install and run a VNC server in a dev environment. For example, X11VNC server:

    1. In the IDE, open Terminal and run

      apt update && apt install x11vnc xvfb
    2. Run the server:

      x11vnc --create

      The VNC server will run on port 5900.

  4. Configure port forwarding for the port 5900.

  5. On your local machine, run the VNC client and connect to localhost:{forwarded_port}. This will run the VNC terminal window.

  6. Use the VNC terminal window to build and run the UI application you develop in the dev environment.

Use Docker in a dev environment

During development, quite often you need to run a service (say, a database server) in a Docker container.

To run Docker commands in a dev environment

  1. If you use a custom dev environment container image, make sure it includes Docker. The default image already includes Docker and Docker Compose.

  2. In your IDE, open Terminal and run docker commands as if you do it on your local machine.

The Docker daemon runs in the same container that runs your dev environment. This means that a Docker container you run inside the dev environment has access to the dev environment disk.

Port forwarding in a dev environment

To give you access to TCP ports of a dev environment, Space uses port forwarding. This lets you access web applications you develop in a dev environment from the browser running on your local machine.

To make port forwarding work, your dev environment container must have the lsof tool installed.

To forward a port

  1. Press Ctrl+Shift+K (Cmd+Shift+K on macOS) and start typing forward port. Select the Forward Port action.

  2. Specify the port that you want to forward. The destination port for your localhost will be shown in the Network Dashboard window.

To forward a port

  1. In the IDE, open Settings | Tools | Port Forwarding.

  2. Add the port that you want to forward.

Last modified: 01 July 2022