All Projects → schollz → Faas

schollz / Faas

Make any Go function into a API (FaaS)

Programming Languages

go
31211 projects - #10 most used programming language
golang
3204 projects

Labels

Projects that are alternatives of or similar to Faas

Openwhisk
Apache OpenWhisk is an open source serverless cloud platform
Stars: ✭ 5,499 (+6078.65%)
Mutual labels:  cloud, faas
Tensorflow Lambda Layer
Lets you import Tensorflow + Keras from an AWS lambda
Stars: ✭ 79 (-11.24%)
Mutual labels:  cloud, faas
Openwhisk Deploy Kube
The Apache OpenWhisk Kubernetes Deployment repository supports deploying the Apache OpenWhisk system on Kubernetes and OpenShift clusters.
Stars: ✭ 231 (+159.55%)
Mutual labels:  cloud, faas
Openfaas Cloud
The Multi-user OpenFaaS Platform
Stars: ✭ 744 (+735.96%)
Mutual labels:  cloud, faas
Openwhisk Runtime Php
Apache OpenWhisk Runtime PHP supports Apache OpenWhisk functions written in PHP
Stars: ✭ 26 (-70.79%)
Mutual labels:  cloud, faas
Openwhisk Runtime Nodejs
Apache OpenWhisk Runtime NodeJS supports Apache OpenWhisk functions written in JavaScript for NodeJS
Stars: ✭ 43 (-51.69%)
Mutual labels:  cloud, faas
K8s On Raspbian
Kubernetes on Raspbian (Raspberry Pi)
Stars: ✭ 839 (+842.7%)
Mutual labels:  cloud, faas
Openwhisk Apigateway
Apache OpenWhisk API Gateway service for exposing actions as REST interfaces.
Stars: ✭ 56 (-37.08%)
Mutual labels:  cloud, faas
Cfn Sphere
AWS CloudFormation stack management tool
Stars: ✭ 76 (-14.61%)
Mutual labels:  cloud
Minio Go
MinIO Client SDK for Go
Stars: ✭ 1,231 (+1283.15%)
Mutual labels:  cloud
Amp
** THIS PROJECT IS STOPPED ** An open source CaaS for Docker, batteries included.
Stars: ✭ 74 (-16.85%)
Mutual labels:  cloud
Blockerized Dockchain
Because all problems are solvable with containers and blockchains
Stars: ✭ 77 (-13.48%)
Mutual labels:  cloud
Oci Go Sdk
Go SDK for Oracle Cloud Infrastructure
Stars: ✭ 83 (-6.74%)
Mutual labels:  cloud
Hook.io
Open-Source Microservice Hosting Platform
Stars: ✭ 1,201 (+1249.44%)
Mutual labels:  faas
Cloudprober
An active monitoring software to detect failures before your customers do.
Stars: ✭ 1,269 (+1325.84%)
Mutual labels:  cloud
Openwhisk Cli
Apache OpenWhisk Command Line Interface (CLI)
Stars: ✭ 73 (-17.98%)
Mutual labels:  faas
Google It Automation With Python
Repository to keep track of Google IT Automation with Python provided by Coursera
Stars: ✭ 86 (-3.37%)
Mutual labels:  cloud
Enseada
A Cloud native multi-package registry
Stars: ✭ 80 (-10.11%)
Mutual labels:  cloud
Yi Hack V4
New Custom Firmware for Xiaomi Cameras based on Hi3518e Chipset. It features RTSP, SSH, FTP and more!
Stars: ✭ 1,183 (+1229.21%)
Mutual labels:  cloud
Deploy Spring Boot Aws Eb
Deploying Spring Boot Apps to AWS using Elastic Beanstalk
Stars: ✭ 79 (-11.24%)
Mutual labels:  cloud

faas

Make any (Go) function into an API with one HTTP request.

This is a FaaS: functions as a service. But, in actuality, its more of a FaaSSS: functions as a stupidly simple service. Imagine iron.io/functions, or zeit/now or openfaas or apex or sky-island but more simple and more stupid.

Unlike others, this FaaS requires no coding, no init-ing, no pushing, no updating, and no bumping. You Just make one HTTP request with the name of the package, the name of the function, and any input. Right now it only works for Go. It can easily be extended to Python (WIP).

The codebase is only about 600 lines of code in total. Basically a request tells the server to fetch the function, determine the inputs/outputs and write a wrapper function that is served from a Docker container.

Examples

Try it right now with my instance at https://faas.schollz.com.

You can make (almost) any exported Go function into a API!

Run Md5Sum to get a md5 hash of "hello, world":

$ curl https://faas.schollz.com/?import=github.com/schollz/utils&func=Md5Sum(%22hello,%20world%22)
e4d7f1b4ed2e42d15898f4b27b019da4

Run IngredientsFromURL to get the ingredients from any website:

$ curl https://faas.schollz.com/?import=github.com/schollz/ingredients&func=IngredientsFromURL(%22https://cooking.nytimes.com/recipes/12320-apple-pie%22)
{"ingredients": [{"name":"butter","comment":"unsalted","measure":{"amount":2,"name":"tablespoons","cups":0.25}},{"name":"apples","measure":{"amount":2.5,"name":"pounds","cups":14.901182654402104}},{"name":"allspice","comment":"ground","measure":{"amount":0.25,"name":"teaspoon","cups":0.0104165}},{"name":"cinnamon","comment":"ground","measure":{"amount":0.5,"name":"teaspoon","cups":0.020833}},{"name":"salt","comment":"kosher","measure":{"amount":0.25,"name":"teaspoon","cups":0.0104165}},{"name":"sugar","comment":"plus 1 tablespoon","measure":{"amount":0.75,"name":"cup","cups":1.5}},{"name":"flour","comment":"all purpose","measure":{"amount":2,"name":"tablespoons","cups":0.25}},{"name":"cornstarch","measure":{"amount":2,"name":"teaspoons","cups":0.083332}},{"name":"apple cider vinegar","measure":{"amount":1,"name":"tablespoon","cups":0.125}},{"name":"pie dough","measure":{"amount":1,"name":"whole","cups":0}},{"name":"egg","measure":{"amount":1,"name":"whole","cups":0}}],"err": null

Run MarkdownToHTML from a Go playground:

$ curl -d '{"markdown":"*hello*,**world**"}' \
 	-H "Content-Type: application/json" -X POST \
 	https://faas.schollz.com/?import=https://play.golang.org/p/9xzE8Ivwupk.go&func=MarkdownToHTML
<p><em>hello</em>,<strong>world</strong></p>

Usage

You can use GET or POST to submit jobs.

For the GET requests the syntax is

/?import=IMPORTPATH&func=FUNCNAME(param1,param2...)

The IMPORTPATH is the import path (e.g. github.com/x/y) or a URL containing the file with the function. The FUNCNAME is the name of the function. Note, you do need to URL encode the strings so that FUNCNAME("hello, world") -> FUNCNAME(%22hello,%20world%22)

For the POST requests the syntax is:

/?import=IMPORTPATH&func=FUNCNAME

with the body with the inputs {"param":"value"}.

That's it! The first time you run it will take ~1 minute while the Docker image is built.

How does it work?

When you make a POST/GET request to the faas server it will locate the given function and given package and it will generate a Docker container that accepts a JSON input with the parameters and outputs a JSON containing the output variables. This Docker container automatically shuts down after some time of inactivity. Subsequent requests then will load the previously built container for use.

Host yourself

You need to install Docker, and make sure gzip is installed.

Then build faas with Go:

git clone https://github.com/schollz/faas
cd faas
go generate
go build -v

Now you can run:

./faas --debug

Now you can try it out:

curl http://localhost:8090/?import=github.com/schollz/utils&func=Md5Sum(%22hello,%20world%22)

OR post data:

curl -d '{"s":"hello, world"}' -H "Content-Type: application/json" -X POST http://localhost:8090/?import=github.com/schollz/utils&func=Md5Sum

Note that the JSON "s" comes from the function Md5Sum itself.

License

MIT

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].