OpenFaas on Docker Swarm on Raspberry Pi
OpenFaas is a server-less framework for running functions on docker containers. It's wicked easy to configure, and deploy functions. I was impressed to find out that you can deploy it to Docker Swarm on a Raspberry Pi! How neat.
Step 1) Install Docker
Step 3) Configure a registry. Since you already have docker swarm running, deploy a stack with a registry running. Note, make sure to create the directory /data/registry.
Step 1) Install Docker
Step 2) Configure OpenFaas by following there really well done tutorial on OpenFaas.com> curl -fsSL get.docker.com -o get-docker.sh && sh get-docker.sh
Step 3) Configure a registry. Since you already have docker swarm running, deploy a stack with a registry running. Note, make sure to create the directory /data/registry.
and deploy withversion: "3.3"services:repo:image: registry:2ports:- 5000:5000volumes:- '/data/registry:/var/lib/registry'
> docker stack deploy -c docker-stack.yml infraStep 4) Setup on Work Station. You only have have Docker and OpenFaaS CLI installed. Once you do that you should be good to go. Note that if you want to deploy to that registry you have to add it to your "insecure repositories" section in your settings.
Nice things to try
Create new function
> faas-cli new func-demo --lang python3-armhf --prefix raspberrypi:5000
Deploy function
> faas-cli up -f func-demo.yml --gateway raspberrypi:8080
Test New Function
> curl -d "hello" http://raspberrypi:8080/function/func-demo
hello
Comments
Post a Comment