#command-line #script #execution #server #remote #file-server #purely

rusty-runner-api

This crate serves purely as an REST api abstraction for a remote script execution server

3 stable releases

2.0.0 Nov 8, 2024
1.0.1 Jul 19, 2023
1.0.0 Mar 31, 2023

#235 in HTTP server

Download history 3/week @ 2024-07-29 151/week @ 2024-08-12 8/week @ 2024-08-19 19/week @ 2024-08-26 22/week @ 2024-09-02 2/week @ 2024-09-09 3/week @ 2024-09-16 50/week @ 2024-09-23 55/week @ 2024-09-30 5/week @ 2024-10-07 7/week @ 2024-10-14 25/week @ 2024-10-28 106/week @ 2024-11-04 44/week @ 2024-11-11

175 downloads per month

MIT/Apache

12KB
67 lines

rusty-runner-api

This crate serves purely as an rest api abstraction for a remote script execution server. Additionally there is a canonical server implementation in the same repository.

This can be used as a ssh replacement, without having to deal with command line escaping or default shells.

Usage

For the complete usage, see the serde structs in [api].

  • GET /api/info returns an informative api::InfoResponse object.
  • POST /api/run runs a command analogous to std::process::Command.
  • POST /api/runscript runs the body with a given interpreter.
  • GET /api/file/{path} fetches a file from the servers working directory.

Working with files

The working directory of the executed commands is implementation defined, but the same for all methods and constant over the lifetime of the server. The path for file fetching is also a relative path in this directory.

Best use a randomly named subdirectory in the current folder for your file operations. E.g. ./task-9ae4ef2b9d13/your-file

Long running jobs

Using reqwest and axum does not impose an significant timeout on the http calls. Therefore currently the calls will just wait until the command terminates and return then. Make sure your commands always terminate in order to not lock up valuable resources.

In a future version of the api, a RunStatus::Pending variant and a status poll endpoint might be added.

Security

The api does not include any security measures, this is remote execution as a service!. Make sure it is only reachable from trusted hosts. E.g. by means of ssh port forwarding.

License: MIT OR Apache-2.0

Dependencies

~0.3–1MB
~21K SLoC