Rust Linux Worker

The Service executes arbitrary Linux commands on behalf of clients

The Service executes arbitrary Linux commands on behalf of clients. Processes are isolated to a basic Alpine Linux container using Linux namespaces and resource constraints are provided using cgroups.

The primary purpose of this project was to allow me to experiment with rust by building a project similar to a previous one (see Go Linux Worker).

Currently, the service consists of a library with functions to submit a job, query the status of a job, stop a job and fetch the logs from a job along with client and server implementations.

Building

The standard cargo tool can be use to build, test and check the code. A makefile is also provided to easily build a docker image to run the server:

make docker-build

Running

The server can be run using the built Docker image by running:

make docker-run

The client can be run using:

# Submit a job
$ ./bin/client submit "ls -lah /"
Id of submitted job: 58403eaf-6691-4796-9b9c-cb60d9dc1763

# Get the status of the job
$ ./bin/client status 58403eaf-6691-4796-9b9c-cb60d9dc1763
Status: COMPLETED
Exit code: 0

# Get the output from the job
$ ./bin/client logs 58403eaf-6691-4796-9b9c-cb60d9dc1763
total 0
drwxr-xr-x   19 root     root         380 Apr 26 19:48 .
drwxr-xr-x   19 root     root         380 Apr 26 19:48 ..
drwxr-xr-x    2 root     root        1.6K Apr 26 19:48 bin
drwxr-xr-x    2 root     root          40 Feb 17 15:07 dev
drwxr-xr-x   15 root     root         700 Apr 26 19:48 etc
drwxr-xr-x    2 root     root          40 Feb 17 15:07 home
drwxr-xr-x    7 root     root         280 Apr 26 19:48 lib
drwxr-xr-x    5 root     root         100 Apr 26 19:48 media
drwxr-xr-x    2 root     root          40 Feb 17 15:07 mnt
drwxr-xr-x    2 root     root          40 Feb 17 15:07 opt
dr-xr-xr-x  171 root     root           0 Apr 26 19:48 proc
drwx------    2 root     root          40 Feb 17 15:07 root
drwxr-xr-x    2 root     root          40 Feb 17 15:07 run
drwxr-xr-x    2 root     root        1.2K Apr 26 19:48 sbin
drwxr-xr-x    2 root     root          40 Feb 17 15:07 srv
drwxr-xr-x    2 root     root          40 Feb 17 15:07 sys
drwxrwxrwt    2 root     root          40 Feb 17 15:07 tmp
drwxr-xr-x    7 root     root         140 Apr 26 19:48 usr
drwxr-xr-x   12 root     root         260 Apr 26 19:48 var

# Submit a job
$ ./bin/client sugmit "sleep 10m"
Id of submitted job: fc5aa11b-7f1c-4435-8c7b-aee3e0f09b7f

# Get the status of the job
$ ./bin/client status fc5aa11b-7f1c-4435-8c7b-aee3e0f09b7f
Status: RUNNING

# Stop the job
$ ./bin/client stop fc5aa11b-7f1c-4435-8c7b-aee3e0f09b7f
INFO[0000] fc5aa11b-7f1c-4435-8c7b-aee3e0f09b7f: killed

# Get the status of the job
$ ./bin/client status fc5aa11b-7f1c-4435-8c7b-aee3e0f09b7f
Status: STOPPED

Information - Updated Dec 23, 2021

Stars: 0
Forks: 0
Issues: 0

pancurses is a curses library for Rust that supports both Linux and Windows

by abstracting away the backend that it uses

pancurses is a curses library for Rust that supports both Linux and Windows

Native Rust library for managing Linux Control Groups (cgroups)

This crate, curently, only supports the original, V1 hierarchy

Native Rust library for managing Linux Control Groups (cgroups)

The Rust spidev seeks to provide full access to the Linux spidev

The following is not an exhaustive demonstration of the Spidev

The Rust spidev seeks to provide full access to the Linux spidev

a minimal Linux kernel module written in rust

A recent build of Rust (latest nightly)

a minimal Linux kernel module written in rust

Direct, unsafe Rust bindings for Linux's perf_event_open system call

This crate exports unsafe Rust wrappers for Linux system calls for accessing

Direct, unsafe Rust bindings for Linux's perf_event_open system call

A safe, sane Rust interface to libseccomp on Linux

Note: This is not a high-level interface; most functions/methods in this library directly correspond to a libseccomp function

A safe, sane Rust interface to libseccomp on Linux

A transparent TCP to SOCKSv5/HTTP proxy on Linux written in Rust

Transparent TCP proxy with iptables -j REDIRECT or nft redirect to

A transparent TCP to SOCKSv5/HTTP proxy on Linux written in Rust

Linux-Device-Driver-Rust

This is a twain Repo of Linux-Device-Driver is a long time work in which I rewrite all examples in

Linux-Device-Driver-Rust

Simple, performant hot-reloading for Rust

Requires Rust nightly and only works on Linux and Windows for now

Simple, performant hot-reloading for Rust
Facebook Instagram Twitter GitHub Dribbble
Privacy