build you own serverless cloud€¦ · (command-query-responsibility-segregation)...

151
Build You Own Serverless Cloud Introduction

Upload: others

Post on 22-Jul-2020

17 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Build You Own Serverless Cloud€¦ · (Command-Query-Responsibility-Segregation) Function-as-a-Service Goals reduced costs for development deployment operational costs pay for what

Build You Own Serverless CloudIntroduction

Page 2: Build You Own Serverless Cloud€¦ · (Command-Query-Responsibility-Segregation) Function-as-a-Service Goals reduced costs for development deployment operational costs pay for what

IntroductionWho’s that guy?

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

Agile and Devops infectedDocker enthusiast

[email protected]@berndfischer63

JUG Saxony e.V., Docker Community Dresden

CTO MindApproach GmbH, [email protected]

Page 3: Build You Own Serverless Cloud€¦ · (Command-Query-Responsibility-Segregation) Function-as-a-Service Goals reduced costs for development deployment operational costs pay for what

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

Page 4: Build You Own Serverless Cloud€¦ · (Command-Query-Responsibility-Segregation) Function-as-a-Service Goals reduced costs for development deployment operational costs pay for what

IntroductionWho’s that guy?

Disclaimer ….

Page 5: Build You Own Serverless Cloud€¦ · (Command-Query-Responsibility-Segregation) Function-as-a-Service Goals reduced costs for development deployment operational costs pay for what

IntroductionWho you are?

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

- Used Operating Systems- Knowledge in

- Linux/Bash- Docker (Swarm)- Kubernetes

Page 6: Build You Own Serverless Cloud€¦ · (Command-Query-Responsibility-Segregation) Function-as-a-Service Goals reduced costs for development deployment operational costs pay for what

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

Page 7: Build You Own Serverless Cloud€¦ · (Command-Query-Responsibility-Segregation) Function-as-a-Service Goals reduced costs for development deployment operational costs pay for what

IntroductionCourse Objectives

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

Page 8: Build You Own Serverless Cloud€¦ · (Command-Query-Responsibility-Segregation) Function-as-a-Service Goals reduced costs for development deployment operational costs pay for what

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

Page 9: Build You Own Serverless Cloud€¦ · (Command-Query-Responsibility-Segregation) Function-as-a-Service Goals reduced costs for development deployment operational costs pay for what

# bla

IntroductionSlide: Presenter Demo

Page 10: Build You Own Serverless Cloud€¦ · (Command-Query-Responsibility-Segregation) Function-as-a-Service Goals reduced costs for development deployment operational costs pay for what

# bla

IntroductionSlide: Doing it together

DEMO

Page 11: Build You Own Serverless Cloud€¦ · (Command-Query-Responsibility-Segregation) Function-as-a-Service Goals reduced costs for development deployment operational costs pay for what

IntroductionSlide: Meeting Point ...

Page 12: Build You Own Serverless Cloud€¦ · (Command-Query-Responsibility-Segregation) Function-as-a-Service Goals reduced costs for development deployment operational costs pay for what

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

Page 13: Build You Own Serverless Cloud€¦ · (Command-Query-Responsibility-Segregation) Function-as-a-Service Goals reduced costs for development deployment operational costs pay for what

Introduction

This is the last slide ...

Page 14: Build You Own Serverless Cloud€¦ · (Command-Query-Responsibility-Segregation) Function-as-a-Service Goals reduced costs for development deployment operational costs pay for what

Introduction

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

Page 15: Build You Own Serverless Cloud€¦ · (Command-Query-Responsibility-Segregation) Function-as-a-Service Goals reduced costs for development deployment operational costs pay for what

# bla

Title

Page 16: Build You Own Serverless Cloud€¦ · (Command-Query-Responsibility-Segregation) Function-as-a-Service Goals reduced costs for development deployment operational costs pay for what

# bla

Title

DEMO

Page 17: Build You Own Serverless Cloud€¦ · (Command-Query-Responsibility-Segregation) Function-as-a-Service Goals reduced costs for development deployment operational costs pay for what

Title

Page 18: Build You Own Serverless Cloud€¦ · (Command-Query-Responsibility-Segregation) Function-as-a-Service Goals reduced costs for development deployment operational costs pay for what

Build Own Serverless CloudFunction-as-a-Service

Page 19: Build You Own Serverless Cloud€¦ · (Command-Query-Responsibility-Segregation) Function-as-a-Service Goals reduced costs for development deployment operational costs pay for what

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

Page 20: Build You Own Serverless Cloud€¦ · (Command-Query-Responsibility-Segregation) Function-as-a-Service Goals reduced costs for development deployment operational costs pay for what

Function-as-a-ServiceFrom Pets to Insects

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

Page 21: Build You Own Serverless Cloud€¦ · (Command-Query-Responsibility-Segregation) Function-as-a-Service Goals reduced costs for development deployment operational costs pay for what

Function-as-a-ServiceFrom Pets to Insects

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

Page 22: Build You Own Serverless Cloud€¦ · (Command-Query-Responsibility-Segregation) Function-as-a-Service Goals reduced costs for development deployment operational costs pay for what

Function-as-a-ServiceSoftware Architecture

● Microservice○ How big is “micro”?

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

(Command-Query-Responsibility-Segregation)

Page 23: Build You Own Serverless Cloud€¦ · (Command-Query-Responsibility-Segregation) Function-as-a-Service Goals reduced costs for development deployment operational costs pay for what

Function-as-a-ServiceGoals

● reduced costs for○ development○ deployment○ operational costs

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

○ development○ deployment○ time-to-market

Page 24: Build You Own Serverless Cloud€¦ · (Command-Query-Responsibility-Segregation) Function-as-a-Service Goals reduced costs for development deployment operational costs pay for what

Function-as-a-ServiceDrawbacks

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

Page 25: Build You Own Serverless Cloud€¦ · (Command-Query-Responsibility-Segregation) Function-as-a-Service Goals reduced costs for development deployment operational costs pay for what

Function-as-a-Service

This is the last slide ...

Page 26: Build You Own Serverless Cloud€¦ · (Command-Query-Responsibility-Segregation) Function-as-a-Service Goals reduced costs for development deployment operational costs pay for what

# bla

Introduction

Page 27: Build You Own Serverless Cloud€¦ · (Command-Query-Responsibility-Segregation) Function-as-a-Service Goals reduced costs for development deployment operational costs pay for what

# bla

DEMO

Page 28: Build You Own Serverless Cloud€¦ · (Command-Query-Responsibility-Segregation) Function-as-a-Service Goals reduced costs for development deployment operational costs pay for what

Build OwnServerless CloudWhy Container?

Page 29: Build You Own Serverless Cloud€¦ · (Command-Query-Responsibility-Segregation) Function-as-a-Service Goals reduced costs for development deployment operational costs pay for what

Why Container?Fokus

commercial software development

Page 30: Build You Own Serverless Cloud€¦ · (Command-Query-Responsibility-Segregation) Function-as-a-Service Goals reduced costs for development deployment operational costs pay for what

Why Container?Parts of Software Creation

❏ Development❏ write code

❏ Delivery❏ enable usage for “end user”

❏ Operation❏ keep it running

Page 31: Build You Own Serverless Cloud€¦ · (Command-Query-Responsibility-Segregation) Function-as-a-Service Goals reduced costs for development deployment operational costs pay for what

Why Container?Characteristics

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

Page 32: Build You Own Serverless Cloud€¦ · (Command-Query-Responsibility-Segregation) Function-as-a-Service Goals reduced costs for development deployment operational costs pay for what

Why Container?Characteristics

Make it reproducible

by myself

Page 33: Build You Own Serverless Cloud€¦ · (Command-Query-Responsibility-Segregation) Function-as-a-Service Goals reduced costs for development deployment operational costs pay for what

Why Container?Characteristics

Automate almost everything

Continuous Delivery, 2010 [HuFa01]

Page 34: Build You Own Serverless Cloud€¦ · (Command-Query-Responsibility-Segregation) Function-as-a-Service Goals reduced costs for development deployment operational costs pay for what

Why Container?Characteristics

Continuous Environment

by myself

Page 35: Build You Own Serverless Cloud€¦ · (Command-Query-Responsibility-Segregation) Function-as-a-Service Goals reduced costs for development deployment operational costs pay for what

Why Container?Culture ...

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

Page 36: Build You Own Serverless Cloud€¦ · (Command-Query-Responsibility-Segregation) Function-as-a-Service Goals reduced costs for development deployment operational costs pay for what

Why Container?Culture ...

DevOpsAndrew Clay Shafer, Patrick Debois, Agile Conference 2008

DevOpsDays Ghent 2009

Page 37: Build You Own Serverless Cloud€¦ · (Command-Query-Responsibility-Segregation) Function-as-a-Service Goals reduced costs for development deployment operational costs pay for what

Why Container?Evolving Architecture Concepts ...

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

Page 38: Build You Own Serverless Cloud€¦ · (Command-Query-Responsibility-Segregation) Function-as-a-Service Goals reduced costs for development deployment operational costs pay for what

Why Container?Evolving Architecture Concepts ...

● single/non-distributed applications● distributed applications

Page 39: Build You Own Serverless Cloud€¦ · (Command-Query-Responsibility-Segregation) Function-as-a-Service Goals reduced costs for development deployment operational costs pay for what

Why Container?Evolving Infrastructure Concepts ...

Page 40: Build You Own Serverless Cloud€¦ · (Command-Query-Responsibility-Segregation) Function-as-a-Service Goals reduced costs for development deployment operational costs pay for what

Why Container?Evolving Infrastructure Concepts ...

Page 41: Build You Own Serverless Cloud€¦ · (Command-Query-Responsibility-Segregation) Function-as-a-Service Goals reduced costs for development deployment operational costs pay for what

Why Container?App Packaging and Distribution

Page 42: Build You Own Serverless Cloud€¦ · (Command-Query-Responsibility-Segregation) Function-as-a-Service Goals reduced costs for development deployment operational costs pay for what

Why Container?

This is the last slide ...

Page 43: Build You Own Serverless Cloud€¦ · (Command-Query-Responsibility-Segregation) Function-as-a-Service Goals reduced costs for development deployment operational costs pay for what

Build Own Serverless CloudSoftware Container (Docker)

Page 44: Build You Own Serverless Cloud€¦ · (Command-Query-Responsibility-Segregation) Function-as-a-Service Goals reduced costs for development deployment operational costs pay for what

Container - DockerBuilding Blocks

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

Page 45: Build You Own Serverless Cloud€¦ · (Command-Query-Responsibility-Segregation) Function-as-a-Service Goals reduced costs for development deployment operational costs pay for what

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

Page 46: Build You Own Serverless Cloud€¦ · (Command-Query-Responsibility-Segregation) Function-as-a-Service Goals reduced costs for development deployment operational costs pay for what

Container - DockerDistribution - Remote I

DockerContainer/home

DockerClient

DockerDaemon

Page 47: Build You Own Serverless Cloud€¦ · (Command-Query-Responsibility-Segregation) Function-as-a-Service Goals reduced costs for development deployment operational costs pay for what

Container - DockerDistribution - Remote II

DockerContainer/home

DockerClient

DockerDaemon

SSHClient

Page 48: Build You Own Serverless Cloud€¦ · (Command-Query-Responsibility-Segregation) Function-as-a-Service Goals reduced costs for development deployment operational costs pay for what

Container - DockerDistribution - Local I

Virtual Machine (Ubuntu)

DockerContainer

Host-OS

/home

DockerClient

DockerDaemon

Page 49: Build You Own Serverless Cloud€¦ · (Command-Query-Responsibility-Segregation) Function-as-a-Service Goals reduced costs for development deployment operational costs pay for what

Container - DockerDistribution - Local II

Virtual Machine (Linux)

DockerContainer

Mac OS XWindows

/Users /Users

DockerClient

DockerDaemon

Page 50: Build You Own Serverless Cloud€¦ · (Command-Query-Responsibility-Segregation) Function-as-a-Service Goals reduced costs for development deployment operational costs pay for what

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

Page 51: Build You Own Serverless Cloud€¦ · (Command-Query-Responsibility-Segregation) Function-as-a-Service Goals reduced costs for development deployment operational costs pay for what

Container - DockerPlay-With-Docker

https://play-with-docker.com

Page 52: Build You Own Serverless Cloud€¦ · (Command-Query-Responsibility-Segregation) Function-as-a-Service Goals reduced costs for development deployment operational costs pay for what

Container - DockerComponents

Page 53: Build You Own Serverless Cloud€¦ · (Command-Query-Responsibility-Segregation) Function-as-a-Service Goals reduced costs for development deployment operational costs pay for what

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

Page 54: Build You Own Serverless Cloud€¦ · (Command-Query-Responsibility-Segregation) Function-as-a-Service Goals reduced costs for development deployment operational costs pay for what

Container - DockerComponents - Docker Image

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

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

Page 55: Build You Own Serverless Cloud€¦ · (Command-Query-Responsibility-Segregation) Function-as-a-Service Goals reduced costs for development deployment operational costs pay for what

Container - DockerComponents - Docker Images

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

Page 56: Build You Own Serverless Cloud€¦ · (Command-Query-Responsibility-Segregation) Function-as-a-Service Goals reduced costs for development deployment operational costs pay for what

# Docker CLI

docker commit

docker image build -f <Dockerfile>

Container - DockerComponents - Docker Images

Page 57: Build You Own Serverless Cloud€¦ · (Command-Query-Responsibility-Segregation) Function-as-a-Service Goals reduced costs for development deployment operational costs pay for what

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

Page 58: Build You Own Serverless Cloud€¦ · (Command-Query-Responsibility-Segregation) Function-as-a-Service Goals reduced costs for development deployment operational costs pay for what

# Docker CLI

docker container

create

start

stop

run

rm

exec

...

Container - DockerComponents - Container

Page 59: Build You Own Serverless Cloud€¦ · (Command-Query-Responsibility-Segregation) Function-as-a-Service Goals reduced costs for development deployment operational costs pay for what

# 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

Page 60: Build You Own Serverless Cloud€¦ · (Command-Query-Responsibility-Segregation) Function-as-a-Service Goals reduced costs for development deployment operational costs pay for what

# swarm management is done via master only

# connected to a manger

docker service

create

logs

ls

ps

rm

...

Container - DockerComponents - Services

DEMO

Page 61: Build You Own Serverless Cloud€¦ · (Command-Query-Responsibility-Segregation) Function-as-a-Service Goals reduced costs for development deployment operational costs pay for what

# 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

Page 62: Build You Own Serverless Cloud€¦ · (Command-Query-Responsibility-Segregation) Function-as-a-Service Goals reduced costs for development deployment operational costs pay for what

Container - Docker

This is the last slide ...

Page 63: Build You Own Serverless Cloud€¦ · (Command-Query-Responsibility-Segregation) Function-as-a-Service Goals reduced costs for development deployment operational costs pay for what

Container - Docker<Title>

Page 64: Build You Own Serverless Cloud€¦ · (Command-Query-Responsibility-Segregation) Function-as-a-Service Goals reduced costs for development deployment operational costs pay for what

# bla

Introduction

Page 65: Build You Own Serverless Cloud€¦ · (Command-Query-Responsibility-Segregation) Function-as-a-Service Goals reduced costs for development deployment operational costs pay for what

# bla

DEMO

Page 66: Build You Own Serverless Cloud€¦ · (Command-Query-Responsibility-Segregation) Function-as-a-Service Goals reduced costs for development deployment operational costs pay for what

Build Own Serverless CloudOpenFaas - Hands-On

Page 67: Build You Own Serverless Cloud€¦ · (Command-Query-Responsibility-Segregation) Function-as-a-Service Goals reduced costs for development deployment operational costs pay for what

OpenFaaS - Hands-OnIntroduction

Page 71: Build You Own Serverless Cloud€¦ · (Command-Query-Responsibility-Segregation) Function-as-a-Service Goals reduced costs for development deployment operational costs pay for what

OpenFaaS - Hands-OnInstallation

Page 72: Build You Own Serverless Cloud€¦ · (Command-Query-Responsibility-Segregation) Function-as-a-Service Goals reduced costs for development deployment operational costs pay for what

OpenFaaS - Hands-OnInstallation

DockerContainer/home

DockerClient

DockerDaemon

SSHClient

Page 73: Build You Own Serverless Cloud€¦ · (Command-Query-Responsibility-Segregation) Function-as-a-Service Goals reduced costs for development deployment operational costs pay for what

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), ...

Page 74: Build You Own Serverless Cloud€¦ · (Command-Query-Responsibility-Segregation) Function-as-a-Service Goals reduced costs for development deployment operational costs pay for what

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

cd ~mkdir -p projects/demo-openfaas

cd projects/demo-openfaasPRJ_DIR=$(pwd)

OpenFaaS - Hands-OnInstallation

DEMO

Page 75: Build You Own Serverless Cloud€¦ · (Command-Query-Responsibility-Segregation) Function-as-a-Service Goals reduced costs for development deployment operational costs pay for what

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

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

OpenFaaS - Hands-OnInstallation

DEMO

Page 76: Build You Own Serverless Cloud€¦ · (Command-Query-Responsibility-Segregation) Function-as-a-Service Goals reduced costs for development deployment operational costs pay for what

# 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

Page 77: Build You Own Serverless Cloud€¦ · (Command-Query-Responsibility-Segregation) Function-as-a-Service Goals reduced costs for development deployment operational costs pay for what

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

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

OpenFaaS - Hands-OnInstallation

DEMO

Page 78: Build You Own Serverless Cloud€¦ · (Command-Query-Responsibility-Segregation) Function-as-a-Service Goals reduced costs for development deployment operational costs pay for what

# 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

Page 79: Build You Own Serverless Cloud€¦ · (Command-Query-Responsibility-Segregation) Function-as-a-Service Goals reduced costs for development deployment operational costs pay for what

# 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

Page 80: Build You Own Serverless Cloud€¦ · (Command-Query-Responsibility-Segregation) Function-as-a-Service Goals reduced costs for development deployment operational costs pay for what

# 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

Page 81: Build You Own Serverless Cloud€¦ · (Command-Query-Responsibility-Segregation) Function-as-a-Service Goals reduced costs for development deployment operational costs pay for what

# 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

Page 82: Build You Own Serverless Cloud€¦ · (Command-Query-Responsibility-Segregation) Function-as-a-Service Goals reduced costs for development deployment operational costs pay for what

OpenFaaS - Hands-OnUser Interface

Page 83: Build You Own Serverless Cloud€¦ · (Command-Query-Responsibility-Segregation) Function-as-a-Service Goals reduced costs for development deployment operational costs pay for what

# 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

Page 84: Build You Own Serverless Cloud€¦ · (Command-Query-Responsibility-Segregation) Function-as-a-Service Goals reduced costs for development deployment operational costs pay for what

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

# first example# deploy new function# figlet

~# docker service ls

OpenFaaS - Hands-OnUser Interface

DEMO

Page 85: Build You Own Serverless Cloud€¦ · (Command-Query-Responsibility-Segregation) Function-as-a-Service Goals reduced costs for development deployment operational costs pay for what

OpenFaaS - Hands-OnCommand Line Interface

Page 86: Build You Own Serverless Cloud€¦ · (Command-Query-Responsibility-Segregation) Function-as-a-Service Goals reduced costs for development deployment operational costs pay for what

# 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

Page 87: Build You Own Serverless Cloud€¦ · (Command-Query-Responsibility-Segregation) Function-as-a-Service Goals reduced costs for development deployment operational costs pay for what

# 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

Page 88: Build You Own Serverless Cloud€¦ · (Command-Query-Responsibility-Segregation) Function-as-a-Service Goals reduced costs for development deployment operational costs pay for what

OpenFaaS - Hands-OnFirst Function

Page 89: Build You Own Serverless Cloud€¦ · (Command-Query-Responsibility-Segregation) Function-as-a-Service Goals reduced costs for development deployment operational costs pay for what

# 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

Page 90: Build You Own Serverless Cloud€¦ · (Command-Query-Responsibility-Segregation) Function-as-a-Service Goals reduced costs for development deployment operational costs pay for what

# 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

Page 91: Build You Own Serverless Cloud€¦ · (Command-Query-Responsibility-Segregation) Function-as-a-Service Goals reduced costs for development deployment operational costs pay for what

# 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

Page 92: Build You Own Serverless Cloud€¦ · (Command-Query-Responsibility-Segregation) Function-as-a-Service Goals reduced costs for development deployment operational costs pay for what

# 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

Page 93: Build You Own Serverless Cloud€¦ · (Command-Query-Responsibility-Segregation) Function-as-a-Service Goals reduced costs for development deployment operational costs pay for what

# 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

Page 94: Build You Own Serverless Cloud€¦ · (Command-Query-Responsibility-Segregation) Function-as-a-Service Goals reduced costs for development deployment operational costs pay for what

# 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

Page 95: Build You Own Serverless Cloud€¦ · (Command-Query-Responsibility-Segregation) Function-as-a-Service Goals reduced costs for development deployment operational costs pay for what

# 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

Page 96: Build You Own Serverless Cloud€¦ · (Command-Query-Responsibility-Segregation) Function-as-a-Service Goals reduced costs for development deployment operational costs pay for what

# 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

Page 97: Build You Own Serverless Cloud€¦ · (Command-Query-Responsibility-Segregation) Function-as-a-Service Goals reduced costs for development deployment operational costs pay for what

OpenFaaS - Hands-OnFirst Function - Push Function

Page 98: Build You Own Serverless Cloud€¦ · (Command-Query-Responsibility-Segregation) Function-as-a-Service Goals reduced costs for development deployment operational costs pay for what

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

Page 99: Build You Own Serverless Cloud€¦ · (Command-Query-Responsibility-Segregation) Function-as-a-Service Goals reduced costs for development deployment operational costs pay for what

# 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

Page 100: Build You Own Serverless Cloud€¦ · (Command-Query-Responsibility-Segregation) Function-as-a-Service Goals reduced costs for development deployment operational costs pay for what

# 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

Page 101: Build You Own Serverless Cloud€¦ · (Command-Query-Responsibility-Segregation) Function-as-a-Service Goals reduced costs for development deployment operational costs pay for what

# 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

Page 102: Build You Own Serverless Cloud€¦ · (Command-Query-Responsibility-Segregation) Function-as-a-Service Goals reduced costs for development deployment operational costs pay for what

# 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

Page 103: Build You Own Serverless Cloud€¦ · (Command-Query-Responsibility-Segregation) Function-as-a-Service Goals reduced costs for development deployment operational costs pay for what

# 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

Page 104: Build You Own Serverless Cloud€¦ · (Command-Query-Responsibility-Segregation) Function-as-a-Service Goals reduced costs for development deployment operational costs pay for what

OpenFaaS - Hands-OnUpdating a Function

Page 105: Build You Own Serverless Cloud€¦ · (Command-Query-Responsibility-Segregation) Function-as-a-Service Goals reduced costs for development deployment operational costs pay for what

# 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

Page 106: Build You Own Serverless Cloud€¦ · (Command-Query-Responsibility-Segregation) Function-as-a-Service Goals reduced costs for development deployment operational costs pay for what

# 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

Page 107: Build You Own Serverless Cloud€¦ · (Command-Query-Responsibility-Segregation) Function-as-a-Service Goals reduced costs for development deployment operational costs pay for what

# 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

Page 108: Build You Own Serverless Cloud€¦ · (Command-Query-Responsibility-Segregation) Function-as-a-Service Goals reduced costs for development deployment operational costs pay for what

# 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

Page 109: Build You Own Serverless Cloud€¦ · (Command-Query-Responsibility-Segregation) Function-as-a-Service Goals reduced costs for development deployment operational costs pay for what

# 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

Page 110: Build You Own Serverless Cloud€¦ · (Command-Query-Responsibility-Segregation) Function-as-a-Service Goals reduced costs for development deployment operational costs pay for what

# 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

Page 111: Build You Own Serverless Cloud€¦ · (Command-Query-Responsibility-Segregation) Function-as-a-Service Goals reduced costs for development deployment operational costs pay for what

# remote computing environment (vm, ...)

~# faas-cli list -v

~# docker image ls

# more / better possibilities coming soon ...

OpenFaaS - Hands-OnUpdate - Knowing What Is Deployed

DEMO

Page 112: Build You Own Serverless Cloud€¦ · (Command-Query-Responsibility-Segregation) Function-as-a-Service Goals reduced costs for development deployment operational costs pay for what

OpenFaaS - Hands-OnTroubleshooting

Page 113: Build You Own Serverless Cloud€¦ · (Command-Query-Responsibility-Segregation) Function-as-a-Service Goals reduced costs for development deployment operational costs pay for what

# 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

Page 114: Build You Own Serverless Cloud€¦ · (Command-Query-Responsibility-Segregation) Function-as-a-Service Goals reduced costs for development deployment operational costs pay for what

# 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

Page 115: Build You Own Serverless Cloud€¦ · (Command-Query-Responsibility-Segregation) Function-as-a-Service Goals reduced costs for development deployment operational costs pay for what

# 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

Page 116: Build You Own Serverless Cloud€¦ · (Command-Query-Responsibility-Segregation) Function-as-a-Service Goals reduced costs for development deployment operational costs pay for what

# 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

Page 117: Build You Own Serverless Cloud€¦ · (Command-Query-Responsibility-Segregation) Function-as-a-Service Goals reduced costs for development deployment operational costs pay for what

# 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

Page 118: Build You Own Serverless Cloud€¦ · (Command-Query-Responsibility-Segregation) Function-as-a-Service Goals reduced costs for development deployment operational costs pay for what

# 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

Page 119: Build You Own Serverless Cloud€¦ · (Command-Query-Responsibility-Segregation) Function-as-a-Service Goals reduced costs for development deployment operational costs pay for what

# 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

Page 120: Build You Own Serverless Cloud€¦ · (Command-Query-Responsibility-Segregation) Function-as-a-Service Goals reduced costs for development deployment operational costs pay for what

# 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

Page 121: Build You Own Serverless Cloud€¦ · (Command-Query-Responsibility-Segregation) Function-as-a-Service Goals reduced costs for development deployment operational costs pay for what

# 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

Page 122: Build You Own Serverless Cloud€¦ · (Command-Query-Responsibility-Segregation) Function-as-a-Service Goals reduced costs for development deployment operational costs pay for what

OpenFaaS - Hands-OnDevelop a Function

Page 123: Build You Own Serverless Cloud€¦ · (Command-Query-Responsibility-Segregation) Function-as-a-Service Goals reduced costs for development deployment operational costs pay for what

# 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

Page 124: Build You Own Serverless Cloud€¦ · (Command-Query-Responsibility-Segregation) Function-as-a-Service Goals reduced costs for development deployment operational costs pay for what

# 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

Page 125: Build You Own Serverless Cloud€¦ · (Command-Query-Responsibility-Segregation) Function-as-a-Service Goals reduced costs for development deployment operational costs pay for what

# 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

Page 126: Build You Own Serverless Cloud€¦ · (Command-Query-Responsibility-Segregation) Function-as-a-Service Goals reduced costs for development deployment operational costs pay for what

# 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

Page 127: Build You Own Serverless Cloud€¦ · (Command-Query-Responsibility-Segregation) Function-as-a-Service Goals reduced costs for development deployment operational costs pay for what

OpenFaaS - Hands-OnLinux Binary as Function

Page 128: Build You Own Serverless Cloud€¦ · (Command-Query-Responsibility-Segregation) Function-as-a-Service Goals reduced costs for development deployment operational costs pay for what

# 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

Page 129: Build You Own Serverless Cloud€¦ · (Command-Query-Responsibility-Segregation) Function-as-a-Service Goals reduced costs for development deployment operational costs pay for what

# remote computing environment (vm, ...)

~# echo -n '

elephant

zebra

horse

ardvark

monkey' | faas-cli invoke sorter

...

OpenFaaS - Hands-OnLinux Binary as Function

DEMO

Page 130: Build You Own Serverless Cloud€¦ · (Command-Query-Responsibility-Segregation) Function-as-a-Service Goals reduced costs for development deployment operational costs pay for what

# 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

Page 131: Build You Own Serverless Cloud€¦ · (Command-Query-Responsibility-Segregation) Function-as-a-Service Goals reduced costs for development deployment operational costs pay for what

OpenFaaS - Hands-OnConfiguration

Page 132: Build You Own Serverless Cloud€¦ · (Command-Query-Responsibility-Segregation) Function-as-a-Service Goals reduced costs for development deployment operational costs pay for what

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

# configuration at deployment time

OpenFaaS - Hands-OnConfiguration - Environment Var’s

DEMO

Page 133: Build You Own Serverless Cloud€¦ · (Command-Query-Responsibility-Segregation) Function-as-a-Service Goals reduced costs for development deployment operational costs pay for what

# 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

Page 134: Build You Own Serverless Cloud€¦ · (Command-Query-Responsibility-Segregation) Function-as-a-Service Goals reduced costs for development deployment operational costs pay for what

# 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

Page 135: Build You Own Serverless Cloud€¦ · (Command-Query-Responsibility-Segregation) Function-as-a-Service Goals reduced costs for development deployment operational costs pay for what

OpenFaaS - Hands-OnChaining Functions

Page 136: Build You Own Serverless Cloud€¦ · (Command-Query-Responsibility-Segregation) Function-as-a-Service Goals reduced costs for development deployment operational costs pay for what

# 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

Page 137: Build You Own Serverless Cloud€¦ · (Command-Query-Responsibility-Segregation) Function-as-a-Service Goals reduced costs for development deployment operational costs pay for what

# 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

Page 138: Build You Own Serverless Cloud€¦ · (Command-Query-Responsibility-Segregation) Function-as-a-Service Goals reduced costs for development deployment operational costs pay for what

# 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

Page 139: Build You Own Serverless Cloud€¦ · (Command-Query-Responsibility-Segregation) Function-as-a-Service Goals reduced costs for development deployment operational costs pay for what

# 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

Page 140: Build You Own Serverless Cloud€¦ · (Command-Query-Responsibility-Segregation) Function-as-a-Service Goals reduced costs for development deployment operational costs pay for what

OpenFaaS - Hands-OnRoundup

Page 141: Build You Own Serverless Cloud€¦ · (Command-Query-Responsibility-Segregation) Function-as-a-Service Goals reduced costs for development deployment operational costs pay for what

OpenFaaS - Hands-OnRoundup - What Left?

● Asynchronous invocations○ event queuing○ callbacks

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

● Autoscaling

● OpenFaaS Sample Functions

Page 142: Build You Own Serverless Cloud€¦ · (Command-Query-Responsibility-Segregation) Function-as-a-Service Goals reduced costs for development deployment operational costs pay for what

OpenFaaS - Hands-OnRoundup - What Next?

● Project Documentation● OpenFaaS Sample Functions

Page 143: Build You Own Serverless Cloud€¦ · (Command-Query-Responsibility-Segregation) Function-as-a-Service Goals reduced costs for development deployment operational costs pay for what

OpenFaaS - Hands-OnRoundup

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

❖ !!!

Page 144: Build You Own Serverless Cloud€¦ · (Command-Query-Responsibility-Segregation) Function-as-a-Service Goals reduced costs for development deployment operational costs pay for what

OpenFaaS - Hands-OnRoundup

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

Page 145: Build You Own Serverless Cloud€¦ · (Command-Query-Responsibility-Segregation) Function-as-a-Service Goals reduced costs for development deployment operational costs pay for what

OpenFaaS - Hands-OnRoundup

● OpenFaaS○ for learning and experiments○ ...

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

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

Page 146: Build You Own Serverless Cloud€¦ · (Command-Query-Responsibility-Segregation) Function-as-a-Service Goals reduced costs for development deployment operational costs pay for what

OpenFaaS - Hands-On

This is the last slide ...

Page 147: Build You Own Serverless Cloud€¦ · (Command-Query-Responsibility-Segregation) Function-as-a-Service Goals reduced costs for development deployment operational costs pay for what

OpenFaaS - Hands-On<Title>

Page 148: Build You Own Serverless Cloud€¦ · (Command-Query-Responsibility-Segregation) Function-as-a-Service Goals reduced costs for development deployment operational costs pay for what

OpenFaaS - Hands-On<Title>

Page 149: Build You Own Serverless Cloud€¦ · (Command-Query-Responsibility-Segregation) Function-as-a-Service Goals reduced costs for development deployment operational costs pay for what

# bla

OpenFaas - Hands-On

Page 150: Build You Own Serverless Cloud€¦ · (Command-Query-Responsibility-Segregation) Function-as-a-Service Goals reduced costs for development deployment operational costs pay for what

# bla

OpenFaas - Hand-On

DEMO

Page 151: Build You Own Serverless Cloud€¦ · (Command-Query-Responsibility-Segregation) Function-as-a-Service Goals reduced costs for development deployment operational costs pay for what

OpenFaaS - Hands-On