Skip to content

realbot/faas-dcos

Repository files navigation

faas-dcos

DC/OS plugin for OpenFaas

A more recent blog post describing the installation process can be found here: https://medium.com/@realrealbot/openfaas-on-dcos-9d5927f4e725

Prerequisites:

  1. a running DC/OS cluster accessible without authentication
  2. an external Marathon-LB service running
  3. DC/OS CLI installed and configured (installation instructions can be found here or in the Dashboard top-left corner)

A quick way to have a local DCOS cluster running is https://github.com/dcos/dcos-vagrant. Do not forget to:

  1. add option oauth_enabled: 'false' in etc/config-1.9.yaml config file to disable authentication
  2. set environment variable export DCOS_VERSION=1.9.2 in shell before running vagrant up.

Marathon-LB can be easily installed from DCOS Universe packages (the default configuration is okay, just click on INSTALL button):

Marathon-LB in Universe

Plugin has been tested with DC/OS version 1.9.2, 1.9.4 and 1.10.2 .

Installation

Once you have your cluster running, you can easily install OpenFaas components. From faas-dcos project root run the following command :

dcos marathon group add faas-dcos.json

You should see services being deployed and, after a few minutes, you should have something like this:

OpenFaas running

OpenFaaS Interface should be now be available at http://<public_node_address>:10012/ui/ where <public_node_address> is the cluster node accessible from outside, is the one running Marathon-LB by the way...

You can now deploy functions using the web interface, for instance using these values:

image: functions/nodeinfo:latest  
name: nodeinfo  
handler: node main.js

or alternatively you can use the CLI for OpenFaaS with the following YAML stack file (functions.yaml):

provider:
  name: faas
  gateway: http://<public_node_address>:10012

functions:
  nodeinfo:
    fprocess: node main.js
    image: functions/nodeinfo:latest
    skip_build: true

Remember to set the gateway to http://<public_node_address>:10012!

Then run this command to deploy your function:

$ faas-cli deploy -f ./functions.yml

Once the function has been created, you should see a new service running in DC/OS

Function running

and it will be available to be executed

Function invoked

TODO

  1. Handle authentication and token expiration (see #292)
  2. Marathon 1.5 compatibility (remove go-marathon or #324)

Releases

No releases published

Packages

No packages published