Dispatch is a framework for deploying and managing serverless style applications.
Clone or download
berndtj add logo-only images (#723)
Signed-off-by: Berndt Jung <bjung@vmware.com>
Latest commit c387518 Nov 13, 2018
Permalink
Failed to load latest commit information.
.githooks [git/validate] Fix swagger validation in pre-commit hook (#490) Jun 5, 2018
.github/ISSUE_TEMPLATE Update Github issue templates (#412) May 7, 2018
charts/dispatch Updating CI scripts for knative CI (#704) Oct 30, 2018
ci Updating CI scripts for knative CI (#704) Oct 30, 2018
cmd Minimal dispatch server based on knative (#617) Sep 14, 2018
docs add logo-only images (#723) Nov 13, 2018
e2e Make e2e tests pass for images and functions (#651) Oct 12, 2018
examples Make e2e tests pass for images and functions (#651) Oct 12, 2018
images Updating CI scripts for knative CI (#704) Oct 30, 2018
pkg Updating CI scripts for knative CI (#704) Oct 30, 2018
scripts Updating CI scripts for knative CI (#704) Oct 30, 2018
swagger Make e2e tests pass for images and functions (#651) Oct 12, 2018
vendor Updating CI scripts for knative CI (#704) Oct 30, 2018
.gitattributes suppress /gen/ folder Dec 15, 2017
.gitignore Add installer script/image for knative (#636) Oct 5, 2018
CHANGELOG.md Topic/ntenczar/update deadline (#584) Aug 3, 2018
CONTRIBUTING.md Add CONTRIBUTING template Dec 11, 2017
Gopkg.lock Updating CI scripts for knative CI (#704) Oct 30, 2018
Gopkg.toml Updating CI scripts for knative CI (#704) Oct 30, 2018
LICENSE Make the Dispatch license detectable by licensee (#406) May 3, 2018
Makefile Updating CI scripts for knative CI (#704) Oct 30, 2018
NOTICE Make the Dispatch license detectable by licensee (#406) May 3, 2018
README.md Updating CI scripts for knative CI (#704) Oct 30, 2018
images.yaml Update seed images to knative (#648) Oct 5, 2018

README.md

Dispatch

NOTE: This is the knative branch of Dispatch. Full dispatch functionality is still a ways off. The code here represents a work in progress. Links to documentation are likely outdated.

Dispatch is a framework for deploying and managing serverless style applications. The intent is a framework which enables developers to build applications which are defined by functions which handle business logic and services which provide all other functionality:

  • State (Databases)
  • Messaging/Eventing (Queues)
  • Ingress (Api-Gateways)
  • Etc.

Our goal is to provide a substrate which can be built upon and extended to serve as a framework for serverless applications. Additionally, the framework must provide tools and features which aid the developer in building, debugging and maintaining their serverless application.

Documentation

NOTE: The links below refer to an old verion of dispatch and may not be accurrate.

Checkout the detailed documentation including a quickstart guide.

Architecture

The diagram below illustrates the different components which make up the Dispatch project:

initial dispatch architecture diagram

Installation

Prerequisites

GKE

  1. Create service account key

    export GCLOUD_KEY=<path to key.json>
  2. Create GKE cluster:

    K8S_VERSION=1.10.7-gke.6
    export CLUSTER_NAME=dispatch-knative
    gcloud container clusters create -m n1-standard-4 --cluster-version ${K8S_VERSION} ${CLUSTER_NAME}
    gcloud container clusters get-credentials ${CLUSTER_NAME}
  3. Install Knative:

    # Get the current knative verision used with dispatch
    KNATIVE_VERSION=$(cat Gopkg.toml | grep -A 2 'name = "github.com/knative/serving"' | grep revision | cut -d '"' -f2)
    ./scripts/install-knative.py ${CLUSTER_NAME} --gcloud-key=${GCLOUD_KEY} --revision=${KNATIVE_VERSION}

Other

In order to install Knative, follow the development instructions

Dispatch

Installing Dispatch depends on having a Kubernetes cluster with the Knative components installed (Build, Serving and soon Eventing). From here build and install dispatch as follows:

  1. Set the following environment variables:

    export DISPATCH_NAMESPACE="dispatch-server"
    export DISPATCH_DEBUG="true"
    export RELEASE_NAME="dispatch-server"
    export MINIO_USERNAME="dispatch"
    export MINIO_PASSWORD="dispatch"
    export INGRESS_IP=$(kubectl get service -n istio-system knative-ingressgateway -o json | jq -r .status.loadBalancer.ingress[].ip)
  2. Build and publish a dispatch image:

    PUSH_IMAGES=1 make images
  3. The previous command will output a configuration file values.yaml:

    image:
      host: username
      tag: v0.1.xx
    storage:
      minio:
        username: ********
        password: ********
  4. Deploy via helm chart (if helm is not installed and initialized, do that first):

    helm upgrade -i --debug ${RELEASE_NAME} ./charts/dispatch --namespace ${DISPATCH_NAMESPACE} -f values.yaml

    NOTE: Use following to create cluster role binding for tiller:

    kubectl create clusterrolebinding tiller-cluster-admin --clusterrole=cluster-admin --serviceaccount=kube-system:default
  5. Reconfigure Knative serving (need to whitelist our internal repository):

    ./scripts/configure-knative.sh
  6. Build the CLI (substitute darwin for linux if needed):

    make cli-darwin
    # Create symlink to binary
    ln -s `pwd`/bin/dispatch-darwin /usr/local/bin/dispatch
  7. Create the Dispatch config:

    cat << EOF > config.json
    {
      "current": "${RELEASE_NAME}",
      "contexts": {
        "${RELEASE_NAME}": {
          "host": "$(kubectl -n ${DISPATCH_NAMESPACE} get service ${RELEASE_NAME}-nginx-ingress-controller -o json | jq -r .status.loadBalancer.ingress[].ip)",
          "port": 443,
          "scheme": "https",
          "insecure": true
        }
      }
    }
    EOF
    # point to the config file (could also move to ~/.dispatch/config)
    export DISPATCH_CONFIG=`pwd`/config.json
  8. Test out your install: First, create an baseimage:

    dispatch create baseimage python3-base dispatchframework/python3-base:0.0.13-knative
    Created baseimage: python3-base

    Then, create an image:

    dispatch create image python3 python3-base
    Created image: python3

    Wait for status READY:

    dispatch get images
       NAME  | DESTINATION | BASEIMAGE | STATUS |         CREATED DATE
    --------------------------------------------------------------------------
     python3 | *********** | ********* | READY  | Tue Sep 25 16:51:35 PDT 2018

    Create a function:

    dispatch create function --image python3 hello ./examples/python3/hello.py
    Created function: hello

    Once status is READY:

    dispatch get function
       NAME  | FUNCTIONIMAGE | STATUS |         CREATED DATE
    ----------------------------------------------------------------
      hello  | ************* | READY  | Thu Sep 13 12:41:07 PDT 2018

    Exec the function:

    dispatch exec hello <<< '{"name": "user"}' | jq .
    {
      "context": {
        "logs": {
          "stdout": [
            "messages to stdout show up in logs"
          ],
          "stderr": null
        }
      },
      "payload": {
        "myField": "Hello, user from Nowhere"
      }
    }

    Create an endpoint:

    dispatch create endpoint get-hello hello --method GET --method POST --path /hello

    Hit the endpoint with curl:

    curl -v http://${INGRESS_IP}/hello?name=Jon -H 'Host: default.dispatch-server.dispatch.local'

For a more complete quickstart see the developer documentation