Build serverless applications with ease
Switch branches/tags
Nothing to show
Clone or download
Latest commit 613d667 Oct 15, 2018

README.md

func

Build applications, not infrastructure.

CircleCI goreportcard

Func lets you deploy serverless infrastructure in a declarative way. Updates are done by comparing the current state to the desired state. This means only minimal changes are done, which makes it super fast. You can literally deploy applications that are able to handle production traffic in seconds.

Install

Go 1.11 is required.

go get -u github.com/func/func

Binary releases will be available soon.

Core concepts

A func application is built of two core components: projects and functions. A function defines the business logic for your application, while a project serves as the root and provides defaults to downstream functions.

When applying changes, func will look for the project file and find related functions in subfolders:

├── func1
│   ├── func.yml
│   └── index.js
├── func2
│   ├── func.yml
│   └── index.js
├── func3
│   ├── func.yml
│   └── index.js
└── project.yml

When projects and functions have been defined, they can be applied:

func apply <path to project>

This will take the current state, compare it to the desired state as defined by the config files, and perform necessary actions to reconcile the state.

Project

A Project represents a func project. It is the root to all functions and provides defaults to them. When a project is applied, the Project will define the starting point for building the function graph.

The project can be specified as a project.yaml file (or json):

name: func-example-args
aws:
  credentials: dev
  regions:
    - eu-central-1
  lambda:
    timeout: 3
    memory: 128

Only the name is required.

key description
name Name of the project.
aws AWS specific defaults (optional).
aws.credentials Credentials to use for deployment.
aws.regions Regions to deploy to.
aws.lambda Lambda specific configuration.

Function

Func represents a single function, which encapsulates a single piece of business logic.

The function config is defined in a func.yaml file, in a subdirectory relative to the project.yaml:

name: params
language: js
provider: awslambda
args:
  - name: name
    default: default name
  - name: query
  - name: country
    default: unknown
triggers:
  - type: http
    method: get
    path: /{name}
    query:
      a: query
    headers:
      CloudFront-Viewer-Country: country
aws:
  lambda:
    timeout: 3
    memory: 128
key description
name Name of the function
language Language of the function source code.
provider Provider for the function runtime [awslambda]
args Args defines the function arguments (inputs).
triggers Triggers specify what start the function execution.
aws Override aws in project

Learning by doing

Have a look at some examples to get you started.