Overview

Appbase.io uses OpenFaas under the hood to create and deploy functions. We use OpenFaas because:

  • It lets you write function in any language
  • It is open source and actively maintained
  • Can be easily deployed and maintained with kubernetes orchestration

There are two ways to get started with Functions and Appbase.io

Appbase.io Clusters

Supports functions out of the box for Production II, III, IV plans. All you need to do is Create Function, Deploy Function and Set Triggers.

Self Hosted Appbase.io

With Self Hosted Appbase.io and kubernetes orchestration, you can deploy functions in the same infrastructure as of your Elasticsearch. There are multiple ways to deploy OpenFaas with kubernetes. The recommended way is using helm charts.

Prerequisite

Installation steps

1. Add OpenFaas namespaces

kubectl apply -f https://raw.githubusercontent.com/openfaas/faas-netes/master/namespaces.yml

2. Add OpenFaas repo

helm repo add openfaas https://openfaas.github.io/faas-netes/

3. [Optional] Generate secrets so that we can enable basic authentication for the Gateway

This step is only required if you are exposing OpenFaas gateway via Load Balancer.

PASSWORD=admin

kubectl -n openfaas create secret generic basic-auth \
--from-literal=basic-auth-user=admin \
--from-literal=basic-auth-password="\$PASSWORD"

4. Deploy OpenFaas

helm repo update \
&& helm upgrade openfaas --install openfaas/openfaas \
--namespace openfaas \
--set functionNamespace=openfaas-fn \
--set basic_auth=false

If you are using Load Balancer to expose OpenFaas Gateway, then you can add --set serviceType=LoadBalancer switch in the above command. Similarly if you have enabled basic auth then you need to add --set basic_auth=true switch.

5. Configure Appbase

If you are using Appbase.io with kubernetes and not using LoadBalancer for OpenFaas, then add following variable to Appbase Environment Variable.

OPENFAAS_GATEWAY="http://gateway.openfaas:8080"

If you are exposing your OpenFaas service via LoadBalancer with Basic Authentication, then add following variable to Appbase Environment Variable

OPENFAAS_GATEWAY="http://username:password@IP_ADDRESS:8080"

Note: If you are using Self Hosted version of Appbase.io and want to deploy private image of function, you will have to add OPENFAAS_KUBE_CONFIG env with the value where your kubernetes config file exists.

That's all, we have successfully deployed and integrated OpenFaas with Appbase.io. Now lets us see how we can Create Functions.