After you've completed this micro-tutorial you'll be making requests to your Redis cache from serverless functions with OpenFaaS. From there it's up to you to build something awesome.
Deploy OpenFaaS and the faas-cli
.
This guide is for OpenFaaS on Kubernetes, but if you're using Swarm that's OK - you'll just have to adapt some of the commands for setting up Redis. The OpenFaaS code will be the same.
helm install stable/redis --name openfaas-redis --namespace openfaas-fn --set usePassword=false --set master.persistence.enabled=false
$ faas-cli new --lang node redis-fn --prefix docker-hub-name
# copy handler.js into ./redis-fn/
# copy package.json into ./redis-fn/
# Append to stack.yml
environment:
redis: openfaas-redis-master
$ faas-cli up
$ echo | faas-cli invoke redis-fn
$ kubectl port-forward --namespace openfaas-fn svc/openfaas-redis-master 6379:6379 &redis-cli -h 127.0.0.1 -p 6379
127.0.0.1:6379> GET mytime
"Thu Nov 01 2018 08:10:46 GMT+0000 (UTC)"
127.0.0.1:6379>
Now you can profit from using Redis from your functions.
You can read the docs about the Redis npm module here or join the OpenFaaS Slack community to boost your serverless journey.
Did you find that useful? Please share on Twitter or Tweet to @alexellisuk
Waaay late in this thread, but for ARM64 (ARMv8) you can use these custom values to deploy the basic Redis Helm chart
Of course it's Redis-only (no sentinel or other goodies), 1 master + 3 worker nodes.