Crates.io | roche |
lib.rs | roche |
version | 0.3.3 |
source | src |
created_at | 2020-12-30 01:34:09.983279 |
updated_at | 2021-02-02 02:03:31.527909 |
description | A cli to build serverless rust applications |
homepage | |
repository | https://github.com/roche-rs/roche |
max_upload_size | |
id | 329075 |
size | 97,873 |
A cli for rapidly developing tide in containers.
Services built with Rust have some fantastic runtime qualities for serverless applications:
low resource footprint
quick startup time
zero garbage collection
However these things come with a trade off as build times are not ideal for rapid application development.
roche addresses this short coming by providing a function as a service pattern for tide that reduces build times to seconds and enables developers to focus on business logic allowing for the speedy delivery of blazing fast and energy efficient software.
It leverages the nesting feature of tide so all that is required to be developed is a handler while the application infrastructure is provided by prebuilt docker containers.
Once the base images are downloaded build times are around 5s for debug and 30s for Release.
Roche is intended to target knative environments but it can also be used to build standard docker containers.
See the Architecture page for details.
$ cargo install roche
$ mkdir tide-faas
$ cd tide-faas
$ roche init
This creates a single function file that you can add functionality into.
pub fn handler() -> tide::Server<()> {
let mut api = tide::new();
api.at("/").get(|_| async { Ok("Hello, World!") });
api
}
That's all you need! Support for external libs will be added in the future probably through custome base images.
$ docker login
$ roche build
# optionally you can provide an image name
$ roche build -t registry/namespace/devimagename:version
docker run -p 8080:8080 registry/namespace/devimagename:version
$ roche release registry/namespace/imagename:version
$ docker push registry/namespace/imagename:version
# knative
$ kn service create roche-function --image registry/namespace/imagename:version
# ibmcloud
$ ibmcloud ce app create -n roche-function --image registry/namespace/imagename:version
If you would like to run the build process as part of a CI/CD chain then the following command will generate a Dockerfile
to ship in the same folder as function.rs.
$ roche gen
roche is an OPEN Open Source Project. This means that:
Individuals making significant and valuable contributions are given commit-access to the project to contribute as they see fit. This project is more like an open wiki than a standard guarded open source project.
See the Contribution Guide for more details.
Project generation features rely on the excellent cargo generator project
Insperation from Appsody (end of life)