btrfaas is trusch's function as a service platform
Btrfaas is a framework for developing and deploying serverless applications. It provides ways to bootstrap, build and deploy functions as a basic building blocks of your next project.
You can deploy your btrfaas clusters natively on either kubernetes, docker swarm, or even locally on plain docker for development use cases. So developing and testing your functions and services locally and deploying them at scale becomes trivial.
I started working on this after playing a while with OpenFaaS. I love this project. Its focus on developer/user experience and its simplicity are a big plus. Unfortunately I encounterd some serious problems when evaluating if openfaas would be usable in a range of edge cases coming from a big data background. Some of theses problems are:
Additionally here are some general problems I found regarding production readyness:
All I wanted was a version of openfaas which solves the problems above, and I hope that some of the ideas from this project will find its way back into the original openfaas codebase.
# install
curl -sL https://raw.githubusercontent.com/trusch/btrfaas/v0.3.3/install.sh | sh
# init deployment
btrfaasctl init
# deploy sample functions
btrfaasctl function deploy https://raw.githubusercontent.com/trusch/btrfaas/v0.3.3/examples/sed.yaml
btrfaasctl function deploy https://raw.githubusercontent.com/trusch/btrfaas/v0.3.3/examples/to-upper.yaml
# test it
echo "I hate this" | btrfaasctl function invoke "sed -e s/hate/love/ | to-upper"
I LOVE THIS
# Teardown
btrfaasctl teardown
# bootstrap function
btrfaasctl function init my-echo --template go
# edit ./my-echo/ to fit your needs
# build and deploy
btrfaasctl function build my-echo
btrfaasctl function deploy my-echo/function.yaml
# test it
echo "Hello World" | btrfaasctl function invoke my-echo
Hello World
This will setup the complete btrfaas stack. This includes:
# init deployment
btrfaasctl init
# deploy fui, prometheus and grafana
btrfaasctl service deploy https://raw.githubusercontent.com/trusch/btrfaas/v0.3.3/core-services/fui/fui.yaml
btrfaasctl service deploy https://raw.githubusercontent.com/trusch/btrfaas/v0.3.3/core-services/prometheus/prometheus.yaml
btrfaasctl service deploy https://raw.githubusercontent.com/trusch/btrfaas/v0.3.3/core-services/prometheus/grafana.yaml
# configure grafana:
while ! curl -s -H "Content-Type: application/json" \
-XPOST http://admin:admin@localhost:3000/api/datasources \
-d @- <<EOF
{
"name": "prometheus",
"type": "prometheus",
"access": "proxy",
"isDefault": true,
"url": "http://prometheus:9090"
}
EOF
do sleep 1; done
# deploy sample functions
btrfaasctl function deploy https://raw.githubusercontent.com/trusch/btrfaas/v0.3.3/examples/sed.yaml
btrfaasctl function deploy https://raw.githubusercontent.com/trusch/btrfaas/v0.3.3/examples/to-upper.yaml
You can now visit:
http://localhost:8000
http://localhost:9000
http://localhost:3000
Contributions are welcome, please feel free to open a PR! If you find a bug or have an idea on how to improve things, open an issue. PR's are accepted if they follow the used coding standards, and the go-report keeps on 100%. If you add end-user features, it would be great to see them integrated into the smoke tests.
Version | Tag | Published |
---|---|---|
v0.3.2 | 1yr ago | |
v0.3.1 | 1yr ago | |
v0.3.0 | 1yr ago | |
v0.2.2 | 1yr ago |