tencent cloud

Feedback

Building a Platform with Theia IDE Template

Last updated: 2023-02-16 15:40:30

    Overview

    Theia IDE is an open-source extensible framework for building web-based cloud IDEs, with proper multi-language support and VS Code extensions. Tencent Cloud Lighthouse provides the Theia IDE image with Go, Python, Node.js, Clang, and OpenJDK development environments installed, allowing you to easily and quickly develop projects and businesses across platforms.

    Directions

    1. Log in to the Lighthouse console.
    2. Click Create to enter the Lighthouse purchase page.
    
    
    
    Region: Select a region near your target users to reduce the network latency and improve their access speed.
    Image: Select the Theia IDE application image.
    Availability zone: Randomly assigned is selected by default. You can select one as well.
    Instance bundle: Select an instance bundle according to the required instance configuration (including CPU, memory, system disk, bandwidth, and monthly traffic).
    Instance name: Enter a custom instance name. If it is left empty, an "image name + 4-digit random string" will be used as the name by default. When instances are created in batches, their names will be consecutive with auto-incrementing suffixes. For example, if you enter "LH" as the name and purchase three instances, the three instances are named "LH1", "LH2", and "LH3".
    Purchase period: Default to 1 month.
    Quantity: Default to 1.
    3. Click Buy now to submit your order and make the payment as prompted. Then, return to the Lighthouse console.
    4. After the instance is created, select the instance from the list to enter its details page. You can view the configuration items of the Theia IDE application.
    5. Select the Pre-installed application tab to enter the application details page.
    6. 
    In the Pre-installed software section
    , click
    
    to copy the command for getting the admin password of Theia.
    7. In the Pre-installed software section, click Log in.
    
    
    
    8. 
    In the pop-up login window
    , paste the command copied in step 6 and press Enter. Then, you can get the Theia IDE admin account (admin) and password. Store and record them properly.
    9. Close the login window and go back to the application details page of the instance.
    10. In the Pre-installed software section, click the Access address of Theia 1.37.2.
    Note:
    We recommend you use Chrome or Firefox for this operation, as other browsers (such as Safari) may have compatibility issues.
    11. In the pop-up window, enter the admin account and password obtained in step 8 and click OK. After successful verification, you can enter the Theia IDE GUI.

    Subsequent Operations

    Selecting the workspace

    1. Select Open Workspace on the Theia IDE Getting Started page.
    2. In the Open Workspace pop-up window, select / from the drop-down list to open the directory. In Theia IDE, a directory is a workspace. /data is used as an example in this document.
    
    
    3. Click Open to enter the /data workspace.

    Examples

    Note:
    Theia IDE supports Python, Java, Go, C/C++, and Node.js languages. Sample programs in Python, Go, and C++ are run on the command line and in the GUI here.

    Python

    1. In the workspace, select File > New Folder at the top of the window.
    2. In the pop-up window, create a folder named Python and a simple sample file main.py under it.
    
    
    3. You can run the program in either of the following ways:
    Command line:
    3.1.1 Select Terminal > New Terminal at the top of the window to open a terminal.
    3.1.2 Run the following commands in sequence in the terminal to run the program.
    cd Python
    python3.8 main.py
    The execution result is as shown below:
    
    
    
    GUI:
    Click
    
    in the top-right corner of the window to run the program. The execution result is as shown below:
    
    
    

    Go

    1. In the workspace, select File > New Folder at the top of the window.
    2. In the pop-up window, create a folder named go and a simple sample file main.go under it.
    
    
    3. You can run the program in either of the following ways:
    Command line:
    3.1.1 Select Terminal > New Terminal at the top of the window to open a terminal.
    3.1.2 Run the following commands in sequence in the terminal to run the program.
    cd go
    go run main.go
    The execution result is as shown below:
    
    
    
    GUI:
    3.2.1 Click
    
    on the left to open the DEBUG section.
    3.2.2 In DEBUG, select Add Configuration from the drop-down list to generate the configuration file.
    
    
    3.2.3 Open the main.go file and select
    
    in the **DEBUG** section to run the program. The execution result is as shown below:
    
    

    C++

    1. In the workspace, select File > New Folder at the top of the window.
    2. In the pop-up window, create a folder named c++ and a simple sample file main.cpp under it.
    
    
    3. You can run the program in either of the following ways:
    Command line:
    3.1.1 Select Terminal > New Terminal at the top of the window to open a terminal.
    3.1.2 Run the following commands in sequence in the terminal to run the program.
    cd c++
    clang++ main.c
    ./a.out
    The execution result is as shown below:
    
    
    
    GUI:
    3.2.1 Click
    
    on the left to open the DEBUG section.
    3.2.2 In DEBUG, select Add Configuration from the drop-down list to generate the configuration file as.
    
    3.2.3 In the drop-down list of the configuration file, select { } GDB CDT Local debugging.
    3.2.4 Replace /${command:askProgramPath} in the configuration file with /c++/a.out and save the change.
    3.2.5 Select
    
    in the *DEBUG** section to open the Debug console.
    3.2.6 Select
    
    in the **DEBUG** section to run the program. The execution result is as shown below:
    

    Enabling HTTPS access

    You can install an SSL certificate and enable HTTPS access for your Theia IDE instance as instructed in Installing Certificate on NGINX Server.
    Note:
    You only need to modify the /usr/local/lighthouse/softwares/nginx/conf/include/theia.conf configuration file but not /usr/local/lighthouse/softwares/nginx/conf/nginx.conf for your Theia IDE instance.
    See the following configuration to modify the file:
    server {
    listen 443 ssl;
    server_tokens off;
    keepalive_timeout 5;
    root /usr/local/lighthouse/softwares/nginx/html;
    index index.php index.html;
    access_log logs/theia.log combinediox;
    error_log logs/theia.error.log;
    server_name cloud.tencent.com; # Enter the domain name bound to your certificate, such as `cloud.tencent.com`
    ssl_certificate 1_cloud.tencent.com_bundle.crt; # Enter the name of your certificate file, such as `1_cloud.tencent.com_bundle.crt`
    ssl_certificate_key 2_cloud.tencent.com.key; # Enter the name of your private key file, such as `2_cloud.tencent.com.key`
    ssl_session_timeout 5m;
    ssl_protocols TLSv1 TLSv1.1 TLSv1.2; # You can see this SSL protocol for configuration
    ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:HIGH:!aNULL:!MD5:!RC4:!DHE; # You can use this encryption suite configuration written in line with the OpenSSL standard
    ssl_prefer_server_ciphers on;
    
    auth_digest_user_file /home/lighthouse/passwd.digest;
    auth_digest_shm_size 8m; # the storage space allocated for tracking active sessions
    
    location / {
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "upgrade";
    
    auth_digest 'lighthouse';
    auth_digest_timeout 120s; # allow users to wait 2 minute between receiving the
    # challenge and hitting send in the browser dialog box
    auth_digest_expires 600s; # after a successful challenge/response, let the client
    # continue to use the same nonce for additional requests
    # for 600 seconds before generating a new challenge
    auth_digest_replays 60; # also generate a new challenge if the client uses the
    # same nonce more than 60 times before the expire time limit
    
    proxy_pass http://127.0.0.1:3000;
    }
    }
    
    server {
    listen 80;
    server_name cloud.tencent.com; # Enter the domain name bound to your certificate, such as `cloud.tencent.com`
    return 301 https://$host$request_uri; # Redirect HTTP requests to HTTPS
    }
    
    Contact Us

    Contact our sales team or business advisors to help your business.

    Technical Support

    Open a ticket if you're looking for further assistance. Our Ticket is 7x24 avaliable.

    7x24 Phone Support