Skip to content
This repository has been archived by the owner on Mar 4, 2024. It is now read-only.

obs-nebula/function-five

This branch is 1 commit ahead of main.

Folders and files

NameName
Last commit message
Last commit date
Apr 14, 2023
Feb 22, 2023
Feb 22, 2023
Feb 22, 2023
Mar 1, 2024
Feb 22, 2023
Jan 30, 2023
Jan 27, 2023
Feb 16, 2023
Jan 29, 2023
Jan 30, 2023
Jan 28, 2023

Repository files navigation

function-five

ci

Loading
graph TD;
    Desktop--Initial request to FaaS-->A;
    A--Adds 0+1 & send the result to -->B;
    B--Adds 1+1 & send the result to -->C;
    C--Adds 2+1 & send the result to -->D;
    D--Adds 3+1 & send the result to -->E;
    A--traces to-->OTELCOL;
    B--traces to-->OTELCOL;
    C--traces to-->OTELCOL;
    D--traces to-->OTELCOL;
    E--traces to-->OTELCOL;
    OTELCOL-->Jaeger;
    Desktop--Request the result-->E;

Run ./get-func.sh to get the func command.

Functions created with the following commands:

./func create -l node -t http one
./func create -l node -t http two
./func create -l node -t http three
./func create -l node -t http four
./func create -l node -t http five

Run locally outside of a container

After creating the functions, the code was changed by adding the business rule, and the tests were adjusted since most of the functions in this example are only handling the POST method.

Some of the Knative function runtimes work out of the box without requiring a build, see the description here.

For this, another script was added to package.json devjs, then we can run npm run devjs specifying the http port with --port=8080 for the faas-js-runtime.

A basic script ./dev-js.sh can be executed to run the five functions.

Run locally

Build the functions

./func build --path one/   --registry your_registry_here
./func build --path two/   --registry your_registry_here
./func build --path three/ --registry your_registry_here
./func build --path four/  --registry your_registry_here
./func build --path five/  --registry your_registry_here

Run

docker-compose up

The fantastic desktop app used in this example is here: https://github.com/obs-nebula/desktop-electron