Code Monkey home page Code Monkey logo

workshop's Introduction

The openfaas-workshop was written in 2017/2018, however more appropriate and recent materials now exist:

openfaas-workshop

This is a self-paced workshop for learning how to build, deploy and run serverless functions with OpenFaaS.

In this workshop you begin by deploying OpenFaaS to your laptop or a remote cluster with Docker for Mac or Windows. You will then kick the tires with the OpenFaaS UI, CLI and Function Store. After building, deploying an invoking your own Serverless Functions in Python you'll go on to cover topics such as: managing dependencies with pip, dealing with API tokens through secure secrets, monitoring functions with Prometheus, invoking functions asynchronously and chaining functions together to create applications. The labs culminate by having you create your very own GitHub bot which can respond to issues automatically. The same method could be applied by connecting to online event-streams through IFTTT.com - this will enable you to build bots, auto-responders and integrations with social media and IoT devices.

Finally the labs cover more advanced topics and give suggestions for further learning.

Translations

Learn for free, show your appreciation as a GitHub Sponsor

OpenFaaS along with these materials are provided for free and require time and effort to maintain.

Requirements:

We walk through how to install these requirements in Lab 1. Please do Lab 1 before you attend an instructor-led workshop.

  • Functions will be written in Python, so prior programming or scripting experience is preferred
  • Install the recommended code-editor / IDE VSCode
  • For Windows install Git Bash
  • Preferred OS: MacOS, Windows 10 Pro/Enterprise, Ubuntu Linux

Docker:

  • Docker CE for Mac/Windows Edge edition
  • Docker CE for Linux

Note: As a last resort if you have an incompatible PC you can run the workshop on https://labs.play-with-docker.com/.

Instructor-led workshops

If you're taking an instructor-led workshops then a link will be shared to join the OpenFaaS Slack community. Use the designated channel for the workshop to discuss comments, questions and suggestions.

Pick your track

In Lab 1 you will pick your track and then throughout the labs look out for any special commands needed for the container orchestrator for your track.

Kubernetes

You can also learn about Serverless on Kubernetes using OpenFaaS.

The recommendation from the OpenFaaS community is that you run Kubernetes in production, but all the knowledge you can is transferrable and functions do not have to be rebuilt.

  • Install pre-requisites
  • Set up a single-node cluster with Kubernetes
  • Docker Hub account
  • OpenFaaS CLI
  • Deploy OpenFaaS
  • Use the UI Portal
  • Deploy via the Function Store
  • Learn about the CLI
  • Find metrics with Prometheus
  • Scaffold or generate a new function
  • Build the astronaut-finder function
  • Add dependencies with pip
  • Troubleshooting: find the container's logs
  • Troubleshooting: verbose output with write_debug
  • Use custom and third-party language templates
  • Discover community templates using the Template Store

Build issue-bot - an auto-responder for GitHub Issues

  • Get a GitHub account
  • Set up a tunnel with ngrok
  • Create an webhook receiver issue-bot
  • Receive webhooks from GitHub
  • Deploy SentimentAnalysis function
  • Apply labels via the GitHub API
  • Complete the function
  • Generate and return basic HTML from a function
  • Read and return a static HTML file from disk
  • Collaborate with other functions
  • Call a function synchronously vs asynchronously
  • View the queue-worker's logs
  • Use an X-Callback-Url with requestbin and ngrok
  • Adjust timeouts with read_timeout
  • Accommodate longer running functions
  • See auto-scaling in action
    • Some insights on min and max replicas
    • Discover and visit local Prometheus
    • Execute and Prometheus query
    • Invoke a function using curl
    • Observe auto-scaling kicking in
  • Adapt issue-bot to use a secret
    • Create a Kubernetes secret with faas-cli
    • Access the secret within the function
  • Apply trust to functions using HMAC

You can start with the first lab Lab 1.

Tear down / Clear up

You can find how to stop and remove OpenFaaS here

Next steps

If you're in an instructor-led workshop and have finished the labs you may want to go back through the labs and edit/alter the code and values or carry out some of your own experiments.

Here are some ideas for follow-on tasks / topics:

OpenFaaS Cloud

Try the multi-user, managed experience of OpenFaaS - either on the Community Cluster, or by hosting your own OpenFaaS Cloud.

TLS

CI/CD

Setup Jenkins, Google Cloud Build or GitLab and build and deploy your own functions using the OpenFaaS CLI:

Storage / databases

Instrumentation / monitoring

Additional blog posts and tutorials

Appendix

The appendix contains some additional content.

Acknowledgements

Thanks to @iyovcheva, @BurtonR, @johnmccabe, @laurentgrangeau, @stefanprodan, @kenfdev, @templum & @rgee0 for contributing to, testing and translating the labs.

workshop's People

Contributors

ah-f3 avatar alexellis avatar burtonr avatar christiaanpauw avatar codegold79 avatar ewilde avatar ivanayov avatar jonasrosland avatar kadern0 avatar kakakakakku avatar kenfdev avatar kfukuyama avatar laurentgrangeau avatar levlas avatar magnuswahlstrand avatar martinbeentjes avatar martindekov avatar psyked avatar rgee0 avatar sergii4 avatar stefanprodan avatar templum avatar toshi0607 avatar tullo avatar viveksyngh avatar waterdrips avatar yankeexe 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  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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

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

workshop's Issues

Lab 5 faas-cli command typo

Type for faas-cli login flag --username not --user

Fix

Replace

  • Now log in: echo $PASSWORD | faas-cli login -g http://fuh83fhfj.ngrok.io --user=admin --password-stdin

with

  • Now log in: echo $PASSWORD | faas-cli login -g http://fuh83fhfj.ngrok.io --username=admin --password-stdin

Question about orchestrator

Hi all,
I'm new to OpenFaaS and was trying to write a scheduler which chooses to run a function on the sleeping container or a running container and compare the trade offs.
As far as I understand OpenFaas always keeps one container in running state to reduce the warmup time.
Is it possible to change the code for the orchestrator to choose a sleeping or running container?

Thanks

The "gateway" hostname is not resolved

I am following the workshop where-n we invoke the sentiment analysis function from within a python function using an HTTP GET request. The format of the URL for the GET request is:

http://gateway:8080/function/sentimentanalysis

When I deploy this function to my GKE cluster and invoke it, I get the following Python stack trace:

Traceback (most recent call last): File "index.py", line 15, in <module> ret = handler.handle(st) File "/home/app/function/handler.py", line 11, in handle r = requests.get(SENTIMENT_ANALYSIS_FUNCTION, data=test_sentence) File "/home/app/.local/lib/python2.7/site-packages/requests/api.py", line 72, in get return request('get', url, params=params, **kwargs) File "/home/app/.local/lib/python2.7/site-packages/requests/api.py", line 58, in request return session.request(method=method, url=url, **kwargs) File "/home/app/.local/lib/python2.7/site-packages/requests/sessions.py", line 512, in request resp = self.send(prep, **send_kwargs) File "/home/app/.local/lib/python2.7/site-packages/requests/sessions.py", line 622, in send r = adapter.send(request, **kwargs) File "/home/app/.local/lib/python2.7/site-packages/requests/adapters.py", line 513, in send raise ConnectionError(e, request=request) requests.exceptions.ConnectionError: HTTPSConnectionPool(host='gateway', port=8080): Max retries exceeded with url: /function/sentimentanalysis (Caused by NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x7f39b73aa9d0>:Failed to establish a new connection: [Errno -2] Name does not resolve',))

I checked the Pod's /etc/hosts and could not find a DNS entry for gateway that points to the correct Gateway. Additionally, /etc/resolv.conf does not give me much information either ( I do not think that currently this is relevant to the issue I am facing)

Should the Pod getting created automatically contain the DNS entry for "gateway" to point to the OpenFaas gateway?

Add more detail around the logging in action to Lab 1a

A recent tread on Slack highlighted that the Swarm version of Lab 1 carries less detail than that of 1b in terms of guiding users through the login process, which led to confusion for the new user.

Proposal is that the equivalent to the section at Lab1b login be added to 1a.

Lab: Show HTML returned from a function

This task is for a new lab for the workshop. The aim is to show two things: how to set a content_type and how to return HTML from a function.

A function can write HTML in Python easily by setting content_type: text/html in the environment section of the YAML file then returning the text needed for the page.

Content:

  • Show how to read a static HTML file from disk and return it
  • Show how to read the query string and return two different files i.e. action=list/new
  • Show how to generate some basic HTML in a function and return that

This is a Node.js function which gives HTML but the approach is similar in Python: https://github.com/alexellis/html-function/blob/master/make-html/handler.js

Lab 7 - queue-worker gave basic auth warning

During the long-task example,

echo -n "" | faas-cli invoke long-task --gateway 127.0.0.1:31112 --async

When tailing the logs of the queue-worker

[#12] Received on [faas-request]: 'sequence:17 subject:"faas-request" data:"{\"Header\":{\"Accept-Encoding\":[\"gzip\"],\"Content-Length\":[\"0\"],\"Content-Type\":[\"text/plain\"],\"User-Agent\":[\"Go-http-client/1.1\"],\"X-Call-Id\":[\"55f4b051-5c18-4c20-803a-bf5e31e8f1ff\"],\"X-Start-Time\":[\"1538613944807366900\"]},\"Host\":\"127.0.0.1:31112\",\"Body\":\"\",\"Method\":\"POST\",\"Path\":\"\",\"QueryString\":\"\",\"Function\":\"long-task\",\"CallbackUrl\":null}" timestamp:1538613944809916700 '
Request for long-task.
Wrote 0 Bytes
200 OK
Error with AddBasicAuth : Unable to read basic auth: invalid SecretMountPath specified for reading secrets
Posting report - 200

This could be an issue with openfaas, but figured I would put it here first.

Although it says 200, my concern is the Error with AddBasicAuth : Unable to read basic auth: invalid SecretMountPath specified for reading secrets

Lab9: Autoscaling is not working for me

Hi all,
I've been trying to run lab9.
But my autoscaling does not work and it always gives me 1 replica.
Do you know where should I check the value of com.openfaas.scale.min and com.openfaas.scale.max?
And how should I change it? I think the default value for me is to have one replica which never terminates.

Use a default of Python3

Instead of faas new --lang python put new --lang python3 so that we are pushing the newer version which will have LTS.

Update with `faas-cli up`

Change all usages of

faas-cli build && \
faas-cli push && \
faas-cli deploy

to faas-cli up instead

Proposal: Some improvements about the workshop

First of all, thanks for all the contents of this workshop. It's awesome.
I've been creating the Japanese version and there are some parts I think we should improve.

The Main README.md

... Topics will include: managing dependencies with pip, dealing with API tokens through secure secrets, monitoring functions with Prometheus, invoking functions asynchronously and chaining functions together to create applications. We finish by connecting to online event-streams through IFTTT.com ...

It mentions about secrets and IFTTT.com but currently this workshop does not use secrets and IFTTT.com. I assume secrets are coming soon, but IFTTT.com should be removed imo.

Typo in command of lab3

The command fails because it's missing a ''.

$ faas-cli build -f sorter.yml \
  && faas-cli push -f sorter.yml      <- We need a '\' here.
  && faas-cli deploy -f sorter.yml

The appendix

  • It still includes localhost. Should be 127.0.0.1

  • The non-existing function call returns 404

Now give it a few seconds and check what you see on the UI. There should be a 500 error for the function name `non-existing-function.

It says 500 but it actually returns 404 when I tried it. (Prometheus metrics, too)

Server returned unexpected status code: 404 - Cannot find service: non-existing-function.

image

  • A mixture of the two techniques

as documented here is where one function the director exists only to call another function and return the result. It is a mixture of the two techniques we explored above.

I think this should say

"It is a mixture of the two techniques we explored in Lab6."

"above" was a little confusing for me.

If I should create a PR for this, I will so please ping me if that's the case.
Thanks!

Lab 9 - use figlet instead of nodeinfo

One or two users used low-powered machines and couldn't generate enough traffic to get nodeinfo to scale, so I think we should switch to figlet for the example which I believe will allow more through-put to hit the "5 r/ps" limit.

output issue for command uname -a when invoked with markdown function.

I was going through the lab2, and found that.
when I run:

uname -a | faas-cli invoke markdown

I get output as

Linux openfaas.example.com 3.10.0-957.el7.x8664 #1 SMP Thu Nov 8 23:39:32 UTC 2018 x8664 x8664 x8664 GNU/Linux

Due to Emphasis property in markdown.

x86_64

does not display correcty

Need help in getting metrics on container start-up time when replica is zero and one.

Hi,

I'm having a bit trouble in understanding how to get the metrics. I need information regarding,

  • How much time it takes to execute a function which is in cold and warm state.

  • How much time the function takes to complete its process.

I have gone through the metrics section in official documentation.

gateway_functions_seconds

I'm confused whether it does gives us the start-up time of our function. I'm getting the message "No data points found".
Can you please help me out and point me to the right direction? Thanks a lot.

Screenshot at Aug 01 17-29-39

Typo on code for 'Making use of logging'

Section is referring to hello-openfaas from lab3:

$ faas-cli build -f issue-bot.yml
&& faas-cli push -f issue-bot.yml
&& faas-cli deploy -f issue-bot.yml

Should read

$ faas-cli build -f hello-openfaas.yml \

&& faas-cli push -f hello-openfaas.yml
&& faas-cli deploy -f hello-openfaas.yml

Lab 4 | Error when no text present

During our workshop a couple of us had the following issue:

When calling the function after making all the changes in lab 4, it fails when there is no text present.

Perhaps you can add a note to remind users to always have text present when calling the sentimentanalysis function.

Main page: update Tear down/clear link

I was going through the tutorial, trying to clean up my OpenFaas installation, and wasn't sure how to do it. I found the Tear down/ Clear up-section, the link points (https://github.com/openfaas/faas/blob/master/guide/troubleshooting.md#stop-and-remove-openfaas) but it seems that the troubleshooting guide has been moved from github to docs.openfaas.com.

I suggest changing the hyperlink from
https://github.com/openfaas/faas/blob/master/guide/troubleshooting.md#stop-and-remove-openfaas --> https://docs.openfaas.com/deployment/troubleshooting/#uninstall-openfaas

Add notes/examples for Kubernetes

All examples in the workshop are now for Swarm.

In Lab 3 we mention in a note that one can also use Kubernetes (there is an example with export OPENFAAS_URL=127.0.0.1:31112 )

What about including Deployment guide for Kubernetes documentation in the workshop?

This will require some changes to the Labs, f.e. in Lab 4, Making use of logging, we'll need to say how to check the logs with kubectl.
Needs reviewing what other sections require changes.

Testing both Swarm and Kubernetes can be confusing for someone trying OpenFaaS for first time.
Separating them may cause duplicating some labs. May be some middle-ground option would be the best.

Task: merge master & kubernetes-preview branches

Task: merge master & kubernetes-preview branches

Originally we were unsure how to have two sets of instructions so created two branches. In practice this is becoming hard to manage so I think that these two branches need to be merged together.

There are new instructions about auto-scaling in the master branch so it needs to be done carefully and reviewed to make sure we don't lose any information.

Alex

Add Http_Path to labs

Http_Path is now in wide enough use that we should mention it in the labs and give an example of how to use it. 1 short paragraph would be fine.

Lab 4 - HTTP Header Keys Changed to Proper Case

Within lab 4, it describes how HTTP headers are exposed in the function as environment variables.

These headers become exposed through environmental variables so they are easy to consume within your function. So any header is prefixed with Http_ and all - hyphens are replaced with an _ underscore.

However, there appears to be additional manipulation being performed to the HTTP Header key. It is being put into proper case. Below is an illustration.

$ faas-cli version
  ___                   _____           ____
 / _ \ _ __   ___ _ __ |  ___|_ _  __ _/ ___|
| | | | '_ \ / _ \ '_ \| |_ / _` |/ _` \___ \
| |_| | |_) |  __/ | | |  _| (_| | (_| |___) |
 \___/| .__/ \___|_| |_|_|  \__,_|\__,_|____/
      |_|

CLI:
 commit:  bcff3a6bc8d066ba26233a0b5b0e2338476988e1
 version: 0.8.5
$ faas-cli deploy --name env --fprocess="env" --image="functions/alpine:latest" --network=func_functions
$ curl -s --header "CAPITAL-HEADER: VALUE_HERE" "http://127.0.0.1:8080/function/env" | grep "Http_Capital_Header"
Http_Capital_Header=VALUE_HERE

I tried tracing this back to the function getAdditionalEnvs within https://github.com/openfaas/faas/blob/master/watchdog/handler.go to see if this was intentional, but did not find where the proper case was actually occurring.

If it is deemed intentional, updating the workshop documentation to point this additional item would be great - It was throwing me off in Lab 5 when we were getting the Http_X_GitHub_Event/Http_X_Github_Event value.

Lab 3 - Need to add a line to push the astronaut-finder.yml to docker repositories

In my case, for the astronaut-finder function to work I had to run this command : faas-cli up -f astronaut-finder.
Before doing that, in the OpenFaaS GUI the function was not ready and when looking at the kubectl logs was receiving this message : Error from server (BadRequest): container "astronaut-finder" in pod "astronaut-finder-7ff4b9cbcd-tqpjh" is waiting to start: image can't be pulled.

After pushing the docker image into my repositories, everything is working fine.

Point out to the right directories

During live workshop several people had this problem:

  1. Creating a function in lab X in folder labX
  2. Going to lab X + 1 where changes to the same function are required, but the contents are copied to labX+1/ folder
  3. Having editor still open with labX and doing the changes there by mistake.
  4. Changes not applied

It's an easy to find problem, but we may still think how to create better experience

Lab 2 - port forwarding for grafana

I'm using k8s, so I wasn't able to get swarm up. I've translated what is needed for lab 2:

kubectl -n openfaas run \
--image=stefanprodan/faas-grafana:4.6.3 \
--port=3000 \
grafana

kubectl -n openfaas expose deployment grafana \
--type=NodePort \
--name=grafana

POD=$(kubectl get pods -n openfaas | grep grafana | awk '{print $1}')
kubectl port-forward -n openfaas $POD 3000:3000

Lab 8 - show auto-scaling in action

This lab should be short and just show a very simple binary function like "sha512sum" from the image "functions/alpine:latest".

  • Show a query for Prometheus (there is some content in the appendix for this)
  • Invoke the function with a while/curl statement in bash. We don't want people to have to install Go to try this for (hey) or to need Linux to get the ab tool
  • Have them look at the alerts page and see Pending/ Firing - have them check the main UI to see the replicas increasing

Also link to the docs page on auto-scaling and explain briefly that min/max replicas can be set too.

Feel free to take some creative license with this but keep it brief so it can be reviewed / merged for the workshop week beginning 9 Apr.

Lab3 - "docker service logs -f xxx" cannot get logs

When i run "docker service logs -f astronaut-finder", there is an error message "no such task or service: astronaut-finder".
Then I try "kubectl logs", it works
# kubectl logs astronaut-finder-7cddb4c595-2s2cm --namespace=openfaas-fn

2018/09/28 08:45:36 Version: 0.9.4      SHA: e67811c91c006dfe86feb945c88b0738ddf33a67
2018/09/28 08:45:36 Read/write timeout: 5s, 5s. Port: 8080
2018/09/28 08:45:36 Writing lock-file to: /tmp/.lock
2018/09/28 09:13:47 Forking fprocess.
2018/09/28 09:13:47 Query  
2018/09/28 09:13:47 Path  /
Oleg Artemyev
Oleg Artemyev is in space
2018/09/28 09:13:48 Duration: 1.407070 seconds

kubectl version as follws:

Client Version: version.Info{Major:"1", Minor:"10", GitVersion:"v1.10.5", GitCommit:"32ac1c9073b132b8ba18aa830f46b77dcceb0723", GitTreeState:"clean", BuildDate:"2018-06-21T11:46:00Z", GoVersion:"go1.9.3", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"10", GitVersion:"v1.10.5", GitCommit:"32ac1c9073b132b8ba18aa830f46b77dcceb0723", GitTreeState:"clean", BuildDate:"2018-06-21T11:34:22Z", GoVersion:"go1.9.3", Compiler:"gc", Platform:"linux/amd64"}

Lab 11 - Minimum fass-cli versión

I suggest to add an advise with the minimum version of fass-cli needed to use --sign and --key, or since which versión they are supported.

Lab 11 issue-bot follow-up could have hint for environment variable

It is not very obvious to figure out the environment variable that GitHub sends the secret with, so maybe a hint to this point could be added.

Something like:

As a follow-up task you could apply HMAC to secure your endpoint on issue-bot from lab 5 (pay attention to the environment variable used by GitHub to pass the secret value).

Lab 11 - Advanced Feature - Trust with HMAC

Suggested by @martindekov - let's add a lab for using HMAC

The CLI has a new --sign feature (in the next release) - this can be used to invoke a function and sign the header at the same time.

I have an example repo that can be used as an example (perhaps translated to Python, or kept in Go?)

We might want to link to some libraries for use with other languages like C#, Ruby & Node.

https://github.com/alexellis/sofia-test1/blob/master/signed-and-sealed/handler.go#L14

Typo in README.md

This workshop starts by deploying OpenFaaS your laptop with Docker

should be

This workshop starts by deploying OpenFaaS to your laptop with Docker

Remove note about running secret commands on master

Remove note about running secret commands on master

Note: If you are deploying your function on a remote gateway make sure you create your secret on the virtual machine you use for the gateway

This no longer applies since we use the OpenFaaS CLI / API to create secrets

Unable to access Prometheus dashboard after port-forward.

Hi Team,
I have tried your steps for port-forwarding the prometheus to access the dashboard. But I'm unable to do so.

POD=$(kubectl get pods -n openfaas -l app=prometheus -o jsonpath="{.items[0].metadata['name']}")
kubectl -n openfaas port-forward $POD 9090:9090
Forwarding from 127.0.0.1:9090 -> 9090
Forwarding from [::1]:9090 -> 9090

And it's getting hanged there.

My svc displaying stats like this,
NAMESPACE NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
openfaas prometheus ClusterIP 10.100.247.94 <none> 9090/TCP 20h

I installed openfaas using helm chart. Could you please help me out here?

Thanks a lot for your time.

Lab 6 - list.html not found

When in the section Read and return a static HTML file from disk and you reach Now we're going to add a path to the function URL., if you request http://127.0.0.1:8080/function/show-html/list, there is an error:

exit status 1
Traceback (most recent call last):
  File "index.py", line 18, in <module>
    ret = handler.handle(st)
  File "/home/app/function/handler.py", line 12, in handle
    with(open(page, 'r')) as file:
FileNotFoundError: [Errno 2] No such file or directory: '/home/app/function/html/list.html'

I think it's because at this point there is still no list.html, which is created in the next section.

Lab 4 Confusing wording around redploying function

https://github.com/openfaas/workshop/blob/master/lab4.md#security-read-only-filesystems at the very end of this section it says:

You can now test the fix by running ```faas-cli up``` and the files will be written into /tmp/.

In that section of the lab the yaml file being worked on has a different name than the default yaml (instead it is ingest-file.yml). So just running faas-cli up doesn't work. Changing the wording to redeploy/using the entire command may be helpful :).

Will send out a PR regarding this in a bit :)

Lab 6 | Possible Typo on Ajax Call Calling Figlet

(I think) when doing the ajax call to interact with the service figlet it should be ../figlet instead of ./figlet

Or insert the global gateway

...
      // Generate button click
      $('#generate').on('click', function() {
        // Execute ajax request
        $.ajax({
          url:'./figlet',
          type:'POST',
...

Lab 3 Documentation Glitch for Python3 Template

In Lab 3, the mentioned content of handler.py are:

def handle(req):
    """handle a request to the function
    Args:
        req (str): request body
    """

    print(req)

However, the actual content after the pull are:

def handle(req):
    """handle a request to the function
    Args:
        req (str): request body
    """

    return req

the print behaviour is replaced by return. The documentation states This function will just print the input, so it's effectively an echo function, and since it is returned, I am not sure how to is redirected to stdout and where (probably needs a deeper look at the code)

Add scale from zero to Lab 9

This is a good feature to cover in the labs.

This could just be as simple as scaling manually using docker service scale or kubectl scale and then invoking the function used in the examples (nodeinfo).

Stretch goal - mention faas-idler and how to turn "dry run" to false.

Incomplete instructions for Windows users

There are a couple of points of friction in this lab for windows users:

  1. If windows users have default git-bash installed (with use MinTTY specified) they will get an error when they try to run 'docker login' in lab 1 The error seen is "Error: Cannot perform an interactive login from a non TTY device" but has a straightforward workaround. Refs:
    https://willi.am/blog/2016/08/08/docker-for-windows-interactive-sessions-in-mintty-git-bash/
    https://dzone.com/articles/docker-on-windows-interactive-tty-session-gives-ca

  2. The link in lab 1 to download the faas-cli.exe client could do with being more direct to save user having to hunt around for the right thing, i.e linking to https://github.com/openfaas/faas-cli/releases

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.