Code Monkey home page Code Monkey logo

rpi-faasd's Introduction

faasd on a Raspberry Pi

main

Blog post: A serverless appliance for your Raspberry Pi with faasd

This repository contains Packer templates and scripts to build a Raspbian image with faasd and inlets PRO pre-installed.

faasd is the same OpenFaaS experience and ecosystem, but without Kubernetes. Functions and microservices can be deployed anywhere with reduced overheads whilst retaining the portability of containers and cloud-native tooling such as containerd and CNI.

The installation took inspiration from the blog of Alex Ellis, which explains how to install faasd on a Raspberry Pi in more detail.

Beside containerd, faasd and inlets, also cloud-init is available to initialize and configure a Raspian instance. With cloud-init you can customize e.g. hostname, authorized ssh keys, a static ip, basic auth for faasd, ...

This setup includes the following images:

  • rpi-faasd: a Raspios/Ubuntu image with containerd and faasd as systemd services, to run a private faasd instance.

How to use these images

in general

  1. Download the image of the latest release or build the image.

  2. Flash the image to an SD card.

  3. Optionally customize the /boot/user-data with e.g. authorized ssh keys, basic auth credentials ...

  4. Insert the SD card into the Raspberry Pi and power it up.

  5. As soon the services are up and running, you can access OpenFaas on http://<your raspberry pi ip>:8080. The required basic auth credentials are available in /var/lib/faasd/secrets/ on your Raspberry Pi

in combination with inlets-pro

To expose the faasd gateway running on a Raspberry Pi, you need to create an exit-node with a public ip. I find the use of inletsctl to easist way to achieve this. Download the latest release or simply install it by running curl -sSLf https://inletsctl.inlets.dev | sudo sh

Next, create an HTTP exit-node on your favourite cloud provider, e.g. on DigitalOcean:

inletsctl create  \
  --tcp=false \   
  --provider digitalocean \   
  --access-token-file ~/access-token.txt \   
  --region lon1 \
  --letsencrypt-domain <your domain>
  --letsencrypt-email <your email>

After writing the rpi-faasd image to an SD card, configure your instance with the proper values for the required environment variables. (See examples/user-data-inlets)

Building the images

This project includes a Vagrant file and some scripts to build the images in an isolated environment.

To use the Vagrant environment, start by cloning this repository:

git clone https://github.com/jsiebens/rpi-faasd
cd rpi-faasd

Next, start the Vagrant box and ssh into it:

vagrant up
vagrant ssh

When connected with the Vagrant box, run build.sh in the /vagrant directory:

cd /vagrant
./build.sh

rpi-faasd's People

Contributors

jsiebens avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.