On a mission to run as many open source serverless/FaaS frameworks. Looking for ease of use on a local development machine (no cloud). Starting with fnproject first.
Just getting a hello world started was ridiculously easy with fn. I simply followed the steps on their site at http://fnproject.io/tutorials/Introduction/ . Summary of steps…
Pre-requisite: Install (and run) Docker locally.
Run following commands to get the hello world running in Go.
// install fn
brew install fn
// create a shell hello world
fn init --runtime go --trigger http gofn
// to deploy the application to local Docker runtime
fn --verbose deploy --app goapp --local
// invoke the function
fn invoke goapp gofn
// response should be
When you run the deploy command fn will create a Dockerfile, build the container and deploy the container; ready for you to call.
Run following commands to get the hello world running in Java.
fn init --runtime java --trigger http javafn
fn --verbose deploy --app javaapp --local
// run it
fn invoke javaapp javafn
In Conclusion: Absolutely no glitches. Everything just worked fine, the very first time.
Note: Do not get fooled by the simplicity of this. Building a real world app is way more complex as compared to a hello world. The pitfalls of every framework come out in full glory when you are in a large project. Everything from how to manage 10”s or 100’s of small functions, security, monitoring performance, aggregating logs, distributed architecture with service mesh frameworks…and so many more. Having said that, I strongly feel Serverless/FaaS is the future where one no longer has to think about provisioning of VM’s or Containers. And scaling is something that is only limited by the capacity of the underlying Cloud platform you use (AWS, Azure, Google or your own data center). In a world of FaaS you would not care how the underlying platform provides you the compute.