OpenFaaS function to generation Identicons
This is a simple FaaS function inspired by Bart Fokker's post.
- Make sure you have deployed a FaaS stack to your cluster using the instructions on the FaaS repo.
- Install faas-cli using
brew install faas-cli
orcurl -sSL https://get.openfaas.com | sudo sh
.
Create a new function
$ faas-cli new --lang go identicon
Clone this repo as the function
$ rm -rf identicon
$ git clone [email protected]:ganesshkumar/openfaas-identicon.git identicon
Installing the dependencies
$ cd identicon
$ dep ensure
# As of the build stage will throw an error when the vendor code(dependencies) doesn't comply gofmt
# So let's make sure our dependencies passes the gofmt check
$ gofmt -w vendor/*
$ cd ..
Build and deploy
$ faas-cli build -f identicon.yml
$ faas-cli deploy -f identicon.yml
Testing the function
$ curl localhost:8080/function/identicon --data "openfaas" > sample/openfaas.png