Examples Using the OpenFaaS R Templates
This folder contains the following worked examples:
More examples are on the way. Please submit a PR if you have an interesting use case that you'd like to see here.
These are prerequisites for all the examples.
Step 1. Install the OpenFaaS CLI.
Step 2. Set up your k8s, k3s, or faasd with OpenFaaS.
It is recommended to read the OpenFaaS docs first and set up a local or remote Kubernetes cluster or faasd with OpenFaaS deployed. To get going quickly, follow the official OpenFaaS workshop, or enroll into the free Introduction to Serverless on Kubernetes course.
If you are looking for the smallest footprint (single node), the book Serverless For Everyone Else by Alex Ellis is highly recommended.
Step 3. Use docker login
to log into your registry of choice for pushing images.
Export your Docker Hub user or organization name:
export OPENFAAS_PREFIX="" # Populate with your Docker Hub username
Step 4. Log into your OpenFaaS instance (see more info here):
export OPENFAAS_URL="http://127.0.0.1:8080" # Populate with your OpenFaaS URL
# This command retrieves your password
PASSWORD=$(kubectl get secret -n openfaas basic-auth -o jsonpath="{.data.basic-auth-password}" | base64 --decode; echo)
# This command logs in and saves a file to ~/.openfaas/config.yml
echo -n $PASSWORD | faas-cli login --username admin --password-stdin
Note: use http://127.0.0.1:8080
as your OpenFaaS URL when using port forwarding via:
kubectl port-forward svc/gateway -n openfaas 8080:8080
Step 5. Use the faas-cli
and pull R templates:
faas-cli template pull https://github.com/analythium/openfaas-rstats-templates
Now you can pick one of the examples and continue.