Setting up OpenWhisk with Docker for Mac

OpenWhisk can run on a Mac host with Docker for Mac. If you prefer to use Docker-machine, you can follow instructions in docker-machine/README.md

Prerequisites

The following are required to build and deploy OpenWhisk from a Mac host:

Tips:

  1. Versions of Docker and Ansible are lower than the latest released versions, the versions used in OpenWhisk are pinned to have stability during continuous integration and deployment.
  2. It is required to install Docker >= 18.06.2 because of this CVE

Homebrew is an easy way to install all of these and prepare your Mac to build and deploy OpenWhisk. The following shell command is provided for your convenience to install brew with Cask and bootstraps these to complete the setup. Copy the entire section below and paste it into your terminal to run it.

echo '
# install homebrew
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
# install cask
brew tap caskroom/cask
# install for finding alternative versions (java8)
brew tap caskroom/versions
# install java 8
brew cask install java8
# install scala
brew install scala
# install gnu tar
brew install gnu-tar
# install pip
sudo easy_install pip
# install script prerequisites
sudo -H pip install docker==2.2.1 ansible==2.5.2 jinja2==2.9.6 couchdb==1.1 httplib2==0.9.2 requests==2.10.0' | bash

The above section of command installs Oracle JDK 8 as the default Java environment. If you would like to install Open JDK 8 instead of Oracle JDK 8, please run the following section:

# install for finding alternative versions (Open JDK 8)
brew tap AdoptOpenJDK/openjdk
# install Open JDK 8
brew install adoptopenjdk-openjdk8

instead of

# install for finding alternative versions (java8)
brew tap caskroom/versions
# install java 8
brew cask install java8

with the shell command described above.

No matter which JDK is used, make sure you correctly configure the environment variable $JAVA_HOME.

Build

cd /your/path/to/openwhisk
./gradlew distDocker

Tip Using gradlew handles the installation of the correct version of Gradle to use.

Deploy

Follow instructions in ansible/README.md

Configure the CLI

Follow instructions in Configure CLI

Use the wsk CLI

bin/wsk action invoke /whisk.system/utils/echo -p message hello --result
{
    "message": "hello"
}