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.
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
.
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
These steps explain how to access Kwetty through a web-browswer:
- Open a web browser
- Visit
http://URL:3000/wetty
whereURL
is the URL of the machine on which you ran thedocker compose up
command. If on the same machine as your browser, then just visithttp://localhost:3000/wetty
- Login with credentials
kdoctor:k
- Start running
K
commands from your browser!
Kwetty runs two services: K
and Wetty
.
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.
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.
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, installWetty
on top of that via aDockerfile
to get a singleKwetty
image. - Start with
Wetty
and installK
on top of that via aDockerfile
to get a singleKwetty
image.
Note: such approaches would need to take into account the fact that K
is Ubuntu-based while Wetty
is Alpine-based.