rusty_runner_api/lib.rs
1//! This crate serves purely as an rest api abstraction for a remote script execution server.
2//! Additionally there is a canonical server implementation in the same repository.
3//!
4//! This can be used as a ssh replacement, without having to deal with
5//! command line escaping or default shells.
6//!
7//! ## Usage
8//! For the complete usage, see the serde structs in [`api`].
9//! * `GET /api/info` returns an informative [`api::InfoResponse`] object.
10//! * `POST /api/run` runs a command analogous to [`std::process::Command`].
11//! * `POST /api/runscript` runs the body with a given interpreter.
12//! * `GET /api/file/{path}` fetches a file from the servers working directory.
13//!
14//! ## Working with files
15//! The working directory of the executed commands is implementation defined,
16//! but the same for all methods and constant over the lifetime of the server.
17//! The path for file fetching is also a relative path in this directory.
18//!
19//! Best use a randomly named subdirectory in the current folder for your file operations.
20//! E.g. `./task-9ae4ef2b9d13/your-file`
21//!
22//! ## Long running jobs
23//! Using `reqwest` and `axum` does not impose an significant timeout on the http calls.
24//! Therefore currently the calls will just wait until the command terminates and return then.
25//! *Make sure your commands always terminate* in order to not lock up valuable resources.
26//!
27//! In a future version of the api, a [`RunStatus::Pending`](api::RunStatus) variant
28//! and a status poll endpoint might be added.
29//!
30//! ## Security
31//! The api does not include any security measures, this is *remote execution as a service!*.
32//! Make sure it is only reachable from trusted hosts. E.g. by means of ssh port forwarding.
33
34pub mod api;