Skip to content

Using Wetty to expose an interactive browser-based terminal for the K language

Notifications You must be signed in to change notification settings

ColmBhandal/kwetty

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Kwetty

This is a POC using Wetty to expose an interactive browser-based terminal for the K language. The POC was inspired by the K Online Scratchpad Issue on the K website. This is similar to how Docker Playground exposes a terminal session, allowing people to play with Docker without installing anything.

This is a POC Only

Right now, there is no intention to continue development on this project. It is just one example of how one could expose K over a web browser, exposing a terminal session in the browser. Long-term, it is hoped that a more thorough solution emerges from the K Online Scratchpad Issue e.g. something akin to Jupyter Notebooks for K.

Running Kwetty

These steps explain how to run Kwetty on a machine with Docker installed and the Docker daemon running:

  • Check out this repository
  • From the root directory of this repo, run: docker compose up

Use

These steps explain how to access Kwetty through a web-browswer:

  • Open a web browser
  • Visit http://URL:3000/wetty where URL is the URL of the machine on which you ran the docker compose up command. If on the same machine as your browser, then just visit http://localhost:3000/wetty
  • Login with credentials kdoctor:k
  • Start running K commands from your browser!

Explanation

Kwetty runs two services: K and Wetty.

K Service

The K service is a slightly modified version of this K image. The modifications made are to add a user called kdoctor with a password of k and then launch an ssh server on startup. Some tinkering with ssh settings was also necessary here to allow for credential-based login.

The Wetty Service

This is just OOTB Wetty. The only thing we configure is that it connects to the K service over ssh and then we expose its port 3000 so that web-browsers can visit the Wetty UI.

Are Two Services Really Necessary?

It is certainly possible that instead of having K and Wetty running as separate servicese, there could be just a single service that runs Kwetty. It's likely that this would be less resource intensive. Here are two ways one could merge K and Wetty into a single image:

  • Start with the K image, install Wetty on top of that via a Dockerfile to get a single Kwetty image.
  • Start with Wetty and install K on top of that via a Dockerfile to get a single Kwetty image.

Note: such approaches would need to take into account the fact that K is Ubuntu-based while Wetty is Alpine-based.

About

Using Wetty to expose an interactive browser-based terminal for the K language

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published