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
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.
kubectl apply -f https://raw.githubusercontent.com/openfaas/faas-netes/master/namespaces.yml
helm repo add openfaas https://openfaas.github.io/faas-netes/
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"
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.
If you are using Appbase.io with kubernetes and not using LoadBalancer for OpenFaas, then add following variable to Appbase Environment Variable.
If you are exposing your OpenFaas service via LoadBalancer with Basic Authentication, then add following variable to Appbase Environment Variable
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_CONFIGenv 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.