debian-mirror-gitlab/doc/user/project/remote_development/index.md
2023-01-12 18:35:48 +00:00

4.9 KiB

stage group info
Create Editor To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/product/ux/technical-writing/#assignments

Remote Development (FREE)

Introduced in GitLab 15.6 with a flag named vscode_web_ide. Disabled by default.

FLAG: On self-managed GitLab, by default this feature is not available. To make it available, ask an administrator to enable the feature flag named vscode_web_ide. On GitLab.com, this feature is available. The feature is not ready for production use.

WARNING: This feature is in Alpha and subject to change without notice.

DISCLAIMER: This page contains information related to upcoming products, features, and functionality. It is important to note that the information presented is for informational purposes only. Please do not rely on this information for purchasing or planning purposes. As with all projects, the items mentioned on this page are subject to change or delay. The development, release, and timing of any products, features, or functionality remain at the sole discretion of GitLab Inc.

You can use the Web IDE to commit changes to a project directly from your web browser without installing any dependencies or cloning any repositories. The Web IDE, however, lacks a native runtime environment on which you would compile code, run tests, or generate real-time feedback in the IDE. For a more complete IDE experience, you can pair the Web IDE with a Remote Development environment that has been properly configured to run as a host.

Connect a remote machine to the Web IDE

Prerequisites:

  • A remote virtual machine with root access
  • A domain address resolving to that machine
  • Docker installation

To connect a remote machine to the Web IDE, you must:

  1. Generate Let's Encrypt certificates.
  2. Connect a development environment to the Web IDE.

Generate Let's Encrypt certificates

To generate Let's Encrypt certificates:

  1. Point a domain to your remote machine.
  2. Install Certbot.
  3. Generate the certificates.

Point a domain to your remote machine

To point a domain to your remote machine, create an A record from example.remote.gitlab.dev to 1.2.3.4.

Install Certbot

Certbot is a free and open-source software tool that automatically uses Let's Encrypt certificates on manually administered websites to enable HTTPS.

To install Certbot, run the following command:

sudo apt-get update
sudo apt-get install certbot

Generate the certificates

export EMAIL="YOUR_EMAIL@example.com"
export DOMAIN="example.remote.gitlab.dev"

certbot -d "${DOMAIN}" \
  -m "${EMAIL}" \
  --config-dir ~/.certbot/config \
  --logs-dir ~/.certbot/logs \
  --work-dir ~/.certbot/work \
  --manual \
  --preferred-challenges dns certonly

Connect a development environment to the Web IDE

To connect a development environment to the Web IDE:

  1. Create a development environment.
  2. Fetch a token.
  3. Connect to the Web IDE.

Manage a development environment

Create a development environment

export CERTS_DIR="/home/ubuntu/.certbot/config/live/${DOMAIN}"
export PROJECTS_DIR="/home/ubuntu"

docker run -d \
  --name my-environment \
  -p 3443:3443 \
  -v "${CERTS_DIR}/fullchain.pem:/gitlab-rd-web-ide/certs/fullchain.pem" \
  -v "${CERTS_DIR}/privkey.pem:/gitlab-rd-web-ide/certs/privkey.pem" \
  -v "${PROJECTS_DIR}:/projects" \
  registry.gitlab.com/gitlab-com/create-stage/editor-poc/remote-development/gitlab-rd-web-ide-docker:0.1-alpha \
  --log-level warn --domain "${DOMAIN}" --ignore-version-mismatch

The new development environment starts automatically.

Stop a development environment

docker container stop my-environment

Start a development environment

docker container start my-environment

The token changes every time you restart the development environment.

Remove a development environment

To remove a development environment:

  1. Stop the development environment.

  2. Run the following command:

    docker container rm my-environment
    

Fetch a token

docker exec my-environment cat TOKEN

Connect to the Web IDE

To connect to the Web IDE:

  1. Run the following command:

    echo "https://gitlab-org.gitlab.io/gitlab-web-ide?remoteHost=${DOMAIN}:3443&hostPath=/projects"
    
  2. Go to that URL and enter the token you fetched.