justinas / paas

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Paas (processes as a service)

This was my solution for Teleport's backend software engineer coding challenge.

Paas is a set of tools that allow users to execute and manage arbitrary Unix processes. paasd is a daemon that exposes these operations via a gRPC API over mTLS. paasc is a command line utility to interact with paasd. For more information, see the design document.

Building

Requirements:

  • Rust 1.45.2 or higher
  • Protoc (installed in a standard location, see prost-build docs for more info)

Nix users can use the provided shell.nix.

To compile in release profile, run:

$ cargo build --release

Running

Paasd (server)

$ RUST_LOG=info ./target/release/paasd
 INFO  paasd > starting on 127.0.0.1:8443

Paasc (client): example session

$ ./target/release/paasc exec bash -c 'while true; do echo $RANDOM; sleep 1; done'
50a1d407-c48c-4323-854d-a954aca0b075
$ ./target/release/paasc status 50a1d407-c48c-4323-854d-a954aca0b075
Status: running
$ ./target/release/paasc logs 50a1d407-c48c-4323-854d-a954aca0b075 
26313
5952
2737
^C
$ ./target/release/paasc stop 50a1d407-c48c-4323-854d-a954aca0b075
$ ./target/release/paasc status 50a1d407-c48c-4323-854d-a954aca0b075
Status: exited (signal 15)

Development certificates

TLS certificates for local development are pre-generated for both paasc and paasd, and can be regenerated by running ./data/generate_certs.sh. OpenSSL is required.

Contributing

Code style is enforced by rustfmt. Clippy is used as a linter.

About


Languages

Language:Rust 93.0%Language:Shell 6.1%Language:Nix 0.9%