Download Latest Version rds-1.15.00-linux-x64.zip (4.9 MB)
Email in envelope

Get an email when there's a new version of RustDevelopmentStudio

Home / version 1.06.03
Name Modified Size InfoDownloads / Week
Parent folder
README.md 2024-12-03 7.8 kB
rds-1.06.03.zip 2024-12-03 4.1 MB
Totals: 2 Items   4.1 MB 0

Rust Development Studio - CGI

Purpose

A possibility to develop a software from any device and anywhere is frequently required. However the requirement to install the specific software for that on all devices can be complicated and not always possible. What about if a modern HTML 5 capable browser is sufficient to run the development environment? Certainly the major reason to write the software was the desire to convert a regular browser to IDE. So far, my goal was achieved and I do not care much about a computer I do development from now. I can develop from my workstation using two 32" monitors and continue the development from Amazon Fire tablet when I am in the kitchen, or watching the latest TV show in the family room.

Architecture

The client part is quite obvious and utilizes HTML 5, CSS and JavaScript. But the server part resurrects the forgotten CGI technology which is perfectly suitable for using Rust. The terminal functionality is implemented using the Websocket and it still relays on Java. So the project is a hybrid of Rust, HTML, CSS, JavaScript and Java.

Implementation

It's really compact with a footprint below 10 MB. All web requests are handled by one Rust CGI executable. The terminal is a websocket endpoint represented by one Java class. There is no a servlet.

Config

All below steps consider that TJWS is used as a web server and CGI provider. Any other server can be used with corresponding modifications of the steps. You need to add to TJWS aliases.properties file lines reflecting the location of the CGI script like below:

from=/rustcgi;dir=~/projects/rust_util/src/rust/rustcgi
from=/cgires/resource;=~/projects/rust_util/src/rust/rustcgi/resource

Note that the resource directory has to be a sub-directory of the CGI script directory.

And then specify aliases.properties in the TJWS starting command as:

-a aliases.properties

The /rustcgi mapping has to be a CGI aware when start TJWS using the command line argument below:

-c /rustcgi

Make sure that a directory, where rustcgi accessed from, contains the file .home with one line containing the user HOME directory or other directory where rustcgi will look for settings in the directory .rustcgi. For example:

/home/john

Another property has to be added the starting starting TJWS command as:

-Dtjws.websocket.container=true

to assure that the websocket support will be enabled and the terminal works properly.

An acceptor with a channel for non blocking IO is requiring for a correct websocket work. For example:

-acceptorImpl Acme.Serve.SelectorAcceptor

Currently the websocket port hardcoded to 8443 at line 78 in main.js as bellow:

 ws_setup(window.location.protocol === 'https:'?'s':'', 8443)

Remove the parameter to use default one equaled to the web server's using.

If you plan to use HOME directory different than provided by OS, you need to specify it in a TJWS starting command as property HOME:

-DHOME=/media/exhdd/RDS

rds.sh script with underline bee.7b is a good example of mentioned command options.

You are free to use any other web server capable to run CGI scripts. The same or other server implementing JSR 356 is required for a terminal support.

Ace Cloud editor

Rust Development Studio is loosely coupled with Ace (Ajax.org Cloud9) Editor.

RDS is coming bundled with some version of the Ace editor. You can always bundle it with any other version of the editor. Go to Ace and download a desired version and then copy it over the directory resource/ace.

What is the session?

RDS is a single user web application. However a user may want to handle several RDS projects in the scope of a single browser. Sessions help to separate projects and the corresponding settings data.

Packaging

Although you can configure the development studio yourself accordingly to a web server and other components, the packaging recommends TJWS as a web server. The following jars are required:

class-scanner.jar
javax.servlet-api-4.0.1.jar
javax.websocket-api-1.1.jar
rds.jar
webserver.jar
wskt.jar

Two underline OS executables' are written in Rust are:

rb
rustcgi

Any JVM from 8 to 23 can be used. HTTPS is supported and preferred.

The standard packaging includes all required RDS components. Just launch ./rds.sh and you can start using the RDS. The access URL stored in rds.url.

Building rustcgi components

You need the rustc and javac for building RDS components. I use the RustBee scripting tool to simplify the build procedure. However, you can use any other building tool (including Cargo) and own build scripts. If you decide to use the RustBee, you may need to build it too, but only once. For example, I wanted to build the RDS on Raspberry Pi. First, I installed rustc (you need the version 1.80 or better, visit the site for an info how to install). Next, I downloaded bee.jar from sourceforge for a bootstrapping. I downloaded a simple zip crate from github and finally I checked out https://gitlab.com/tools6772135/rusthub/-/tree/master. I switched to scr/rust/rustbee and edited bee-rust.xml to specify the simple zip repository location. I executed java -jar <dir where>/bee.jar to build rb. You can install it after a building by executing sudo ./rb install, or simply add the current directory to the PATH env.

You are ready to build rustcgi now. Switch to scr/rust/rustcgi and execute rb. Use rb -Dopt=release, for building a release version. Switch to directory src/java/rustcgi to build rds.jar. Execute rb. Copy src/java/lib/rds.jar to the web server Java lib directory after. You can edit APP DEPLOY DROP in src/java/rustcgi/bee.7b to specify the target directory and avoiding a manual copying. Restart the web server to get a new websocket end point deployed.

The similar steps have to be performed on other platforms as Windows, MacOS, or BSD OS where no an installer provided yet. Assure only that a Windows executable has the extension .exe.

Working tips

You will see an empty page when first time pointed a browser to RDS URL. Select menu Settings.

Navigate to a project directory and then save the settings. Reload the RDS web page. You can start now navigate over the project tree, open and edit files, build its components and so on.

If you do not have the project checked out yet, then you can check it out first, and then to set the project root in the settings. You can execute underline OS commands as mkdir, git checkout, and others in the terminal window.

When you use Cargo to build a Rust project, make sure to set CARGO_TERM_COLOR env variable to always. It is controlled also by term.color of Cargo settings. For example:

[term]
color=always

Browser compatibly

RDS uses HTML 5 features and compatible with browsers supporting them. Compatibility was tested using the latest Firefox and Amazon Silk browsers. More likely, other browsers will work too. If you encounter problems with any browser, then please report them to the author.

Known problems

  1. datalist seems isn't supported by the Silk browser, so the auto suggest won't work on a Fire tablets
  2. Websocket constructor doesn't support the subprotocol parameter on the Silk browser, so preserving the last used directory in the terminal won't work on Amazon tablets

Reading about

  1. Some light on using technologies.
Source: README.md, updated 2024-12-03