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.
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.
theia.your-domainpointing to your server’s public IP address. You can follow this introduction to DigitalOcean DNS for details on how to add them.
Create the directory to store all data for Eclipse Theia:
- mkdir ~/eclipse-theia
Navigate to it:
- cd ~/eclipse-theia
nginx-proxy-compose.yaml to store the Docker Compose configuration for
- nano nginx-proxy-compose.yaml
Add the following lines:
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.
Save and close the file.
Deploy the configuration:
- docker-compose -f nginx-proxy-compose.yaml up -d
The final output will look like this:
OutputCreating 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
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.
- sudo apt install apache2-utils
apache2-utils package contains the
- sudo mkdir -p /etc/nginx/htpasswd
Create a file to store the logins for your domain:
- sudo touch /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
htpasswd will add the username and hashed password pair to the end of the file.
Create the configuration for Eclipse Theia’s deployment:
- nano eclipse-theia-compose.yaml
Add the following lines:
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
restart set to
theiaide/theia:next as the container image. You also set
true. Then, you specify two environment variables in the
Save and close the file.
Now deploy Eclipse Theia by running:
- 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.
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.
Thanks for learning with the DigitalOcean Community. Check out our offerings for compute, storage, networking, and managed databases.
Click here to Sign up and get $200 of credit to try our products over 60 days!