3. The serverless explained
Credits: Matthew Gilliard
DIY Bare Metal PaaS K8s-aaS Serverless
Hardware
OS
Hypervisor
Virtual OS
Container
Orchestration
Application
Code
@totollygeek
14. @totollygeek
What is Fn Project?
âą Independent open-source
serverless compute platform
âą Not tied to any cloud vendor
âą Can be run on premises
âą Supported by Oracle
âą Containers are primitives
âą Strong enterprise in mind
15. What is a function container?
âą Sandboxed process
âą Short running
âą Event-driven
âą Stateless (-ish)
@totollygeek
16. Anatomy of an Fn function
âą Small chunk of code wrapped in a container
âą Gets input from http-stream and environment
âą Sends output to http-stream
âą Logs to STDERR / syslog
@totollygeek
17. FDK (Function Development Kit)
support
Go Java Node.js Python Ruby
Officially
supported
C#
Community
supported
@totollygeek
18. The Fn Server
âą Runs in a container also
âą Handles as an API gateway
âą Exposes REST interface
âą Storing logs
@totollygeek
19. The Fn CLI
âą Of course we have a CLI!
âą Used to interact with Fn Server
âą Initialization
âą Deployment
âą Invocation
@totollygeek
20. Initialization of functions
âą Calling fn init to create a boilerplate in a folder
âą Does not do anything on the server
âą Boilerplate includes: Dockerfile, func.yaml & code
@totollygeek
21. @totollygeek
How deployment works
1. Bumps function version
2.Builds container
3.Pushes it to registry
4.Creates or update function & trigger in server
Your code
MyFunc:0.0.2
1 & 2 3
MyFunc:0.0.2
MyFunc:0.0.2
Fn Service
4
26. Using it in Kubernetes
âą Recommended way of
deployment for production
âą Helm chart available on
GitHub
@totollygeek
27. Fn Flow
âą Building scalable distributed applications out of functions
âą Flows are functions also
âą Support complex parallel processes with error handling, which is testable
âą Flow functions scale as normal functions
âą Currently supports Java, hopefully more to come
@totollygeek
28. @totollygeek
Fn Flow | Licence plate example
Scraper
Plate detect
Plate detect
Plate detect
Draw
Draw
Draw
Post to
Twitter
Post to
Twitter
Post to
Twitter
Post to
Slack
Post to
Slack
Post to
Slack
29. @totollygeek
Fn Flow | Licence plate example
Scraper
Plate detect
Plate detect
Plate detect
Draw
Draw
Draw
Post to
Twitter
Post to
Twitter
Post to
Twitter
Post to
Slack
Post to
Slack
Post to
Slack
FlowFuture.invoke()
thenCompose()
thenCompose()
allOf()
whenComplete()