#xterm

bin+lib web-terminal

A rust app for launching a web terminal that uses websocket

1 unstable release

0.1.0 Jun 1, 2024

#343 in WebSocket

Apache-2.0

33KB
257 lines

WEB TERMINAL

A rust app for launching a web terminal that uses websocket.

Run using cargo

cargo run -- --host 0.0.0.0 --port 3032

Build

cargo build --release

Deploy

Help Command:

cargo run -- --help

Parameters when running the web terminal app.

Usage: web-terminal [OPTIONS]

Options:
      --host <HOST>
          The ip of the server.
          
          [default: 127.0.0.1]

      --port <PORT>
          The port of the server.
          
          [default: 3030]

      --heartbeat-interval <HEARTBEAT_INTERVAL>
          The heartbeat interval.
          
          [default: 30]

  -h, --help
          Print help (see a summary with '-h')

  -V, --version
          Print version

Run using cargo

cargo run -- --host 0.0.0.0 --port 3032

Run using the compiled binary file.

Execute binary

./target/release/web-terminal --host 0.0.0.0 --port 3032

Testing

You can simulate the web terminal using the provided frontend app.

  1. Execute docker-compose for the frontend.
docker-compose -f docker-compose up -d
  1. Look for the container of the frontend.
docker ps 

Example:
CONTAINER ID   IMAGE         COMMAND                  CREATED        STATUS        PORTS                  NAMES
85a2f260ffda   node:latest   "docker-entrypoint.s…"   20 hours ago   Up 20 hours   0.0.0.0:7060->80/tcp   web-terminal-termi-1
  1. Grab the container id
docker exec -it e6b8bedb2193 "bash"
  1. Run the development server.
yarn dev
  1. Open browser then go to
http://localhost:7060

Developer

JP Mateo (jpmateo022@gmail.com)

Dependencies

~14–25MB
~369K SLoC