Deploy Golang function on Openfaas

this post will show you how to deploy a Sendtweet golang function in a OpenFaas Plaform.

installation

Openfaas supports Docker swarm, Docker Playground, but here i used Kubernetes environment as example

CentOS 7 Kubernetes Master-Node installation guide

after you deployed your kubernetes, you can start to deploy Openfaas

Openfaas CLI

faas-cli used to manage all of your functions

Deploy OpenFaas

if there’s nothing wrong, open http://localhost:31112/ you will see the OpenFaas Portal.

Deploy Grafana monitor

user/pass: admin

Golang function

faas-cli can generates many different languages template

so i wrote a function that use to send tweet

deploy it with dependency

Invokes

for synchronized invoke follow http://{domainname}:{port}/function/{function name} to invoke your functions

Deploy Golang function on Openfaas - 1

for synchronized invoke, you have to set a callback url in your request headers, then follow http://{domainname}:{port}/async-function/{function name} to starts your invoke

Deploy Golang function on Openfaas - 3

3 thoughts on “Deploy Golang function on Openfaas”

Leave a Reply

Your email address will not be published. Required fields are marked *