Web Development 701 ~ OpenFaas
As stated in the previous blog, the first exposure to serverless was OpenFaaS. Whether its because of bias of the first exposure or because of bias towards docker, I am going to be exploring OpenFaaS for the serverless implementation of assessment three. First thing to do like anything is to head to the documentation section. “OpenFaaS (Functions as a Service) is a framework for building serverless functions with Docker and Kubernetes which has first class support for metrics.” [source] “OpenFaaS is free to use and completely open source under the MIT license.” [source]
The overview of OpenFaaS are as follows.
Now to move on to the getting started section and get our hands dirty.
There are two available options for deployment docker swarm and kubernetes. Docker swarm is recommended for beginners so I will run through that guide first.
The first step is to install the faas-cli. I am using my ubuntu 16.04 LTS virtual machine, so I will be installing via the curl command which is as follows.
curl -sL https://cli.openfaas.com | sudo sh
Next is to initialize a docker swarm via the following command.
docker swarm init
Now to deploy the OpenFaas stack via the following.
git clone https://github.com/openfaas/faas && cd faas && ./deploy_stack.sh
Going to localhost:8080
should give us a login panel to access the UI.
It works!
Finally to make sure everything is working the guide suggests to deploy a sample function from the OpenFaas function store. The example function in the guide is figlet and the command to deploy/evoke it is as follows.
faas-cli store deploy figlet
echo "Hello OpenFaas!" | faas-cli invoke figlet
With this done the next step is to go through the OpenFaas workshop which I will cover in the next blog.