eclipse theia_如何在Ubuntu 18.04上设置Eclipse Theia Cloud IDE平台[快速入门]

eclipse theia

介绍 (Introduction)

Eclipse Theia is an extensible cloud IDE running on a remote server and accessible from a web browser. Visually, it’s designed to look and behave similarly to Microsoft Visual Studio Code. What separates Eclipse Theia from other cloud IDE software is its extensibility; it can be modified using custom extensions, which allow you to craft a cloud IDE suited to your needs.

Eclipse Theia是运行在远程服务器上的可扩展云IDE,可从Web浏览器访问。 在视觉上,它的外观和行为与Microsoft Visual Studio Code相似。 Eclipse Theia与其他Cloud IDE软件的不同之处在于其可扩展性。 可以使用自定义扩展对其进行修改,这使您可以制作适合自己需求的云IDE。

In this tutorial, you’ll deploy Eclipse Theia to your Ubuntu 18.04 server using Docker Compose. You’ll expose it at your domain using nginx-proxy and secure it with a Let’s Encrypt TLS certificate, which you’ll provision with an add-on. For a more detailed version of this tutorial, please refer to How To Set Up the Eclipse Theia Cloud IDE Platform on Ubuntu 18.04.

在本教程中,您将使用Docker Compose将Eclipse Theia部署到Ubuntu 18.04服务器。 您将使用nginx-proxy在您的域中将其公开,并使用Let's Encrypt TLS证书对其进行保护 ,该证书将提供附加组件 。 有关本教程的更多详细版本,请参阅如何在Ubuntu 18.04上设置Eclipse Theia Cloud IDE平台 。

先决条件 (Prerequisites)

  • An Ubuntu 18.04 server with root privileges, and a secondary, non-root account, following the Initial Server Setup Guide for Ubuntu 18.04.

    遵循《 Ubuntu 18.04初始服务器设置指南》的具有root用户特权的Ubuntu 18.04服务器和一个非root用户帐户。

  • Docker installed on your server, follow Step 1 and Step 2 of How To Install Docker on Ubuntu 18.04.

    在您的服务器上安装了Docker,请遵循如何在Ubuntu 18.04上安装Docker的 步骤1步骤2

  • Docker Compose installed on your server, follow Step 1 of How To Install Docker Compose on Ubuntu 18.04.

    在服务器上安装Docker Compose ,请遵循如何在Ubuntu 18.04上安装Docker Compose的 步骤1

  • A fully registered domain name. This tutorial will use theia.your-domain throughout.

    完全注册的域名。 本教程将整个使用theia.your-domain

  • An A DNS record with theia.your-domain pointing to your server’s public IP address. You can follow this introduction to DigitalOcean DNS for details on how to add them.

    一个带有theia.your-domain DNS记录,指向您服务器的公共IP地址。 您可以按照DigitalOcean DNS简介进行操作,以获取有关如何添加它们的详细信息。

第1步-使用“让我们加密”部署nginx-proxy (Step 1 — Deploying nginx-proxy with Let’s Encrypt)

Create the directory to store all data for Eclipse Theia:

创建目录以存储Eclipse Theia的所有数据:

  • mkdir ~/eclipse-theia

    mkdir〜/ eclipse-theia

Navigate to it:

导航到它:

  • cd ~/eclipse-theia

    光盘〜/ eclipse-theia

Create nginx-proxy-compose.yaml to store the Docker Compose configuration for nginx-proxy:

创建nginx-proxy-compose.yaml来存储泊坞撰写配置nginx-proxy

  • nano nginx-proxy-compose.yaml

    纳米nginx-proxy-compose.yaml

Add the following lines:

添加以下行:

~/eclipse-theia/nginx-proxy-compose.yaml
〜/ eclipse-theia / nginx-proxy-compose.yaml
version: '2'

services:
  nginx-proxy:
    restart: always
    image: jwilder/nginx-proxy
    ports:
      - "80:80"
      - "443:443"
    volumes:
      - "/etc/nginx/htpasswd:/etc/nginx/htpasswd"
      - "/etc/nginx/vhost.d"
      - "/usr/share/nginx/html"
      - "/var/run/docker.sock:/tmp/docker.sock:ro"
      - "/etc/nginx/certs"

  letsencrypt-nginx-proxy-companion:
    restart: always
    image: jrcs/letsencrypt-nginx-proxy-companion
    volumes:
      - "/var/run/docker.sock:/var/run/docker.sock:ro"
    volumes_from:
      - "nginx-proxy"

Here you’re defining two services that Docker Compose will run, nginx-proxy and its Let’s Encrypt companion. For the proxy, you specify jwilder/nginx-proxy as the image, map HTTP and HTTPS ports, and define volumes that will be accessible to it during runtime.

在这里,您定义了将要运行的Docker Compose两项服务,即nginx-proxy及其“让我们加密”伴侣。 对于代理,您将jwilder/nginx-proxy指定为映像,映射HTTP和HTTPS端口,并定义在运行时可访问的卷。

Save and close the file.

保存并关闭文件。

Deploy the configuration:

部署配置:

  • docker-compose -f nginx-proxy-compose.yaml up -d

    docker-compose -f nginx-proxy-compose.yaml up -d

The final output will look like this:

最终输出将如下所示:


   
     
     
     
     
Output
Creating network "eclipse-theia_default" with the default driver Pulling nginx-proxy (jwilder/nginx-proxy:)... latest: Pulling from jwilder/nginx-proxy 8d691f585fa8: Pull complete 5b07f4e08ad0: Pull complete ... Digest: sha256:dfc0666b9747a6fc851f5fb9b03e65e957b34c95d9635b4b5d1d6b01104bde28 Status: Downloaded newer image for jwilder/nginx-proxy:latest Pulling letsencrypt-nginx-proxy-companion (jrcs/letsencrypt-nginx-proxy-companion:)... latest: Pulling from jrcs/letsencrypt-nginx-proxy-companion 89d9c30c1d48: Pull complete 668840c175f8: Pull complete ... Digest: sha256:a8d369d84079a923fdec8ce2f85827917a15022b0dae9be73e6a0db03be95b5a Status: Downloaded newer image for jrcs/letsencrypt-nginx-proxy-companion:latest Creating eclipse-theia_nginx-proxy_1 ... done Creating eclipse-theia_letsencrypt-nginx-proxy-companion_1 ... done

第2步-部署Dockerized Eclipse Theia (Step 2 — Deploying Dockerized Eclipse Theia)

nginx-proxy expects log-in combinations to be in a file named after the exposed domain, in the htpasswd format and stored under the /etc/nginx/htpasswd directory in the container.

nginx-proxy希望登录组合以htpasswd格式保存在以公开域命名的文件中,并存储在容器中的/etc/nginx/htpasswd目录下。

Install htpasswd:

安装htpasswd

  • sudo apt install apache2-utils

    sudo apt安装apache2-utils

The apache2-utils package contains the htpasswd utility.

apache2-utils软件包包含htpasswd实用程序。

Create the /etc/nginx/htpasswd directory:

创建/etc/nginx/htpasswd目录:

  • sudo mkdir -p /etc/nginx/htpasswd

    须藤mkdir -p / etc / nginx / htpasswd

Create a file to store the logins for your domain:

创建一个文件来存储您域的登录名:

  • sudo touch /etc/nginx/htpasswd/theia.your-domain

    须藤触摸/ etc / nginx / htpasswd / theia.your-domain

Run the following command with a username and password combination:

使用用户名和密码组合运行以下命令:

  • sudo htpasswd /etc/nginx/htpasswd/theia.your-domain username

    sudo htpasswd / etc / nginx / htpasswd / theia。您的域 用户名

htpasswd will add the username and hashed password pair to the end of the file.

htpasswd会将用户名和哈希密码对添加到文件末尾。

Create the configuration for Eclipse Theia’s deployment:

为Eclipse Theia的部署创建配置:

  • nano eclipse-theia-compose.yaml

    纳米蚀-theia-compose.yaml

Add the following lines:

添加以下行:

~/eclipse-theia/eclipse-theia-compose.yaml
〜/ eclipse-theia / eclipse-theia-compose.yaml
version: '2.2'

services:
  eclipse-theia:
    restart: always
    image: theiaide/theia:next
    init: true
    environment:
      - VIRTUAL_HOST=theia.your-domain
      - LETSENCRYPT_HOST=theia.your-domain

You define a single service called eclipse-theia with restart set to always and theiaide/theia:next as the container image. You also set init to true. Then, you specify two environment variables in the environment section: VIRTUAL_HOST and LETSENCRYPT_HOST.

您定义了一个名为eclipse-theia服务,将restart设置为always并将theiaide/theia:next作为容器映像。 您还将init设置为true 。 然后,在environment部分中指定两个环境变量: VIRTUAL_HOSTLETSENCRYPT_HOST

Save and close the file.

保存并关闭文件。

Now deploy Eclipse Theia by running:

现在,通过运行以下命令部署Eclipse Theia:

  • docker-compose -f eclipse-theia-compose.yaml up -d

    docker-compose -f eclipse-theia-compose.yaml up -d

The final output will look like:

最终输出将如下所示:


   
     
     
     
     
Output
... Pulling eclipse-theia (theiaide/theia:next)... next: Pulling from theiaide/theia 63bc94deeb28: Pull complete 100db3e2539d: Pull complete ... Digest: sha256:c36dff04e250f1ac52d13f6d6e15ab3e9b8cad9ad68aba0208312e0788ecb109 Status: Downloaded newer image for theiaide/theia:next Creating eclipse-theia_eclipse-theia_1 ... done

Navigate to the domain you’re using for Eclipse Theia. Your browser will show you a prompt asking you to log in. You’ll enter Eclipse Theia and see its editor GUI. You’ll also see a padlock indicating that the connection is secure.

导航到您用于Eclipse Theia的域。 浏览器将显示提示您登录的提示。您将输入Eclipse Theia并查看其编辑器GUI。 您还将看到一个挂锁,指示该连接是安全的。

结论 (Conclusion)

You now have Eclipse Theia, a versatile cloud IDE, installed on your Ubuntu 18.04 server using Docker Compose and nginx-proxy. You’ve secured it with a free Let’s Encrypt TLS certificate and set up the instance to require log-in credentials from the user. You can work on your source code and documents with it individually or collaborate with your team. You can also try building your own version of Eclipse Theia if you need additional functionality. For further information on how to do that, visit the Theia docs.

现在,您已经使用Docker Compose和nginx-proxy将Eclipse Theia(通用的云IDE)安装在Ubuntu 18.04服务器上。 您已使用免费的Let's Encrypt TLS证书保护了它的安全,并将实例设置为需要用户的登录凭据。 您可以单独使用源代码和文档,也可以与团队合作。 如果需要其他功能,也可以尝试构建自己的Eclipse Theia版本。 有关如何执行此操作的更多信息,请访问Theia docs 。

翻译自: https://www.digitalocean.com/community/tutorials/how-to-set-up-the-eclipse-theia-cloud-ide-platform-on-ubuntu-18-04-quickstart

eclipse theia

你可能感兴趣的:(docker,java,linux,mysql,nginx)