Project Fn is an open source project that provides a container native, poly-language, cloud agnostic (aka run on any cloud) serverless platform for running functions. Fn was launched during Oracle OpenWorld 2017. Fn is available on GitHub (https://github.com/fnproject/fn ) and provides all resources required to get started. In this article, I will just show you (and myself) how I went through the quick start steps and what it looked like on my laptop (Windows 10 with Vagrant and VirtualBox).
I simply get Fn up and running, create a first function that I then deploy and access through HTTP. I briefly show the APIs available on the Fn server and Fn UI application.
Steps:
- Create VirtualBox VM with Debian and Docker (for me, Ubuntu 14 failed to run Fn; I created issue 437 for that) – this step is described in a different article
- Install Fn command line
- Install and run Fn server in the VM, as Docker container
- Create function hello
- Initialize new function and run it
- Deploy the new function (in its own Docker Container running inside the container running Fn server)
- Invoke the new function over http from the Host laptop
- Run the Fn UI application
- Inspect the Fn Server REST APIs
Connect into the Debian Virtual Machine – for me with vagrant ssh.
Install Fn Command Line
To install the Fn command line, I used this command:
curl -LSs https://raw.githubusercontent.com/fnproject/cli/master/install | sh
Install and run Fn server in the VM, as Docker container
To run the Fn server, after installing the CLI, I just used
fn start
Fn Server is running.
Create function hello
As per the instructions in the quick start guide, I created a new directory hello with a text file hello.go:
Note: I created these on the host laptop inside the directory that is mapped into the VM under /vagrant. So I can access the file inside the VM in /vagrant/hello.
Initialize new function and run it
and after a little while
Deploy the new function
(in its own Docker Container running inside the container running Fn server)
Run function inside Debian VM:
Invoke the new function over http from the Host laptop
The IP address 192.168.188.102 was assigned during the provisioning of the VM with Vagrant.
Run the Fn UI application
A UI application to inspect all Fn applications and functions can be installed and ran:
And accessed from the host laptop:
Note: for me it did not show the details for my new hello function.
Inspect the Fn Server REST APIs
Fn platform publishes REST APIs that can be used to programmatically learn more about applications and functions and also to manipulate those.
Some examples:
and
Summary
Getting started with Fn is pretty smooth. I got started and wrote this article in under an hour and a half. I am looking forward to doing much more with Fn – especially tying functions together using Fn Flow.
Resources
Fn project home page: http://fnproject.io/
Article to quickly provision VirtualBox Image with Debian and Docker: https://technology.amis.nl/2017/10/19/create-debian-vm-with-docker-host-using-vagrant-automatically-include-guest-additions/
Fn quick start guide: https://github.com/fnproject/fn
Fn UI on GitHub: https://github.com/fnproject/ui