Skip to content
Snippets Groups Projects
README.md 8.72 KiB
Newer Older
Alex Ellis's avatar
Alex Ellis committed
## OpenFaaS - Serverless Functions Made Simple
Alex Ellis's avatar
Alex Ellis committed

Alex Ellis's avatar
Alex Ellis committed
[![Go Report Card](https://goreportcard.com/badge/github.com/openfaas/faas)](https://goreportcard.com/report/github.com/openfaas/faas) [![Build
Alex Ellis's avatar
Alex Ellis committed
Status](https://travis-ci.org/openfaas/faas.svg?branch=master)](https://travis-ci.org/openfaas/faas) [![GoDoc](https://godoc.org/github.com/openfaas/faas?status.svg)](https://godoc.org/github.com/openfaas/faas) [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
Alex Ellis's avatar
Alex Ellis committed
[![OpenFaaS](https://img.shields.io/badge/openfaas-serverless-blue.svg)](https://www.openfaas.com)
Alex Ellis's avatar
Alex Ellis committed

Alex Ellis's avatar
Alex Ellis committed
![OpenFaaS Logo](https://blog.alexellis.io/content/images/2017/08/faas_side.png)
Alex Ellis's avatar
Alex Ellis committed

Alex Ellis's avatar
Alex Ellis committed
OpenFaaS (Functions as a Service) is a framework for building serverless functions with Docker and Kubernetes which has first class support for metrics. Any process can be packaged as a function enabling you to consume a range of web events without repetitive boiler-plate coding.
Alex Ellis's avatar
Alex Ellis committed

[![Twitter URL](https://img.shields.io/twitter/url/https/twitter.com/fold_left.svg?style=social&label=Follow%20%40openfaas)](https://twitter.com/openfaas)
Alex Ellis's avatar
Alex Ellis committed

**Highlights**

* Ease of use through UI portal and *one-click* install
Alex Ellis's avatar
Alex Ellis committed
* Write functions in any language for Linux or Windows and package in Docker/OCI image format
* Portable - runs on existing hardware or public/private cloud - [Kubernetes](https://github.com/openfaas/faas-netes) and Docker Swarm native
* [CLI](http://github.com/openfaas/faas-cli) available with YAML format for templating and defining functions
* Auto-scales as demand increases

Alex Ellis's avatar
Alex Ellis committed
## New: become an OpenFaaS backer or sponsor

We need your support to keep delivering on Serverless Functions Made Simple so pledge to OpenFaaS and [become a backer or a sponsor](https://www.patreon.com/alexellis) with a unique set of rewards. Help us hit our goals and get to back a great project at the same time.

View the [List of backers and sponsors](https://github.com/openfaas/faas/blob/master/BACKERS.md)

Alex Ellis's avatar
Alex Ellis committed
## Press-kit/media/swag

Alex Ellis's avatar
Alex Ellis committed
For stickers, swag, media or press-kit information head over to [openfaas/media](https://github.com/openfaas/media/blob/master/README.md)
Alex Ellis's avatar
Alex Ellis committed

Alex Ellis's avatar
Alex Ellis committed
## Governance

Alex Ellis's avatar
Alex Ellis committed
OpenFaaS is an independent project created by [Alex Ellis](https://www.alexellis.io) which is now being built and shaped by a growing community of contributors. Project website: [openfaas.com](https://www.openfaas.com).
Alex Ellis's avatar
Alex Ellis committed

Alex Ellis's avatar
Alex Ellis committed
## Overview of OpenFaaS
Alex Ellis's avatar
Alex Ellis committed

Alex Ellis's avatar
Alex Ellis committed
> Serverless Functions Made Simple.

![Stack](https://pbs.twimg.com/media/DFrkF4NXoAAJwN2.jpg)
Alex Ellis's avatar
Alex Ellis committed

Alex Ellis's avatar
Alex Ellis committed
### Function Watchdog
Alex's avatar
Alex committed

Alex Ellis's avatar
Alex Ellis committed
* You can make any Docker image into a serverless function by adding the *Function Watchdog* (a tiny Golang HTTP server)
* The *Function Watchdog* is the entrypoint allowing HTTP requests to be forwarded to the target process via STDIN. The response is sent back to the caller by writing to STDOUT from your application.
Alex Ellis's avatar
Alex Ellis committed
### API Gateway / UI Portal
Alex Ellis's avatar
Alex Ellis committed

* The API Gateway provides an external route into your functions and collects Cloud Native metrics through Prometheus.
Alex Ellis's avatar
Alex Ellis committed
* Your API Gateway will scale functions according to demand by altering the service replica count in the Docker Swarm or Kubernetes API.
Alex Ellis's avatar
Alex Ellis committed
* A UI is baked in allowing you to invoke functions in your browser and create new ones as needed.
Alex Ellis's avatar
Alex Ellis committed

> The API Gateway is a RESTful micro-service and you can view the [Swagger docs here](https://github.com/openfaas/faas/tree/master/api-docs).
Alex Ellis's avatar
Alex Ellis committed

Alex Ellis's avatar
Alex Ellis committed
### CLI
Alex Ellis's avatar
Alex Ellis committed

Alex Ellis's avatar
Alex Ellis committed
Any container or process in a Docker container can be a serverless function in FaaS. Using the [FaaS CLI](http://github.com/openfaas/faas-cli) you can deploy your functions quickly.

Create new functions from templates for Node.js, Python, [Go](https://blog.alexellis.io/serverless-golang-with-openfaas/) and many more. If you can't find a suitable template you can also use a Dockerfile.
Alex Ellis's avatar
Alex Ellis committed

Alex Ellis's avatar
Alex Ellis committed
> The CLI is effectively a RESTful client for the API Gateway.

Alex Ellis's avatar
Alex Ellis committed
When you have OpenFaaS configured you can [get started with the CLI here](https://blog.alexellis.io/quickstart-openfaas-cli/)
Alex Ellis's avatar
Alex Ellis committed
### Function examples
Alex Ellis's avatar
Alex Ellis committed
You can generate new functions using the FaaS-CLI and built-in templates or use any binary for Windows or Linux in a Docker container.

* Python example:
Alex Ellis's avatar
Alex Ellis committed

morsik's avatar
morsik committed
```python
Alex Ellis's avatar
Alex Ellis committed
import requests
Alex Ellis's avatar
Alex Ellis committed

Alex Ellis's avatar
Alex Ellis committed
def handle(req):
    r =  requests.get(req, timeout = 1)
    print(req +" => " + str(r.status_code))
Alex Ellis's avatar
Alex Ellis committed
```
*handler.py*
Alex Ellis's avatar
Alex Ellis committed
* Node.js example:
Alex's avatar
Alex committed

Alex Ellis's avatar
Alex Ellis committed
```js
"use strict"
Alex Ellis's avatar
Alex Ellis committed
module.exports = (callback, context) => {
    callback(null, {"message": "You said: " + context})
}
Alex Ellis's avatar
Alex Ellis committed
*handler.js*
Alex Ellis's avatar
Alex Ellis committed

Other [Sample functions](https://github.com/openfaas/faas/tree/master/sample-functions) are available in the Github repository in a range of programming languages.
Alex Ellis's avatar
Alex Ellis committed

Alex Ellis's avatar
Alex Ellis committed
## Documentation

We are building a new documentation site at [docs.openfaas.com](http://docs.openfaas.com). 
The source repository for the documentation website is [openfaas/docs](https://github.com/openfaas/docs).
Alex Ellis's avatar
Alex Ellis committed

For all other guides, tutorials, trouble-shooting and blog posts head over to our [guides page](https://github.com/openfaas/faas/tree/master/guide) on GitHub.
Alex Ellis's avatar
Alex Ellis committed
## Get started with OpenFaaS
Alex Ellis's avatar
Alex Ellis committed

### Official documentation and blog
See our documentation on [docs.openfaas.com](https://docs.openfaas.com/)

Read latest news on OpenFaaS from the community [blog](https://www.openfaas.com/blog/)

Alex Ellis's avatar
Alex Ellis committed
### Hands-on labs (detailed getting started)
Alex Ellis's avatar
Alex Ellis committed
You can learn how to build functions with OpenFaaS using our hands-on labs in the [OpenFaaS workshop](http://github.com/openfaas/workshop).
Alex Ellis's avatar
Alex Ellis committed
### TestDrive (classic getting started)
Alex Ellis's avatar
Alex Ellis committed

Alex Ellis's avatar
Alex Ellis committed
**Kubernetes**
Alex Ellis's avatar
Alex Ellis committed
OpenFaaS is Kubernetes-native - you can follow the [deployment guide here](http://docs.openfaas.com/deployment/kubernetes/).

**Docker Swarm**

The deployment guide for Docker Swarm contains a simple one-line command to get you up and running in around 60 seconds. It also includes a set of [sample functions](https://github.com/openfaas/faas/tree/master/sample-functions) which you can use with the TestDrive instructions below.

[Deployment guide for Docker Swarm](http://docs.openfaas.com/deployment/docker-swarm/)
Alex Ellis's avatar
Alex Ellis committed
**Docker Playground**
You can quickly start OpenFaaS on Docker Swarm online using the community-run Docker playground: [Play-with-Docker](https://labs.play-with-docker.com/) (PWD)

Simply follow the deployment guide for Swarm above in a new session

> You will need a free Docker Hub account to get access. Get one here: [Docker Hub](https://hub.docker.com/)
Alex Ellis's avatar
Alex Ellis committed

Alex Ellis's avatar
Alex Ellis committed
#### Begin the TestDrive
* [Begin the TestDrive with Docker Swarm](https://github.com/openfaas/faas/blob/master/TestDrive.md)
Alex Ellis's avatar
Alex Ellis committed

Alex Ellis's avatar
Alex Ellis committed
Here is a screenshot of the API gateway portal - designed for ease of use.
Alex Ellis's avatar
Alex Ellis committed
![Portal](https://pbs.twimg.com/media/C7bkpZbWwAAnKsx.jpg)
## Find out more about OpenFaaS

### SkillsMatter video presentation

Great overview of OpenFaaS features, users and roadmap

* [HD Video](https://skillsmatter.com/skillscasts/10813-faas-and-furious-0-to-serverless-in-60-seconds-anywhere)

### OpenFaaS presents to CNCF Serverless workgroup

* [Video and blog post](https://blog.alexellis.io/openfaas-cncf-workgroup/)

### Closing Keynote at Dockercon 2017

Functions as a Service or FaaS was a winner in the Cool Hacks contest for Dockercon 2017.

* [Watch my FaaS keynote at Dockercon 2017](https://blog.docker.com/2017/04/dockercon-2017-mobys-cool-hack-sessions/)

If you'd like to find the functions I used in the demos head over to the [faas-dockercon](https://github.com/alexellis/faas-dockercon/) repository.

**Background story**

* [Introducing OpenFaaS (Functions as a Service)](https://blog.alexellis.io/introducing-functions-as-a-service/) -  August 2017
* [Functions as a Service (FaaS)](http://blog.alexellis.io/functions-as-a-service/) - January 2017
Alex Ellis's avatar
Alex Ellis committed
### Community
Alex Ellis's avatar
Alex Ellis committed
Have you written a blog about OpenFaaS? Send a Pull Request to the community page below.
Alex Ellis's avatar
Alex Ellis committed

* [Read blogs/articles and find events about OpenFaaS](https://github.com/openfaas/faas/blob/master/community.md)
Alex Ellis's avatar
Alex Ellis committed

If you'd like to join OpenFaaS community Slack channel to chat with contributors or get some help then check out [this page on community](https://docs.openfaas.com/community).
Alex Ellis's avatar
Alex Ellis committed

### Roadmap and contributing

OpenFaaS is written in Golang and is MIT licensed - contributions are welcomed whether that means providing feedback, testing existing and new feature or hacking on the source.

#### How do I become a contributor?
Please see the guide on [community & contributing](https://docs.openfaas.com/community/#contribute)
Alex Ellis's avatar
Alex Ellis committed

Alex Ellis's avatar
Alex Ellis committed

The roadmap is represented in [GitHub issues](https://github.com/openfaas/faas/issues) and a Trello board. There is also a historical ROADMAP file in the [main faas repository](https://github.com/openfaas/faas/blob/master/ROADMAP.md).
Example of a Grafana dashboards linked to OpenFaaS showing auto-scaling live in action: [here](https://grafana.com/dashboards/3526)
![](https://pbs.twimg.com/media/C9caE6CXUAAX_64.jpg:large)

Alex Ellis's avatar
Alex Ellis committed
An alternative community dashboard is [available here](https://grafana.com/dashboards/3434)