build you own serverless cloud - leipzig.jugsaxony.camp€¦ · introduction course objectives...

Post on 20-May-2020

4 Views

Category:

Documents

0 Downloads

Preview:

Click to see full reader

TRANSCRIPT

Build You Own Serverless CloudIntroduction

IntroductionWho’s that guy?

Passionate Java Developer (especially Spring)Python, Go-Lang

Agile and Devops infectedDocker enthusiast

berndfischer63@gmail.com@berndfischer63

JUG Saxony e.V., Docker Community Dresden

CTO MindApproach GmbH, Dresdenbfischer@mindapproach.de

IntroductionServers and Me

Evolution in five steps

❏ Step 1 - Mounted Drives, FTP, SCP, …❏ Step 2 - Simple Automation with Scripting ...❏ Step 3 - Virtual Machines, Vagrant, Puppet, Ansible❏ Step 4 - Containerisation

❏ Single Application (non-distributed)❏ Step 5 - Orchestration

❏ Distributed Application

IntroductionWho’s that guy?

Disclaimer ….

IntroductionWho you are?

- Programming Languages- Python- Ruby, JavaScript- ...

- Used Operating Systems- Knowledge in

- Linux/Bash- Docker (Swarm)- Kubernetes

IntroductionCourse Objectives

● Architectural/Design Pattern○ “Platform” Evolution○ Serverless aka Function-as-a-Service

● Cloud○ Software Container, Docker Swarm

● OpenFaaS○ “Example” for Hands-On

● Build○ get your fingers dirty / hands-On

IntroductionCourse Objectives

● !!!● Non-productive environment and examples● !!!

IntroductionAgenda

09:00 - 12:00 Intro

Function-as-a-Service

Software Container (Docker)

OpenFaaS - Hands-On- Workshop-Environment/Installation- UI, CLI- First Function- ...

Round-Up, FAQ

# bla

IntroductionSlide: Presenter Demo

# bla

IntroductionSlide: Doing it together

DEMO

IntroductionSlide: Meeting Point ...

IntroductionLinks ...

● Martin Fowler, Mike Roberts: Serverless Architecture○ https://martinfowler.com/articles/serverless.html

● Martine Fowler, Badri Janakiraman○ https://martinfowler.com/bliki/Serverless.html

● Projekt OpenFaaS○ https://www.openfaas.com/○○ https://github.com/openfaas/○ https://github.com/openfaas/faas/blob/master/guide/troubleshooting.md○ https://github.com/openfaas/faas/tree/master/watchdog○ https://github.com/openfaas/faas-cli○○ https://docs.openfaas.com○ https://github.com/openfaas/workshop ○○ https://github.com/openfaas-incubator○ https://github.com/faas-and-furious

Introduction

This is the last slide ...

Introduction

... cannot activate /dev/brain, no response from main coffee server

# bla

Title

# bla

Title

DEMO

Title

Build Own Serverless CloudFunction-as-a-Service

Function-as-a-ServiceFrom Pets to Insects

● Pets○ individual maintained

● Cattles○ maintained as herd

● Chickens○ like cattles but much smaller and therefore more

efficient● Insects

○ like chickens but even smaller and less lifespan

Function-as-a-ServiceFrom Pets to Insects

https://blog.alexellis.io/content/images/2017/08/evolution.png

Function-as-a-ServiceFrom Pets to Insects

https://blog.alexellis.io/content/images/2018/03/functions.png

Function-as-a-ServiceSoftware Architecture

● Microservice○ How big is “micro”?

● Event Driven○ (Database) Trigger○ Message Bus○ CQRS

(Command-Query-Responsibility-Segregation)

Function-as-a-ServiceGoals

● reduced costs for○ development○ deployment○ operational costs

■ pay for what you use (only)● reduced time

○ development○ deployment○ time-to-market

Function-as-a-ServiceDrawbacks

● State handling● Testing● Portability / Vendor lock-in

Function-as-a-Service

This is the last slide ...

# bla

Introduction

# bla

DEMO

Build OwnServerless CloudWhy Container?

Why Container?Fokus

commercial software development

Why Container?Parts of Software Creation

❏ Development❏ write code

❏ Delivery❏ enable usage for “end user”

❏ Operation❏ keep it running

Why Container?Characteristics

http://m.memegen.com/efxili.jpg

Why Container?Characteristics

Make it reproducible

by myself

Why Container?Characteristics

Automate almost everything

Continuous Delivery, 2010 [HuFa01]

Why Container?Characteristics

Continuous Environment

by myself

Why Container?Culture ...

You build it you run itWerner Vogels, CTO Amazon, 2006 [Gra01]

Why Container?Culture ...

DevOpsAndrew Clay Shafer, Patrick Debois, Agile Conference 2008

DevOpsDays Ghent 2009

Why Container?Evolving Architecture Concepts ...

http://martinfowler.com/articles/microservices.html

Why Container?Evolving Architecture Concepts ...

● single/non-distributed applications● distributed applications

Why Container?Evolving Infrastructure Concepts ...

Why Container?Evolving Infrastructure Concepts ...

Why Container?App Packaging and Distribution

Why Container?

This is the last slide ...

Build Own Serverless CloudSoftware Container (Docker)

Container - DockerBuilding Blocks

https://blog.docker.com/2016/04/docker-engine-1-11-runc/

Container - DockerDistribution - Overview

Docker Host (Linux)

Docker Client Docker DaemonSocket

RESTFul API

Docker Client

Windows

Docker Client

Mac OS X

Docker Client

Container ImagesContainer

ContainerImages

ImagesDockerWorkspace

Container - DockerDistribution - Remote I

DockerContainer/home

DockerClient

DockerDaemon

Container - DockerDistribution - Remote II

DockerContainer/home

DockerClient

DockerDaemon

SSHClient

Container - DockerDistribution - Local I

Virtual Machine (Ubuntu)

DockerContainer

Host-OS

/home

DockerClient

DockerDaemon

Container - DockerDistribution - Local II

Virtual Machine (Linux)

DockerContainer

Mac OS XWindows

/Users /Users

DockerClient

DockerDaemon

Container - DockerDevWorkflow - Vision 2018

http://collabnix.com/wp-content/uploads/2017/10/Screen-Shot-2017-10-23-at-8.08.58-AM.png

Docker for Mac/Windows

Container - DockerPlay-With-Docker

https://play-with-docker.com

Container - DockerComponents

Kernel

Container - Docker Components

Virtual Machine

Hypervisor / Host OS

Physical Server Physical Server

(Special) Host OS

App A App B

Libs Libs

Guest OS

Virtual Hardware / BIOS

Doc

ker E

ngin

e

Container(Process)

App A

Libs

Container

App A

Libs

Container - DockerComponents - Docker Image

❏ Docker image ==❏ (executable)❏ filesystem containing one or more executable(s),

other files and metadata❏ some kind of “hard disc”

Container - DockerComponents - Docker Images

https://docs.docker.com/engine/userguide/storagedriver/imagesandcontainers/

# Docker CLI

docker commit

docker image build -f <Dockerfile>

Container - DockerComponents - Docker Images

Container - DockerComponents - Container

● container are based on images○ image == executable○ container == process started based on executable

● container states○ created, running, exited

● container “runs” (means: in state “running”) as long as “first” process runs

● container usually not removed automatically

# Docker CLI

docker container

create

start

stop

run

rm

exec

...

Container - DockerComponents - Container

# swarm management is done via master only

# connected to a manger

docker service create \

--detach=false \

--replicas=1 \

--name=whoami \

--publish 8000:8000 \

--constraint "node.role == worker" \

jwilder/whoami

Container - DockerComponents - Services

DEMO

# swarm management is done via master only

# connected to a manger

docker service

create

logs

ls

ps

rm

...

Container - DockerComponents - Services

DEMO

# swarm management is done via master only

# connected to a manger

docker stack

deploy -c <compose-file> <name>

ls

ps

rm

services

Container - DockerComponents - Stacks

DEMO

Container - Docker

This is the last slide ...

Container - Docker<Title>

# bla

Introduction

# bla

DEMO

Build Own Serverless CloudOpenFaas - Hands-On

OpenFaaS - Hands-OnIntroduction

OpenFaaS - Hands-OnInstallation

OpenFaaS - Hands-OnInstallation

DockerContainer/home

DockerClient

DockerDaemon

SSHClient

OpenFaaS - Hands-OnInstallation

● Bash-Syntax● Editor

○ Zeilenende-Codierung (Unix)○ UTF-8○ Win (necessary for installation only)

■ i.e. Win: Notepad++○ Linux (remote VM)

■ nano, vi(m), ...

# local computing environment (notebook, ...)# create local workspace

cd ~mkdir -p projects/demo-openfaas

cd projects/demo-openfaasPRJ_DIR=$(pwd)

OpenFaaS - Hands-OnInstallation

DEMO

# local computing environment (notebook, ...)# configure remote connection

mkdir zzTemp.gentouch zzTemp.gen/id_rsanano zzTemp.gen/id_rsa

OpenFaaS - Hands-OnInstallation

DEMO

# local computing environment (notebook, ...)# configure remote connection

open \

https://gitlab.com/aemc/demo/demo-openfaas/snippets/1706501

# copy content somehow into this file

# set access rightschmod 0600 zzTemp.gen/id_rsa

export PRV_KEY=zzTemp.gen/id_rsa

OpenFaaS - Hands-OnInstallation

DEMO

# local computing environment (notebook, ...)# connect to your remote Docker-Cluster

# !!!# !!! replace <cluster-number> with <your-number> !!!# !!!

OpenFaaS - Hands-OnInstallation

DEMO

# local computing environment (notebook, ...)# connect to your remote Docker-Cluster

ssh root@dws-cluster<cluster-number>-m01.aemc.me \-i $PRV_KEY

ssh root@dws-cluster<cluster-number>-m01.aemc.me \-i $PRV_KEY \-o UserKnownHostsFile=/dev/null \-o StrictHostKeyChecking=no

OpenFaaS - Hands-OnInstallation

DEMO

# local computing environment (notebook, ...)# connect to your remote Docker-Cluster

# PuTTy# uses special/own key format

open \https://gitlab.com/aemc/demo/demo-openfaas/snippets/1708148

# show on Win-VM

OpenFaaS - Hands-OnInstallation

DEMO

# remote computing environment (vm, ...)# create remote workspace

~# id~# pwd~# cd ~ && mkdir projects && cd projects

~# git clone https://gitlab.com/aemc/demo/demo-openfaas.git

~# cd demo-openfaas~# export PRJ_DIR=$(pwd)

~# tree

OpenFaaS - Hands-OnInstallation

DEMO

# remote computing environment (vm, ...)# create OpenFaas - Instance

~# cd $PRJ_DIR~# cat ./docker-stack.yml # use real editor

~# docker stack deploy -c docker-stack.yml func

~# docker stack services func

OpenFaaS - Hands-OnInstallation

DEMO

OpenFaaS - Hands-OnUser Interface

# local computing environment (notebook, ...)# browser

open \http://dws-cluster<cluster-number>-m01.aemc.me:8080

open \http://dws-cluster<cluster-number>-m01.aemc.me:3000

OpenFaaS - Hands-OnUser Interface

DEMO

# local computing environment (notebook, ...)# browser

# first example# deploy new function# figlet

~# docker service ls

OpenFaaS - Hands-OnUser Interface

DEMO

OpenFaaS - Hands-OnCommand Line Interface

# remote computing environment (vm, ...)# intro

~# faas-cli --help~# faas-cli [command] --help

~# faas-cli version

~# faas-cli list~# faas-cli list --verbose~# faas-cli list \--gateway http://127.0.0.1:8080 \--verbose # be careful with "localhost" !!!

OpenFaaS - Hands-OnCommand Line Interface

DEMO

# remote computing environment (vm, ...)# function invocation

~# faas-cli invoke --help

~# faas-cli invoke figlet...

~# echo "Hallo Leipzig" | faas-cli invoke figlet...

OpenFaaS - Hands-OnCommand Line Interface

DEMO

OpenFaaS - Hands-OnFirst Function

# remote computing environment (vm, ...)

~# mkdir functions && cd functions~# faas-cli template pull # creates folder template

~# ls -al~# tree -d

OpenFaaS - Hands-OnFirst Function - Install Templates

DEMO

# remote computing environment (vm, ...)

~# tree template/python3

template/python3

|-- Dockerfile

|-- function

| |-- handler.py

| |-- __init__.py

| `-- requirements.txt

|-- index.py

|-- requirements.txt

`-- template.yml

OpenFaaS - Hands-OnFirst Function - Function Skeleton

DEMO

# remote computing environment (vm, ...)# create function skeleton

~# faas-cli new --help

~# faas-cli new --list

~# faas-cli new --lang python3 hello-leipzig

OpenFaaS - Hands-OnFirst Function - Function Skeleton

DEMO

# remote computing environment (vm, ...)

# OpenFaaS function consists of

# - "Template"

# - "Plattform-Config" and

# - "Function Implementation"

./hello-leipzig.yml

./hello-leipzig/__init__.py

./hello-leipzig/handler.py

./hello-leipzig/requirements.txt

OpenFaaS - Hands-OnFirst Function - Function Skeleton

DEMO

# remote computing environment (vm, ...)

~# cat hello-leipzig.yml

provider:

name: faas

gateway: http://127.0.0.1:8080

functions:

hello-leipzig:

lang: python3

handler: ./hello-leipzig

image: hello-leipzig

OpenFaaS - Hands-OnFirst Function - Function Skeleton

DEMO

# remote computing environment (vm, ...)

~# nano hello-leipzig.yml # remove "gateway"

~# nano hello-leipzig/handler.py # return "Hallo Leipzig"

OpenFaaS - Hands-OnFirst Function - Edit Function

DEMO

# remote computing environment (vm, ...)

~# faas-cli build --help

~# faas-cli build -f ./hello-leipzig.yml

...

~# docker image ls

REPOSITORY TAG IMAGE ID ... SIZE

hello-leipzig latest 2a8b136c00f8 ... 99.5MB

...

OpenFaaS - Hands-OnFirst Function - Build Function

DEMO

# remote computing environment (vm, ...)# !!! ONLY FOR INFORMATION !!!

# deployment to Docker registry# necessary for “distributed environments”

~# faas-cli push --help

OpenFaaS - Hands-OnFirst Function - Push Function

OpenFaaS - Hands-OnFirst Function - Push Function

OpenFaaS - Hands-OnFirst Function - Push Function

# remote computing environment (vm, ...)# !!! ONLY FOR INFORMATION !!!

~# nano hello-leipzig.yml # “aemc/hello-leipzig”

~# docker login

~# faas-cli push -f ./hello-leipzig.yml

~# open https://hub.docker.com/r/aemc # browser

~# docker logout

~# nano hello-leipzig.yml # “hello-leipzig”

~# docker image rm aemc/hello-leipzig:latest

# remote computing environment (vm, ...)

~# faas-cli deploy --help

~# faas-cli deploy -f ./hello-leipzig.yml

Deploying: hello-leipzig.

Deployed. 200 OK.

URL: http://127.0.0.1:8080/function/hello-leipzig

OpenFaaS - Hands-OnFirst Function - Deploy Function

DEMO

# remote computing environment (vm, ...)

~# faas-cli list --verbose

Function Image Invocations Replica

figlet jmkhael/faas-figlet:latest 6 1

hello-leipzig hello-leipzig:latest 0 1

OpenFaaS - Hands-OnFirst Function - Deploy Function

DEMO

# local computing environment (browser, ...)

open http://dws-cluster01-m01.aemc.me:8080

# remote computing environment (vm, ...)~# faas-cli invoke hello-leipzig

Reading from STDIN - hit (Control + D) to stop.

Hallo Leipzig

OpenFaaS - Hands-OnFirst Function - Use Function

DEMO

# remote computing environment (vm, ...)

# Http GET~# curl http://127.0.0.1:8080/function/hello-leipzig~# http -v http://127.0.0.1:8080/function/hello-leipzig

# Http POST

~# curl -d "Hallo" http://127.0.0.1:8080/function/figlet

~# echo "Hallo Leipzig" | \

http -v POST \

http://127.0.0.1:8080/function/figlet \

Content-Type:text/plain; charset=UTF-8

OpenFaaS - Hands-OnFirst Function - Use Function

DEMO

# remote computing environment (vm, ...)

# Call -> Gateway -> faas-swarm

# from url >function/hello-leipzig< to Docker service# >hello-leipzig< using Docker embedded DNS and# L4 loadbalancing (IPVS)

# process >fwatchdog< receives requests and# creates new process based on content of # environment variable >fprocess< (Dockerfile),# watches this process respecting timeouts# and sends response back to caller

OpenFaaS - Hands-OnFirst Function - Background

OpenFaaS - Hands-OnUpdating a Function

# remote computing environment (vm, ...)

~# cd $PRJ_DIR/functions~# faas-cli new --lang python3 hello-astro~# nano hello-astro/handler.py

def handle(req):

"""handle a request to the function

Args:

req (str): request body

"""

return "You said: " + req

OpenFaaS - Hands-OnUpdate - Prepare New Function

DEMO

# remote computing environment (vm, ...)

~# cd $PRJ_DIR/functions~# faas-cli build -f ./hello-astro.yml~# docker image ls

~# faas-cli deploy -f ./hello-astro.yml

# open http://dws-cluster01-m01.aemc.me:8080/ui/

~# echo "Mein Name ist Bond, James Bond" | \

faas-cli invoke hello-astro

OpenFaaS - Hands-OnUpdate - Prepare New Function

DEMO

# remote computing environment (vm, ...)~# nano hello-astro/handler.pyimport requests

import random

def handle(req):

r=requests.get("http://api.open-notify.org/astros.json")

result = r.json()

index = random.randint( 0, len( result[ "people" ]) - 1 )

name = result[ "people" ][ index ][ "name" ]

return name + " is in space"

OpenFaaS - Hands-OnUpdate - Change Function

DEMO

# remote computing environment (vm, ...)

~# nano hello-astro/requirements.txtrequests

~# faas-cli build -f ./hello-astro.yml

~# docker image ls

OpenFaaS - Hands-OnUpdate - Change Function

DEMO

# remote computing environment (vm, ...)

~# faas-cli deploy -f ./hello-astro.yml

Deploying: hello-astro.

Function hello-astro already exists, attempting

rolling-update.

Deployed. 200 OK.

URL: http://127.0.0.1:8080/function/hello-astro

OpenFaaS - Hands-OnUpdate - Change Function

DEMO

# remote computing environment (vm, ...)

# open http://dws-cluster01-m01.aemc.me:8080

~# echo "" | faas-cli invoke hello-astro

~# echo "" | faas-cli invoke hello-astro

~# echo "" | faas-cli invoke hello-astro

# should be different names every time/request

OpenFaaS - Hands-OnUpdate - Change Function

DEMO

# remote computing environment (vm, ...)

~# faas-cli list -v

~# docker image ls

# more / better possibilities coming soon ...

OpenFaaS - Hands-OnUpdate - Knowing What Is Deployed

DEMO

OpenFaaS - Hands-OnTroubleshooting

# remote computing environment (vm, ...)

~# docker service logs --follow --tail 100 hello-astro

~# docker service ps --no-trunc=true hello-astro

~# docker service inspect hello-astro

OpenFaaS - Hands-OnTroubleshooting - Logs, ...

DEMO

# remote computing environment (vm, ...)

~# nano hello-astro.yml

...

functions:

hello-astro:

lang: python3

handler: ./hello-astro

image: hello-astro

environment:

write_debug: true

OpenFaaS - Hands-OnTroubleshooting - Verbose Output

DEMO

# remote computing environment (vm, ...)

~# faas-cli deploy -f ./hello-astro.yml

~# docker service logs --follow --tail 100 hello-astro

OpenFaaS - Hands-OnTroubleshooting - Verbose Output

DEMO

# remote computing environment (vm, ...)# functions - example

~# cd $PRJ_DIR/functions

~# faas-cli new --lang python3 sleep

~# nano sleep.yml

... # use real editor

# environment:

# sleep_duration: 12

# read_timeout: 5

# write_timeout: 5

# exec_timeout: 5

OpenFaaS - Hands-OnTroubleshooting - Timeouts

DEMO

# remote computing environment (vm, ...)# functions - example

~# nano sleep/handler.py

... # use real editor

def handle(req):

sleep_duration=int(os.getenv("sleep_duration", "10"))

print( "Starting to sleep for %d" % sleep_duration )

time.sleep(sleep_duration) # Sleep for seconds

print( "sleep finished" )

return req

OpenFaaS - Hands-OnTroubleshooting - Timeouts

DEMO

# remote computing environment (vm, ...)# functions - example

~# faas-cli build -f ./sleep.yml

~# faas-cli deploy -f ./sleep.yml

~# echo | faas-cli invoke sleep

Server returned unexpected status code: 500 - \

Can't reach service: sleep

OpenFaaS - Hands-OnTroubleshooting - Timeouts

DEMO

# remote computing environment (vm, ...)# functions - example

~# docker service logs sleep

...

... 2018/04/04 19:29:32 Writing lock-file to: /tmp/.lock

... 2018/04/04 19:29:57 Forking fprocess.

... 2018/04/04 19:30:02 Killing process: python3 index.py

# last time difference: 5 seconds

OpenFaaS - Hands-OnTroubleshooting - Timeouts

DEMO

# remote computing environment (vm, ...)# functions - example

~# faas-cli deploy --env sleep_duration=2 -f ./sleep.yml

~# echo | faas-cli invoke sleep

Starting to sleep for 2

sleep finished

OpenFaaS - Hands-OnTroubleshooting - Timeouts

DEMO

# remote computing environment (vm, ...)

# Gateway:

# read_timeout, write_timeout, upstream_timeout

# Function provider:

# read_timeout, write_timeout

~# nano docker-stack.yml

... # use real editor ...

OpenFaaS - Hands-OnTroubleshooting - Timeouts

DEMO

OpenFaaS - Hands-OnDevelop a Function

# local computing environment (vm, ...)

# Linux

# works out of the box

# Win/Mac OS X

# local Docker daemon installation with shared folder

# Docker for Win

# Docker for Mac

OpenFaaS - Hands-OnDevelop a Function

# local computing environment (vm, ...)# Docker for Mac

# separat terminal

# no environment variables for Docker/OpenFaaS set

# function exits already (faas-cli new ...)

cd $PRJ_DIR/functions

docker image build \

-t hello-leipzig \

-f ./build/hello-leipzig/Dockerfile \

./build/hello-leipzig/

OpenFaaS - Hands-OnDevelop a Function

# local computing environment (vm, ...)# Docker for Mac

docker container run --rm -it \

-v $(pwd)/hello-leipzig/:/root/function/ \

-p 8081:8080 \

--name hello-leipzig \

hello-leipzig sh

~ # ls -al /root/function

~ # env | grep -i fprocess

~ # fwatchdog &

OpenFaaS - Hands-OnDevelop a Function

# local computing environment (vm, ...)# Docker for Mac

# new terminal window (same folder, same config)

http localhost:8081

...

# change hello-leipzig/handler.py in editor

http localhost:8081

...

OpenFaaS - Hands-OnDevelop a Function

OpenFaaS - Hands-OnLinux Binary as Function

# remote computing environment (vm, ...)

~# faas-cli new --lang dockerfile sorter

~# nano sorter/Dockerfile

...

[ change ENV fprocess="cat" to ENV fprocess="sort" ]

...

faas-cli build -f ./sorter.yml

faas-cli deploy -f ./sorter.yml

open http://dws-cluster01-m01.aemc.me:8080

OpenFaaS - Hands-OnLinux Binary as Function

DEMO

# remote computing environment (vm, ...)

~# echo -n '

elephant

zebra

horse

ardvark

monkey' | faas-cli invoke sorter

...

OpenFaaS - Hands-OnLinux Binary as Function

DEMO

# remote computing environment (vm, ...)# overwrite environment variable from Dockerfile

# fprocess: "sort" with “env”

# change sorter.yml or … ->

~# faas-cli deploy --env=fprocess=env -f ./sorter.yml

~# faas-cli invoke sorter

OpenFaaS - Hands-OnLinux Binary as Function

DEMO

OpenFaaS - Hands-OnConfiguration

# remote computing environment (vm, ...)# see timeout example “sleep.yml”

# configuration at deployment time

OpenFaaS - Hands-OnConfiguration - Environment Var’s

DEMO

# remote computing environment (vm, ...)# injected/exposed as environment variables

~# faas-cli deploy --name=env \

--env fprocess=env \

--image="functions/alpine:latest" \

--network=func_functions

~# echo "" | faas-cli invoke env \

--header TestHeader=Blah

...

fprocess=env

Http_Testheader=Blah

...

OpenFaaS - Hands-OnConfiguration - Http Headers

DEMO

# remote computing environment (vm, ...)# injected/exposed as environment variables

~# echo "" | faas-cli invoke env \

--query Date="2018-04-06"

...

fprocess=env

Http_Content_Type=text/plain

Http_Method=POST

Http_Query=Date=2018-04-06

...

OpenFaaS - Hands-OnConfiguration - Http Query

DEMO

OpenFaaS - Hands-OnChaining Functions

# remote computing environment (vm, ...)

faas-cli store deploy NodeInfo

# open http://http://dws-cluster01-m01.aemc.me:8080

faas-cli deploy \

--image=functions/markdownrender \

--name=md_renderer

# open http://dws-cluster01-m01.aemc.me:8080

echo "" | faas-cli invoke nodeinfo | \

faas-cli invoke md_renderer

OpenFaaS - Hands-OnChainging Functions - Local

DEMO

# remote computing environment (vm, ...)

faas-cli store deploy SentimentAnalysis

# open //http://dws-cluster01-m01.aemc.me:8080

echo "California is great, it's always sunny there." | \

faas-cli invoke sentimentanalysis | jq

{

"polarity": 0.8,

"sentence_count": 1,

"subjectivity": 0.75

}

OpenFaaS - Hands-OnChainging Functions - Direct

DEMO

# remote computing environment (vm, ...)

faas-cli new --lang ask-function

# ... edit

# ... calls sentimentalanalysis and “uses” the result

faas-cli build -f ask-function.yml

faas-cli deploy -f ask-function.yml

OpenFaaS - Hands-OnChainging Functions - Direct

DEMO

# remote computing environment (vm, ...)

echo "California is great, it's always sunny there." | \

faas-cli invoke sentimentanalysis

That was probably positive

# hint: it’s only a demo function and

# unfortunately a bit unstable ...

OpenFaaS - Hands-OnChainging Functions - Direct

DEMO

OpenFaaS - Hands-OnRoundup

OpenFaaS - Hands-OnRoundup - What Left?

● Asynchronous invocations○ event queuing○ callbacks

● State/Persistence/Storage○ S3, Minio○ ...

● Autoscaling

● OpenFaaS Sample Functions

OpenFaaS - Hands-OnRoundup - What Next?

● Project Documentation● OpenFaaS Sample Functions

OpenFaaS - Hands-OnRoundup

❖ !!!➢ examples➢ are➢ not➢ for➢ production

❖ !!!

OpenFaaS - Hands-OnRoundup

Use Cases● Bots● Skills● ITTT (If This Than This)● Big Data● Deployments

OpenFaaS - Hands-OnRoundup

● OpenFaaS○ for learning and experiments○ ...

● Other FaaS-Frameworks○ Serverless○ Kubeless○ OpenWhisk, ...

● Other Serverless “Products”○ AWS Lambda○ Google Functions○ MS Azure Functions

OpenFaaS - Hands-On

This is the last slide ...

OpenFaaS - Hands-On<Title>

OpenFaaS - Hands-On<Title>

# bla

OpenFaas - Hands-On

# bla

OpenFaas - Hand-On

DEMO

OpenFaaS - Hands-On

top related