/http-shell

Executes shell commands on remote systems over HTTP.

Primary LanguageJavaScript

Execute shell commands asynchronously on a remote system using HTTP.

  • All stdout and stderr piped back as http responses.
  • Command stay alive if you disconnect. You can can reconnect periodically to get latest console output and job status
  • Chain several hosts together with one acting as coordinator, the coordinator can direct commands to hosts that are available to work.

Download

Windows and Linux executable are available from this repo's release page. MacOS is not supported, but feel free to build yourself.

Requirements

http-shell relies on sh as a standard shell on all worker systems. On Linux this will usually be available already, on Windows you'll need to install it, and add it your system path so it's available from the command line. By far the easiest way to get sh on Windows is to install Git for windows, and ensure that <git-install-path>/bin and <git-install-path>/usr/bin are added to your system PATH environment variable.

Use

Direct

Start a worker with

http-shell --mode worker

Do something on that worker from another device

http-shell --mode client --worker <worker-ip> --command "ls ."

Coordinator

Use a mesh of workers to do things by routing your commands via a central coordinator. In this setup, the client doesn't need to know which worker will service a command.

Start a coordinator

http-shell --mode coordinator 

Start a worker

http-shell --mode worker --cordinator <coordinator-ip>

Do something on a worker

http-shell --mode client --coordinator <coordinator-ip> --command "ls ."

Tagging

Workers can be tagged with a comma-separated list of strings to limit where commands will be serviced.

http-shell --mode worker --cordinator <coordinator-ip> --tags "win,testing"

Do something on a specific worker

http-shell --mode client --coordinator <coordinator-ip> --tags win --command "ls ." 

Build

Directly

cd src
sudo npm install -g pkg@4.5.1 -g
npm install

then

pkg . --targets node12-linux --output ./http-shell

or

pkg . --targets node12-linux-x64 --output ./http-shell

CI server build

Setup requirements

cd src
npm install
cd build
npm install

Build for Windows

bash ./build.sh --target win64

Build for Linux

bash ./build.sh --target linux64