blob: e17dc07a81982ac8829ebfc34a3e8770881cfc0e [file] [log] [blame]
---
layout: default
---
<!--
# Licensed to the Apache Software Foundation (ASF) under one or more contributor
# license agreements; and to You under the Apache License, Version 2.0.
-->
<div id="whiskIndexedLayout">
<!-- Documentation Index -->
<div id="whiskIndex">
<ul>
<li><a href="#documentation">Documentation</a></li>
<!-- Programming Model -->
<li class="index-menu-toggle"><a href="#programming-model">Programming Model</a></li>
<ul class="index-menuitems">
<li><a href="#programming-model-actions">Actions</a></li>
<li><a href="#programming-model-triggers">Triggers & Rules</a></li>
</ul>
<!-- Developers -->
<li class="index-menu-toggle"><a href="#developers">Developers</a></li>
<ul class="index-menuitems index-menu-start-open">
<li><a href="#pre-requisites">Pre-requisites</a></li>
<li><a href="#using-openwhisk">Using OpenWhisk</a></li>
<li class="index-menu-toggle"><a href="#getting-started">Getting Started</a></li>
<ul class="index-menuitems">
<li><a href="#wsk-cli">Whisk CLI (wsk)</a></li>
<li><a href="#wskdeploy">Whisk Deploy (wskdeploy)</a></li>
<li><a href="#rest-api">OpenWhisk REST API</a></li>
<li><a href="#openwhisk-clients">OpenWhisk Clients</a></li>
</ul>
<!-- WARNING: Index anchors have style="white-space: pre-wrap;"
DO NOT CHANGE THE SPACING OF THE ANCHOR TEXT -->
<li class="index-menu-toggle"><a href="#actions-creating-and-invoking">Creating and
Invoking Actions</a></li>
<ul class="index-menuitems">
<li id="index-nodejs" class="index-menu-toggle"><a href="#nodejs">using NodeJS</a></li>
<ul class="index-menuitems">
<li><a href="#actions-nodejs">Creating and Invoking Sample Action</a></li>
<li><a href="#nodejs-runtime">NodeJS Runtime</a></li>
<li><a href="#nodejs-additional-resources">Additional Resources</a></li>
</ul>
<li id="index-go" class="index-menu-toggle"><a href="#go">using Go</a></li>
<ul class="index-menuitems">
<li><a href="#actions-go">Creating and Invoking Action</a></li>
<li><a href="#go-runtime">Go Runtime</a></li>
<li><a href="#go-additional-resources">Additional Resources</a></li>
</ul>
<li id="index-java" class="index-menu-toggle"><a href="#java">using Java</a></li>
<ul class="index-menuitems">
<li><a href="#actions-java">Creating and Invoking Action</a></li>
<li><a href="#java-runtime">Java Runtime</a></li>
<li><a href="#java-additional-resources">Additional Resources</a></li>
</ul>
<li id="index-php" class="index-menu-toggle"><a href="#php">using PHP</a></li>
<ul class="index-menuitems">
<li><a href="#actions-php">Creating and Invoking Action</a></li>
<li><a href="#php-runtime">PHP Runtime</a></li>
<li><a href="#php-additional-resources">Additional Resources</a></li>
</ul>
<li id="index-python" class="index-menu-toggle"><a href="#python">using Python</a></li>
<ul class="index-menuitems">
<li><a href="#actions-python">Creating and Invoking Sample Action</a></li>
<li><a href="#python-runtime">Python Runtime</a></li>
<li><a href="#python-additional-resources">Additional Resources</a></li>
</ul>
<li id="index-ruby" class="index-menu-toggle"><a href="#ruby">using Ruby</a></li>
<ul class="index-menuitems">
<li><a href="#actions-ruby">Creating and Invoking Action</a></li>
<li><a href="#ruby-runtime">Ruby Runtime</a></li>
<li><a href="#ruby-additional-resources">Additional Resources</a></li>
</ul>
<li id="index-swift" class="index-menu-toggle"><a href="#swift">using Swift</a></li>
<ul class="index-menuitems">
<li><a href="#actions-swift">Creating and Invoking Action</a></li>
<li><a href="#swift-runtime">Swift Runtime</a></li>
<li><a href="#swift-additional-resources">Additional Resources</a></li>
</ul>
<li id="index-dotnet" class="index-menu-toggle"><a href="#dotnet">using .NET Core</a></li>
<ul class="index-menuitems">
<li><a href="#actions-dotnet">Creating and Invoking Action</a></li>
<li><a href="#dotnet-runtime">.NET Core Runtime</a></li>
<li><a href="#dotnet-additional-resources">Additional Resources</a></li>
</ul>
<!--li id="index-docker" ><a href="#docker">Docker</a></li>
<ul>
<li>Zip Action</li>
<li>SDK (Writing Your Own Runtime)</li>
<li>Other Resources</li>
</ul-->
</ul>
<li><a href="#managing_actions_with_openwhisk_packages">Managing Actions with OpenWhisk Packages</a></li>
<li><a href="#automating_actions_from_event_sources">Automating Actions from Event Sources</a></li>
<li><a href="#using_openwhisk_enabled_services">Using OpenWhisk Enabled Services</a></li>
<!--li><a href="#exposing_apis_from_actions">Exposing APIs from Actions</a></li-->
<li><a href="#sample_openwhisk_applications">Sample OpenWhisk Applications</a></li>
<li><a href="#tutorial_and_workshop">Tutorial And Workshop</a></li>
<li><a href="#development_tools">Development Tools</a></li>
</ul>
<!-- Operators -->
<li class="index-menu-toggle"><a href="#operators">Operators</a></li>
<ul class="index-menuitems">
<li><a href="#openwhisk_architecture">OpenWhisk Architecture</a></li>
<li class="index-menu-toggle"><a href="#openwhisk_deployment">Deployment Options</a></li>
<ul class="index-menuitems">
<li><a href="#deploy_kubernetes">Kubernetes</a></li>
<li><a href="#deploy_docker_compose">Docker Compose</a></li>
<li><a href="#deploy_mesos">Mesos</a></li>
<li><a href="#deploy_ansible">Ansible</a></li>
<li><a href="#deploy_vagrant">Vagrant</a></li>
</ul>
<li><a href="#deployment_admin">Administrative Operations</a></li>
<li><a href="#operators_resources">Operators Resources</a></li>
</ul>
<!-- Contributors -->
<li class="index-menu-toggle"><a href="#contributors">Contributors</a></li>
<ul class="index-menuitems">
<li><a href="#project-structure">Project Structure</a></li>
<li><a href="#contributor-resources">Contributor Resources</a></li>
<li><a href="#contributing-what-to-contribute">What Can I Contribute?</a></li>
<li><a href="#contributing-runtimes">Contributing Language Runtimes</a></li>
</ul>
<!-- Other Resources -->
<li><a href="#other-resources">Other Resources</a></li>
<!-- FAQ -->
<li><a href="#faq">FAQ</a></li>
</ul>
</div>
<section id="whiskNodes">
<main class="doc">
<div class="content">
<a class="indexable" id="documentation"></a>
<h2>Documentation</h2>
<p>There are many resources for learning about OpenWhisk;
this page attempts to organize, describe, index and link
to the essential information, wherever it resides, to help
users in getting started. In general, much of the best
information is in the actual project repositories and we
encourage you to seek detailed and in-depth information
there.
</p>
<h5>OpenWhisk documentation is organized by the following
roles:</h5>
<ul>
<li><a href="#developers">Developers</a>: users
developing functions/actions, creating packages, feeds,
and feed provider services using project APIs, clients
and tooling.
</li>
<li><a href="#contributors">Contributors</a>: developers
designing and coding backend architectural components
and tooling that comprise the OpenWhisk platform and its
project ecosystem.
</li>
<li><a href="#operators">Operators</a>: users who deploy,
configure, and host the Apache OpenWhisk
Function-as-a-Service platform for development, testing
and/or production.
</li>
</ul>
</div>
</main>
<!-- *************************************************************** -->
<!-- Programming Model -->
<!-- *************************************************************** -->
<main class="doc">
<div class="content">
<a class="indexable" id="programming-model"></a>
<h3>OpenWhisk Programming Model</h3>
<p>
<img style="display:block; width:80%; margin: auto"
src="{{ site.github.url }}/images/illustrations/OW-Programming-Model-Horz.png"
alt="OpenWhisk Programming Model">
</p>
<p>The OpenWhisk programming model...</p>
<h5>Is Event-driven</h5>
<p>In the OpenWhisk programming model, Events drive the
Serverless execution of functional code called Actions.
Events can come from any Event Source or Feed service
including:
</p>
<!-- TODO: Add links here -->
<ul>
<li>Datastores, Message Queues, Mobile and Web
Applications, Sensors, Chatbots, Scheduled tasks (via Alarms),
etc.
</li>
</ul>
<h5>Supports any functional programming language</h5>
<p>The OpenWhisk platform supports Action code written for any
of its ever-growing, built-in <a href="https://github.com/apache/openwhisk/blob/master/docs/actions.md#languages-and-runtimes">language runtimes</a>.
</p>
<p>The following is a list of runtimes the Apache OpenWhisk project
has officially released and made available on
our <a href="downloads.html#component-releases">Downloads</a> page.
</p>
<ul>
<!-- TODO Fix Go Runtime README so title matches other runtimes; bury "other exec. -->
<li><a href="https://github.com/apache/openwhisk-runtime-dotnet#readme">.Net</a> - OpenWhisk runtime for .Net Core 2.2</li>
<li><a href="https://github.com/apache/openwhisk-runtime-go#readme">Go</a> - OpenWhisk runtime for Go</li>
<li><a href="https://github.com/apache/openwhisk-runtime-java#readme">Java</a> - OpenWhisk runtime for Java 8 <i>(OpenJDK 8, JVM OpenJ9)</i></li>
<li><a href="https://github.com/apache/openwhisk-runtime-nodejs#readme">JavaScript</a> - OpenWhisk runtime for Node.js v10, v12 and v14</li>
<li><a href="https://github.com/apache/openwhisk-runtime-php#readme">PHP</a> - OpenWhisk runtime for PHP 7.4, 7.3 and 7.2</li>
<li><a href="https://github.com/apache/openwhisk-runtime-python#readme">Python</a> - OpenWhisk runtime for Python 2.7, 3 and a 3 runtime variant for AI/ML <i>(including packages for Tensorflow and PyTorch)</i></li>
<li><a href="https://github.com/apache/openwhisk-runtime-ruby#readme">Ruby</a> - OpenWhisk runtime for Ruby 2.5</li>
<li><a href="https://github.com/apache/openwhisk-runtime-swift#readme">Swift</a> - OpenWhisk runtime for Swift 3.1.1, 4.1 and 4.2</li>
</ul>
<p>The following is a list of experimental runtimes the Apache OpenWhisk community is developing. The Apache OpenWhisk community would welcome any help bringing these runtimes to a state where they can be released.
</p>
<ul>
<li><a href="https://github.com/apache/openwhisk-runtime-ballerina#readme">Ballerina</a> - OpenWhisk runtime for Ballerina 0.990.2</li>
<li><a href="https://github.com/apache/openwhisk-runtime-rust#readme">Rust</a> - OpenWhisk runtime for Rust 1.34</li>
</ul>
<!-- TODO: fix the Docker SDK header/title to say "Docker SDK" NOT "Blackbox Actions"-->
<p>If you need languages or libraries the current
"out-of-the-box" runtimes do not support, you can create
and customize your own executable that run "black box"
<a href="https://github.com/apache/openwhisk-runtime-docker/blob/master/sdk/docker/README.md">Docker Actions</a>
using the Docker SDK which are run on the
<a href="https://github.com/apache/openwhisk-runtime-docker#readme">Docker Runtime</a>.
<!-- TODO: cover later and link -->
</p>
<a class="indexable" id="programming-model-actions"></a>
<h4>Actions</h4>
<p>This section will answer some of the essential questions about
OpenWhisk Actions relative to the programming model.
If you want more detailed information,
please read the project documentation on
<a href="https://github.com/apache/openwhisk/blob/master/docs/actions.md#openwhisk-actions">
OpenWhisk Actions</a>.
</p>
<img width="90%"
src="{{ site.github.url }}/images/illustrations/OW-Programming-Model-Horz-Action.png"
alt="OpenWhisk Programming Model: Actions">
<p>
<question>What is an Action?</question>
Actions are stateless functions (code snippets) that run on
the OpenWhisk platform. Actions encapsulate application logic
to be executed in response to events. Actions can be invoked
manually by the OpenWhisk REST API, OpenWhisk CLI,
simple and user-created APIs or automated via Triggers
which we will discuss later.
</p>
<p>
<question>Does the function's language matter?</question>
No, OpenWhisk is agnostic to a function's implementation language.
This means that OpenWhisk operations used to create, invoke and
manage Actions are the same regardless of implementation choice.
You decide what languages are best for you!
</p>
<p>
<question>What if your preferred language/runtime is not supported
by OpenWhisk?</question>
If your favorite language is not listed above, you may find the
Docker action or native binary path more suitable.
The OpenWhisk platform is extensible and you can add new languages
or runtimes (with custom packages and third-party dependencies)
following the guide described
<a href="https://github.com/apache/openwhisk/blob/master/docs/actions-new.md">here</a>.
Please reach out to other whiskers on dev mailing list at
<a href="mailto:dev@openwhisk.apache.org">dev@openwhisk.apache.org</a>.
once you have followed the guide on creating a new language/runtimes.
Here are some examples of runtimes added by community:
</p>
<ul>
<li><a href="https://github.com/rainbyte/openwhisk-wrapper">Haskell based OpenWhisk Services</a></li>
<li><a href="http://jamesthom.as/blog/2017/01/18/openwhisk-and-rust/">OpenWhisk and Rust</a></li>
<li><a href="https://github.com/gekola/openwhisk_docker_samples">Run Clojure, Erlang, Ruby, and Rust Actions on OpenWhisk using Docker</a></li>
<li><a href="https://github.com/imesh/openwhisk-runtime-ballerina#apache-openwhisk-runtime-for-ballerina">Ballerina</a></li>
</ul>
<h5>Composing Sequences of Actions</h5>
<p>
Multiple actions, even implemented in different languages, may be
composed together to create a longer processing pipeline called a
<a href="https://github.com/apache/openwhisk/blob/master/docs/actions.md#creating-action-sequences">sequence</a>.
A sequence can be treated as a single action in terms of it's creation
and invocation.
</p>
<h5>Learn more</h5>
<p>Listed below are some additional topics related to
developing OpenWhisk Actions:</p>
<ul>
<li><a href="https://github.com/apache/openwhisk/blob/master/docs/reference.md#openwhisk-entities">Namespacing</a>
- the same Namespace and Naming rules as any
<a href="https://github.com/apache/openwhisk/blob/master/docs/reference.md#openwhisk-entities">OpenWhisk Entity</a> that are part of the
OpenWhisk programming model.
</li>
<li><a href="https://github.com/apache/openwhisk/blob/master/docs/reference.md#system-limits">System Limits</a>
- Learn about some of the
(operator configurable) System Limits that are imposed on
OpenWhisk Actions.
</li>
<li><a href="https://github.com/apache/openwhisk/blob/master/docs/webactions.md#web-actions">Web Actions</a>
- Find out how to annotate OpenWhisk Actions to quickly enable
you to build web based applications.
</li>
<li><a href="https://github.com/apache/openwhisk/blob/master/docs/about.md#the-internal-flow-of-processing">Action Processing</a>
- Find out what happens "behind the scenes" when you invoke an
Action in Apache OpenWhisk.
</li>
</ul>
<a class="indexable" id="programming-model-triggers"></a>
<h4>Triggers and Rules</h4>
<p>This section will describe how to automate OpenWhisk Actions
in response to events using OpenWhisk Triggers.
If you want to more detailed information,
please read the project documentation on
<a href="https://github.com/apache/openwhisk/blob/master/docs/triggers_rules.md#creating-triggers-and-rules">
OpenWhisk Triggers and Rules</a>.
</p>
<img width="90%"
src="{{ site.github.url }}/images/illustrations/OW-Programming-Model-Horz-Trigger-Rule.png"
alt="OpenWhisk Programming Model: Actions">
<p>
<question>What is a trigger?</question>
Triggers are named channels for classes or kinds of events
sent from Event Sources.
</p>
<p>
<question>What is a Rule?</question>
Rules are used to associate one trigger with one action.
After this kind of association is created, each time
a trigger event is fired, the action is invoked.
</p>
<p>
<question>What are Event Sources?</question>
These are services that generate events that often indicate
changes in data or carry data themselves. Some examples of
common Event Sources include:
</p>
<ul>
<li>Messages arriving on Message Queues</li>
<li>Changes in Databases</li>
<li>Changes in Document Stores</li>
<li>Website or Web Application interactions</li>
<li>Service APIs being invoked</li>
<li>IoT Frameworks forwarding device sensor data</li>
<li>etc.</li>
</ul>
<p>
<question>Why do I need to connect actions to event
sources?</question>
OpenWhisk is based on an event-driven architecture where most
Actions are executed as events happen.
The Trigger itself is "fired" with a dictionary of
key-value pairs (i.e., the parameters) coming from the
Event Source and allows the configuration of optional default
values thus helping assure the data is compatible with any
associated Actions.
Rules allow for the same Trigger to be associated with multiple
Actions, as well as allow for specific automation to be enabled
or disabled dynamically without destroying the
Trigger definition.
</p>
</div>
</main>
<!-- *************************************************************** -->
<!-- Developers -->
<!-- *************************************************************** -->
<main class="doc">
<div class="content">
<a class="indexable" id="developers"></a>
<h2>Developers</h2>
<p>
The OpenWhisk project and programming model supports
different kinds of developers that may wish to
use different runtimes and tooling.
This section contains the information and resources
you need to become a Serverless application
developer using the Apache OpenWhisk platform.
</p>
<!-- *********************************************************** -->
<!-- Developers - Pre-requisites -->
<!-- *********************************************************** -->
<a class="indexable" id="pre-requisites"></a>
<h3>Pre-requisites</h3>
<p>You will need to have access to a running instance of the
OpenWhisk platform to develop against.
</p>
<h5>Running OpenWhisk locally</h5>
<p>Developers can select to install and configure their own
instance from among any of the options listed here:
<a href="#openwhisk_deployment">OpenWhisk Deployment Options</a>.
</p>
<p>For local, "light weight" development, we recommend using
<a href="https://github.com/apache/openwhisk-deploy-kube/blob/master/README.md#kubernetes">Kubernetes</a>
enabled within Docker (i.e., Docker for Mac or Windows,
Minikube for Linux).
<ul>
<li>
For setup instructions, see: <a href="https://github.com/apache/openwhisk-deploy-kube/blob/master/README.md#prerequisites-kubernetes-and-helm">Simple Docker-based options</a>.
</li>
</ul>
<h5>Using OpenWhisk on a Cloud Provider</h5>
<p>Again, we encourage developers to leverage Cloud-based Kubernetes
services to deploy OpenWhisk.
</p>
<p>Another option would be to use Serverless provider that
already hosts Apache OpenWhisk and supports its Command
Line Interface (CLI) such as
<a href="https://console.bluemix.net/openwhisk/">IBM Cloud Functions.</a>
</p>
<!-- *********************************************************** -->
<!-- Developers - Using OpenWhisk -->
<!-- *********************************************************** -->
<a class="indexable" id="using-openwhisk"></a>
<h3>Using OpenWhisk</h3>
<p>By default, local deployments of Apache Openwhisk create
a guest account and endpoint for developers to use. However,
if you are running on an instance of OpenWhisk administered
by a Cloud provider, you will need to obtain an account and
endpoint information from them.
</p>
<h5>Default Guest Account</h5>
<p>
<a href="#openwhisk_deployment">OpenWhisk
Deployments</a> create a guest account configured with
the authentication key available at:
</p>
<ul>
<li>
Guest certificate: <a href="https://github.com/apache/openwhisk/blob/master/ansible/files/auth.guest">https://github.com/apache/openwhisk/blob/master/ansible/files/auth.guest</a>
</li>
</ul>
<h5>Default API Host</h5>
<p>Deployments of Apache Openwhisk set the default API
host endpoint, used with the Command Line Interface (CLI)
and the Whisk Deploy utility, to:
</p>
<ul><li><strong>192.168.33.13</strong>.</li></ul>
<p>However, when running under a Kubernetes deployment installed
using Helm, the endpoint's address and port are set in your
"mycluster.yaml" deployment file.
See the <a href="https://github.com/apache/openwhisk-deploy-kube/blob/master/README.md#deploy-with-helm">Deploy With Helm</a>
instructions for details.
</p>
</div>
</main>
<!-- *************************************************************** -->
<!-- Getting Started -->
<!-- *************************************************************** -->
<main class="doc">
<div class="content">
<a class="indexable" id="getting-started"></a>
<h3>Getting Started</h3>
<p>As a developer, you need the right tools for the job.
This section describes the various tools that you can use
to work with OpenWhisk which include:
</p>
<ul>
<li>
<a href="#wsk-cli">OpenWhisk Command Line Interface (CLI) (wsk)</a>
</li>
<li>
<a href="#wskdeploy">OpenWhisk Deployment Utility (wskdeploy)</a>
</li>
<li>
<a href="#rest-api">OpenWhisk REST API</a>
</li>
<li>
<a href="#openwhisk-clients">OpenWhisk Clients</a>
for JavaScript, Go, Swift and Python.
</li>
</ul>
<!-- ********************************************************** -->
<!-- OpenWhisk CLI -->
<!-- ********************************************************** -->
<a class="indexable" id="wsk-cli"></a>
<h4>OpenWhisk CLI <em>(wsk)</em></h4>
<p>OpenWhisk offers the <code>wsk</code> Command Line Interface
(CLI) to easily create, run, and manage OpenWhisk entities.
</p>
<p>For detailed information on setting up and configuring the
OpenWhisk CLI, go to the
<a href="https://github.com/apache/openwhisk/blob/master/docs/cli.md#openwhisk-cli">OpenWhisk CLI</a>
documentation page in GitHub.
</p>
<!-- Install: download & installing -->
<a class="indexable" id="wsk-cli-install"></a>
<h5>Installing</h5>
<p>You have a couple of choices on how to install the Whisk CLI
depending on your target Operating System:
</p>
<h6>Using Homebrew (Linux or Mac)</h6>
<div class="indented">
<p>To easily install the OpenWhisk CLI (wsk) you can
use <a href="https://brew.sh">Homebrew for Mac</a>
or <a href="http://linuxbrew.sh">Homebrew for Linux</a>.
</p>
<div class="terminal">
{% highlight bash %}
$ brew update
$ brew install wsk
{% endhighlight %}
</div>
<p>Then you can invoke the OpenWhisk CLI by just
typing <code>wsk</code> from the command line.
</p>
</div>
<h6>Download and install the wsk CLI from (Linux, Mac or Windows):</h6>
<ul>
<li>
<p>Download the OpenWhisk CLI for your Operating System as
a standalone compressed TAR Archive file (<code>.tgz</code>)
or ZIP file (<code>.zip</code>) from the project
<a href="https://github.com/apache/openwhisk-cli/releases">Releases</a> page
in GitHub:
</p>
<ul>
<li>
<a href="https://github.com/apache/openwhisk-cli/releases">https://github.com/apache/openwhisk-cli/releases</a>
</li>
</ul>
<p>where you may select to download the CLI from one of the versioned releases.
</p>
</li>
<li><p>Uncompress the <code>wsk</code> executable from
the <code>tar.gz</code> file.</p></li>
<li>
<div id="copy_to_path_instructions">
<p>Simplify access to the <code>wsk</code> executable by
moving or copying the binary file to a path listed
in your <code>PATH</code> environment variable.
This will enable you to invoke the OpenWhisk CLI by
just typing '<code>wsk</code>' on the command line
from anywhere.
</p>
<p>For example:</p>
<ul>
<li><p><b>Linux</b>: Move the <code>wsk</code> executable
to your local <code>bin</code> directory:</p>
<div class="terminal">
{% highlight bash %}$ sudo mv [full path to downloaded wsk executable] /usr/local/bin/wsk{% endhighlight %}
</div>
</li>
<li>
<p>
<b>Windows</b>: Follow instructions as linked here:
</p>
<ul>
<li>
<a href="https://www.computerhope.com/issues/ch000549.htm">How to set the path and environment variables in Windows</a>.
</li>
</ul>
</li>
</ul>
</div>
</li>
</ul>
<!-- Install: Verify -->
<a class="indexable" id="wsk-cli-verify"></a>
<h5>Verify Installation</h5>
<p>You can verify your installation by invoking the Whisk
CLI's help command:
</p>
<div class="indented">
<div class="terminal">
{% highlight bash %}$ wsk --help{% endhighlight %}
</div>
</div>
<!-- Install: Configuring -->
<a class="indexable" id="wsk-cli-configure"></a>
<h5>Configuring</h5>
<p>Before using the OpenWhisk CLI, you must first configure it
to point to the OpenWhisk platform you want the utility
to use (i.e., its API endpoint) and also provide it with your
associated authentication credentials.</p>
<h6 id="api_authentication">Setting the API Host and
Authentication Key</h6>
<div class="indented">
<p>You can configure wsk CLI to use your OpenWhisk
credentials in few different ways. See the
<a href="https://github.com/apache/openwhisk/blob/master/docs/cli.md#openwhisk-cli">Setting up the OpenWhisk CLI</a>
page for a full set of configuration options.
The instructions below walk you through the simplest
possible configuration using only an
<code>API_HOST</code> and <code>AUTH_KEY</code> CLI
properties using a default <code>guest</code>
namespace.</p>
<h6>wsk property setup</h6>
<p>Run the following command to set whisk API HOST and
authorization key to create the configuration file:</p>
<div class="terminal">
{% highlight bash %}
$ wsk property set --apihost API_HOST --auth AUTH_KEY --namespace guest
{% endhighlight %}
</div>
<p>The OpenWhisk CLI stores the properties set
in <code>~/.wskprops</code> by default.
The location of this file can be altered by setting the
<code>WSK_CONFIG_FILE</code> environment variable.
For example:
</p>
<div class="terminal">
{% highlight bash %}
$ export WSK_CONFIG_FILE=your-config-file
{% endhighlight %}
</div>
<h6>Verify properties</h6>
<p>Verify your properties were properly set by
using the <code>wsk property get</code> command:</p>
<div class="terminal">
{% highlight bash %}
$ wsk property get
{% endhighlight %}
</div>
</div>
<!-- Install: Test Configuration -->
<h5>Test configuration</h5>
<div class="indented">
<p>A simple "read" command will cause the CLI to authenticate
to the OpenWhisk your configured API host endpoint and
credentials.
is incorrect.</p>
<h6>Verify host connection</h6>
<p>Verify your host connection and credentials using
the <code>wsk list</code> command with the
<code>-v</code> (verbose) flag enabled.</p>
<div class="terminal">
{% highlight bash %}
$ wsk list -v
{% endhighlight %}
</div>
<p>You should see the full HTTP request and response headers
the CLI sends/receives to/from the host along with the
response codes.</p>
</div>
<!-- ********************************************************** -->
<!-- Whisk Deploy -->
<!-- ********************************************************** -->
<a class="indexable" id="wskdeploy"></a>
<h4>Whisk Deploy <em>(wskdeploy)</em></h4>
<p>
<a href="https://github.com/apache/openwhisk-wskdeploy/blob/master/README.md">Whisk Deploy</a>
is a utility, named <em>wskdeploy</em>, to help deploy and
manage all your OpenWhisk Packages, Actions, Triggers, Rules
and APIs from a single command using an application manifest.
</p>
<h5>Whisk deploy in the <em>wsk</em> CLI</h5>
<p>
The functionality of <em>wskdeploy</em> is also embedded as the <code>deploy</code> subcommand within the <em>wsk</em> CLI. The functionality is identical and supports all the same parameters and flags. This means that you can use the <code>wsk deploy</code> subcommand if you already have the CLI installed or follow the instructions below on installing the wskdeploy utility for standalone use.
</p>
<h5>Installing</h5>
<p>Download and Install the <code>wskdeploy</code> utility
for Linux, Mac or Windows.</p>
<div class="indented">
<h6>Download the Whisk Deploy utility</h6>
<ul>
<li>
<p> Download the Whisk Deploy utility for your Operating
System as a standalone compressed TAR Archive
file (<code>.tgz</code>) or ZIP file (<code>.zip</code>)
from the project
<a href="https://github.com/apache/openwhisk-wskdeploy/releases">Releases</a> page
in GitHub:
<ul>
<li>
<a href="https://github.com/apache/openwhisk-wskdeploy/releases">https://github.com/apache/openwhisk-wskdeploy/releases</a>
</li>
</ul>
<p>where you may select to download the utility from one of the versioned releases.</p>
</li>
<li>
<p>Uncompress the <code>wskdeploy</code> executable from
the <code>tar.gz</code> file.</p></li>
<li>
<p>Simplify access to the <code>wsk</code> executable by
moving or copying the binary file to a path listed
in your <code>PATH</code> environment variable.
This will enable you to invoke Whisk Deploy utility by
just typing '<code>wskdeploy</code>' on the command line
from anywhere.</p>
<p>Follow the
<a href="#copy_to_path_instructions">instructions</a>
as shown for the Whisk CLI to learn how to do this for
your development platform.
</p>
</li>
</ul>
</div>
<h5>Verify Installation</h5>
<div class="indented">
<p>Start by verifying the utility can display the command
line help:
</p>
<div class="terminal">
{% highlight bash %}$ wskdeploy --help{% endhighlight %}
</div>
</div>
<h5>Configure</h5>
<div class="indented">
<p>Before you proceed with the deployment, please make sure you have
setup the <code>API_HOST</code> and <code>AUTH_KEY</code> CLI
properties with a default namespace as described in the
<a href="#api_authentication">Whisk CLI configuration
section</a> above.
</p>
</div>
<h5>Test configuration</h5>
<ul>
<li>
<h6>Create and Deploy a simple OpenWhisk Manifest File</h6>
<p>Please refer to the
<a href="https://github.com/apache/openwhisk-wskdeploy/blob/master/docs/programming_guide.md#wskdeploy-utility-by-example">Whisk Deploy Programming Guide</a>
for all manifest file grammar and syntax. This programming
guide has step-by-step instructions for deploying OpenWhisk
applications using wskdeploy.
</p>
<p>Here is a simple YAML manifest example that has an in-line
function written in JavaScript that outputs "Hello World":
</p>
<div class="terminal">
{% highlight yaml %}
{% include code/manifest-for-helloJS-2.yaml %}
{% endhighlight %}
</div>
</li>
<li>Save the YAML scripts as an OpenWhisk Manifest file
called <code>manifest.yaml</code>
</li>
<li>
<p>Deploy the OpenWhisk Manifest file:</p>
<div class="terminal">
{% highlight bash %}$ wskdeploy -m manifest.yaml{% endhighlight %}
</div>
</li>
</ul>
<a class="indexable" id="additional-resources-wskdeploy"></a>
<h5>Additional Resources</h5>
<ul>
<li><a href="https://github.com/apache/openwhisk-wskdeploy/tree/master/specification#openwhisk-packaging-specification">OpenWhisk Packaging Specification</a></li>
<li><a href="https://github.com/apache/openwhisk-wskdeploy/blob/master/docs/programming_guide.md#wskdeploy-utility-by-example">Programming Guide - "<code>wskdeploy</code> utility by example"</a></li>
</ul>
<h6>Medium Blogs <span style="font-weight:normal;">(tagged <a href="https://medium.com/openwhisk/tagged/wskdeploy">wskdeploy</a>)</span></h6>
<ul>
<li><a href="https://medium.com/openwhisk/whisk-deploy-slack-package-f6690a1387e4">Whisk Deploy - Slack Package</a></li>
<li><a href="https://medium.com/openwhisk/whisk-deploy-github-dependency-b31799394e79">Whisk Deploy - GitHub Dependency</a></li>
<li><a href="https://medium.com/openwhisk/whisk-deploy-zip-actions-abcc8c01ac4">Whisk Deploy - Zip Actions</a></li>
<li><a href="https://medium.com/openwhisk/whisk-deploy-zip-actions-with-include-exclude-30ba6d96ad8b">Whisk Deploy - Zip Actions with file Include & Exclude</a></li>
<li><a href="https://medium.com/openwhisk/whisk-deploy-api-gateway-action-to-rest-api-cc52002c9d2c">Whisk Deploy - API Gateway (Action to REST API)</a></li>
<li><a href="https://medium.com/openwhisk/whisk-deploy-how-to-sync-openwhisk-projects-between-client-and-server-c7939f0642a1">Whisk Deploy - How to Sync OpenWhisk Projects between Client and Server?</a></li>
</ul>
<!-- ********************************************************** -->
<!-- OpenWhisk REST API -->
<!-- ********************************************************** -->
<a class="indexable" id="rest-api"></a>
<h4>OpenWhisk REST API</h4>
<p>
After your OpenWhisk environment is enabled, you can use
OpenWhisk with your web apps or mobile apps with REST API
calls.
For more details about the APIs for actions, activations,
packages, rules, and triggers, see the
<a href="https://github.com/apache/openwhisk/blob/master/docs/rest_api.md#using-rest-apis-with-openwhisk">OpenWhisk API</a>
documentation.
</p>
<!-- ********************************************************** -->
<!-- OpenWhisk Clients -->
<!-- ********************************************************** -->
<a class="indexable" id="openwhisk-clients"></a>
<h4>OpenWhisk Clients</h4>
<p>OpenWhisk provides a wrapper around the OpenWhisk APIs in
multiple different languages. These can be imported and used
directly in your favorite Integrated Development
Environment (IDE):</p>
<ul>
<li id="javascript-client"><a href="https://github.com/apache/openwhisk-client-js/blob/master/README.md#openwhisk-client-for-javascript">JavaScript</a></li>
<li id="go-client"><a href="https://github.com/apache/openwhisk-client-go/blob/master/README.md">Go</a></li>
</ul>
</div>
</main>
<!-- *************************************************************** -->
<!-- Creating and Invoking Actions -->
<!-- *************************************************************** -->
<main class="doc">
<div class="content">
<a class="indexable" id="actions-creating-and-invoking"></a>
<h3>Creating and Invoking Actions</h3>
<p>In this section, we will show you how to create and invoke your
first "Hello World" Action using both the OpenWhisk CLI and the
Whisk Deploy utility.
</p>
<p>All the canonical examples will be provided using JavaScript
using the NodeJS runtime; however, we also provide the same
examples for all other supported runtime languages
(e.g., Java, Python, Swift, etc.) where possible.
</p>
<h5>Select a language</h5>
<p>Select from the language example you would like to follow from the
list below.
</p>
<!-- ************************************** -->
<!-- Actions - JavaScript (NodeJS) -->
<!-- ************************************** -->
<a class="indexable" id="nodejs"></a>
<h6 id="section-nodejs" class="section-toggle">using NodeJS (JavaScript)</h6>
<div class="section-toggleable section-toggle-start-closed">
<p></p>
<a class="indexable" id="actions-nodejs"></a>
<h5>Creating and Invoking NodeJS actions</h5>
<p>
Let's look at how to write a sample hello world action in NodeJS. You can visit
<a href="https://github.com/apache/openwhisk/blob/master/docs/actions-nodejs.md#creating-and-invoking-javascript-actions">Creating and Invoking NodeJS actions</a>
page for further details.
</p>
<p>
<strong>Note:</strong> We will be using <i>wsk</i> CLI in this
section. If you don't have it installed and configured,
please refer to the section
<a href="#wsk-cli">OpenWhisk CLI (wsk)</a>.
</p>
<ol>
<li style="list-style-type: decimal">
Create a file named <i>hello.js</i>:
<div class="terminal">
{% highlight javascript linenos %}
{% include code/hello.js %}
{% endhighlight %}
</div>
</li>
<li style="list-style-type: decimal">
Create an action called <i>helloJS</i> using <i>hello.js</i>:
<div class="terminal">
{% highlight bash %}$ wsk action create helloJS hello.js{% endhighlight %}
</div>
<div class="terminal">
<pre>ok: created action helloJS</pre>
</div>
</li>
<li style="list-style-type: decimal">
Invoke the <i>helloJS</i> action as a blocking activation:
<div class="terminal">
{% highlight bash %}$ wsk action invoke helloJS --blocking{% endhighlight %}
</div>
<div class="terminal">
{% highlight yaml %}
{
"result": {
"payload": "Hello world"
},
"status": "success",
"success": true
}{% endhighlight %}
</div>
</li>
<li style="list-style-type: decimal">
Deploy using <i>wskdeploy</i>:
<p>
<strong>Note:</strong> We will be using <i>wskdeploy</i>
in this section. If you don't have the binary,
please refer to the section on
<a href="#wskdeploy">Whisk Deploy</a> to download it.
</p>
<ol>
<li>
Create <i>manifest.yaml</i> with the following YAML content:
<div class="terminal">
{% highlight yaml linenos %}
{% include code/manifest-for-helloJS-1.yaml %}
{% endhighlight %}
</div>
Or
<p></p>
<div class="terminal">
{% highlight yaml linenos %}
{% include code/manifest-for-helloJS-2.yaml %}
{% endhighlight %}
</div>
</li>
<li>
Run deployment with <i>wskdeploy</i>:
<div class="terminal">
{% highlight bash %}$ wskdeploy -m manifest.yaml{% endhighlight %}
</div>
</li>
</ol>
</li>
</ol>
<a class="indexable" id="nodejs-runtime"></a>
<h5>OpenWhisk Runtime for NodeJS</h5>
<p>
OpenWhisk supports <strong>Node.js 14</strong>, <strong>Node.js 12</strong>, <strong>Node.js 10</strong> runtimes where Node.js 10 being the default picked by wsk CLI and Whisk Deploy.
If you wish to learn more about NodeJS runtime along with
the libraries that are supported or "built-in" by default, please visit
<a href="https://github.com/apache/openwhisk-runtime-nodejs/blob/master/README.md">NodeJS Runtime GitHub Repository</a>.
</p>
<a class="indexable" id="nodejs-additional-resources"></a>
<h5>Additional Resources</h5>
<ul>
<li><a href="https://medium.com/openwhisk/integrating-openwhisk-with-your-node-application-d489b8a20102">Integrating OpenWhisk with Your Node Applications</a></li>
<li><a href="https://medium.com/openwhisk/migrating-from-a-node-app-to-serverless-d76f744b22c9">Migrating from a Node App to Serverless</a></li>
<li><a href="https://medium.com/openwhisk/debugging-node-js-openwhisk-actions-3da3303e6741">Debugging Node.js OpenWhisk Actions</a></li>
</ul>
<h6>Medium Blogs <span style="font-weight:normal;">(tagged <a href="https://medium.com/openwhisk/tagged/nodejs">nodejs</a>)</span></h6>
<ul>
<li><a href="https://medium.com/openwhisk/creating-zipped-actions-in-openwhisk-ccfcda553a30">Creating Zipped Actions in OpenWhisk</a></li>
<li><a href="https://medium.com/openwhisk/an-example-of-an-openwhisk-sequence-417d653c5952">An Example of an OpenWhisk Sequence</a></li>
<li><a href="https://medium.com/openwhisk/working-with-openwhisk-triggers-734fa9624ae5">Working with OpenWhisk Triggers</a></li>
<li><a href="https://medium.com/openwhisk/another-openwhisk-cron-example-the-blog-nag-dd0074821d2d">Another OpenWhisk Cron Example</a></li>
<li><a href="https://medium.com/openwhisk/building-a-serverless-api-proxy-with-openwhisk-16e5fd16f44f">Building a Serverless API Proxy with OpenWhisk</a></li>
<li><a href="https://medium.com/openwhisk/building-a-form-handler-service-in-openwhisk-55f15fb133a3">Building a Form Handler Service in OpenWhisk</a></li>
<li><a href="https://medium.com/openwhisk/deploying-express-js-apps-to-openwhisk-part-1-9133ba5f262c">Deploying Express.js apps to OpenWhisk (Part 1)</a></li>
<li><a href="https://medium.com/openwhisk/designing-an-openwhisk-action-for-web-action-support-4f0299481e74">Designing an OpenWhisk Action for Web Action Support</a></li>
</ul>
</div>
<!-- ************************************** -->
<!-- Actions - GoLang -->
<!-- ************************************** -->
<a class="indexable" id="go"></a>
<h6 id="section-go" class="section-toggle">using Go</h6>
<div class="section-toggleable section-toggle-start-closed">
<p></p>
<a class="indexable" id="actions-go"></a>
<h5>Creating And Invoking Go actions</h5>
<p>
Let's look at how to write a sample hello world action in Go. You can visit
<a href="https://github.com/apache/openwhisk/blob/master/docs/actions-go.md#creating-and-invoking-go-actions">Creating and Invoking Go actions</a>
page for further details.
</p>
<p>
<strong>Note:</strong> We will be using <i>wsk</i> CLI in this
section. If you don't have it installed and configured,
please refer to the section
<a href="#wsk-cli">OpenWhisk CLI (wsk)</a>.
</p>
<ol>
<li style="list-style-type: decimal">
<a class="indexable" id="hello-go"></a>
Create a file named <i>hello.go</i>:
<div class="terminal">
{% highlight go linenos %}
{% include code/hello.go %}
{% endhighlight %}
</div>
</li>
<li style="list-style-type: decimal">
Create an action <i>helloGo</i>:
<div class="terminal">
{% highlight bash %}$ wsk action create helloGo hello.go{% endhighlight %}
</div>
</li>
<li style="list-style-type: decimal">
Invoke an action <i>helloGo</i>:
<div class="terminal">
{% highlight bash %}$ wsk action invoke helloGo -r -p name gopher{% endhighlight %}
</div>
<div class="terminal">
{% highlight yaml %}
{
"msg": "Hello, gopher!"
}
{% endhighlight %}
</div>
</li>
<li style="list-style-type: decimal">
Deploy using <i>wskdeploy</i>:
<p>
<strong>Note:</strong> We will be using <i>wskdeploy</i> in
this section. If you don't have the binary,
please refer to the section
on <a href="#wskdeploy">Whisk Deploy</a> to download it.
</p>
<ol>
<li>Create a directory called <i>actions</i> with
<i>hello.go</i> from step 1 <a href="#hello-go">above</a>.
</li>
<li>
Create <i>manifest.yaml</i> with the following YAML content:
<div class="terminal">
{% highlight yaml linenos %}
{% include code/manifest-for-helloGo.yaml %}
{% endhighlight %}
</div>
</li>
<li>
Run deployment with <i>wskdeploy</i>:
<div class="terminal">
{% highlight bash %}$ wskdeploy -m manifest.yaml{% endhighlight %}
</div>
</li>
</ol>
</li>
</ol>
<a class="indexable" id="go-runtime"></a>
<h5>OpenWhisk Runtime for Go</h5>
<p>
If you wish to learn more about Go runtime along with
the libraries that are supported or "built-in" by
default, please visit
<a href="https://github.com/apache/openwhisk-runtime-go/blob/master/README.md">Go Runtime GitHub Repository</a>.
</p>
<a class="indexable" id="go-additional-resources"></a>
<h5>Additional Resources</h5>
<ul>
<li><a href="https://www.slideshare.net/MicheleSciabarr/openwhisk-go-runtime">OpenWhisk Go Runtime</a></li>
<li><a href="https://www.slideshare.net/MicheleSciabarr/openwhisk-goswiftbinaries-runtime">ActionLoop, Go and Swift</a></li>
</ul>
<!-- <h6>Medium Blogs <span style="font-weight:normal;">(tagged <a href="https://medium.com/openwhisk/tagged/golang">golang</a>)</span></h6>
<ul>
<li><a href=""></a></li>
<li><a href=""></a></li>
<li><a href=""></a></li>
</ul> -->
</div>
<!-- ************************************** -->
<!-- Actions - Python -->
<!-- ************************************** -->
<a class="indexable" id="python"></a>
<h6 id="section-python" class="section-toggle">using Python</h6>
<div class="section-toggleable section-toggle-start-closed">
<p></p>
<a class="indexable" id="actions-python"></a>
<h5>Creating And Invoking Python actions</h5>
<p>
Let's look at how to write a sample hello world action in Python. You can visit
<a href="https://github.com/apache/openwhisk/blob/master/docs/actions-python.md#creating-and-invoking-python-actions">Creating and Invoking Python actions</a>
page for further details.
</p>
<p>
<strong>Note:</strong> We will be using <i>wsk</i> CLI in this
section. If you don't have it installed and configured,
please refer to the section
<a href="#wsk-cli">OpenWhisk CLI (wsk)</a>.
</p>
<ol>
<li style="list-style-type: decimal">Create a file named <i>hello.py</i>:
<div class="terminal">
{% highlight python linenos %}
{% include code/hello.py %}
{% endhighlight %}
</div>
</li>
<li style="list-style-type: decimal">Create an action called <i>helloPy</i> using <i>hello.py</i>:
<div class="terminal">
{% highlight bash %}$ wsk action create helloPy hello.py{% endhighlight %}
</div>
<div class="terminal">
<pre>ok: created action helloPy</pre>
</div>
</li>
<li style="list-style-type: decimal">Invoke the <i>helloPy</i> action using command-line parameters:
<div class="terminal">
{% highlight bash %}$ wsk action invoke helloPy --blocking --param name World{% endhighlight %}
</div>
<div class="terminal">
{% highlight yaml %}
{
"greeting": "Hello World!"
}
{% endhighlight %}
</div>
</li>
<li style="list-style-type: decimal">Deploy using <i>wskdeploy</i>:
<p>
<strong>Note:</strong> We will be using <i>wskdeploy</i> in this section. If you don't have the binary,
please refer to the section on <a href="#wskdeploy">Whisk Deploy</a> to download it.
</p>
<ol>
<li>Create <i>manifest.yaml</i> with the following YAML content:
<div class="terminal">
{% highlight yaml linenos %}
{% include code/manifest-for-helloPy-1.yaml %}
{% endhighlight %}
</div>
Or
<p></p>
<div class="terminal">
{% highlight yaml linenos %}
{% include code/manifest-for-helloPy-2.yaml %}
{% endhighlight %}
</div>
</li>
<li>
Run deployment with <i>wskdeploy</i>:
<div class="terminal">
{% highlight bash %}$ wskdeploy -m manifest.yaml{% endhighlight %}
</div>
</li>
</ol>
</li>
</ol>
<a class="indexable" id="python-runtime"></a>
<h5>OpenWhisk Runtime for Python</h5>
<p>
OpenWhisk supports <strong>Python 2</strong> and <strong>Python 3</strong> runtimes where Python 2 being default pick by wsk CLI and Whisk Deploy.
If you wish to learn more about Python runtime along with
the libraries that are supported or "built-in" by default, please visit
<a href="https://github.com/apache/openwhisk-runtime-python/blob/master/README.md">Python Runtime GitHub Repository</a>.
</p>
<a class="indexable" id="python-additional-resources"></a>
<h5>Additional Resources</h5>
<ul>
<li><a href="http://jamesthom.as/blog/2017/04/27/python-packages-in-openwhisk/">Using External Python Libraries in OpenWhisk</a></li>
<li><a href="https://www.slideshare.net/CodeOps/openwhisk-by-example-auto-retweeting-example-in-python">Auto Retweeting Example in Python</a></li>
</ul>
<h6>Medium Blogs <span style="font-weight:normal;">(tagged <a href="https://medium.com/openwhisk/tagged/python">python</a>)</span></h6>
<!-- <ul>
<li><a href="https://medium.com/openwhisk/python-packages-in-openwhisk-8d10dcd91257">Python Packages in OpenWhisk</a></li>
<li><a href="https://medium.com/openwhisk/large-applications-on-openwhisk-bcf15bff94ec">Large Applications on OpenWhisk</a></li>
</ul> -->
</div>
<!-- ************************************** -->
<!-- Actions - Java -->
<!-- ************************************** -->
<a class="indexable" id="java"></a>
<h6 id="section-java" class="section-toggle">using Java</h6>
<div class="section-toggleable section-toggle-start-closed">
<p></p>
<a class="indexable" id="actions-java"></a>
<h5>Creating and Invoking Java actions</h5>
<p>
Let's look at how to write a sample hello world action in
Java. You can visit
<a href="https://github.com/apache/openwhisk/blob/master/docs/actions-java.md#creating-and-invoking-java-actions">Creating and Invoking Java actions</a>
page for further details.
</p>
<p>
<strong>Note:</strong> We will be using <i>wsk</i> CLI in this
section. If you don't have it installed and configured,
please refer to the section
<a href="#wsk-cli">OpenWhisk CLI (wsk)</a>.
</p>
<ol>
<li style="list-style-type: decimal">
Create a file named <i>Hello.java</i>:
<div class="terminal">
{% highlight java linenos %}
{% include code/Hello.java %}
{% endhighlight %}
</div>
</li>
<li style="list-style-type: decimal">
<p>
Assure that you have downloaded the JAR file for the imported `com.google.gson.JsonObject` library (i.e., <a target="_blank" href="https://mvnrepository.com/artifact/com.google.code.gson/gson/2.8.5">google-gson-2.8.5.jar</a> from Maven) to your Java `CLASSPATH`.
</p>
</li>
<li style="list-style-type: decimal">
Compile <i>Hello.Java</i> into a JAR file
<i>hello.jar</i> as follows
<div class="terminal">
{% highlight bash %}
$ javac Hello.java
$ jar cvf hello.jar Hello.class
{% endhighlight %}
</div>
<div>Please note that the current default JVM for OpenWhisk is Java 8. If you are using a newer version, you must specify that release version when you compile:
</div>
<div class="terminal">
{% highlight bash %}
$ javac --release 8 Hello.java
{% endhighlight %}
</div>
</li>
<li style="list-style-type: decimal">
Create an action called <i>helloJava</i> using <i>hello.jar</i> specifying the Java class where the `main` entry point you wish to invoke:
<div class="terminal">
{% highlight bash %}$ wsk action create helloJava hello.jar --main Hello{% endhighlight %}
</div>
<div class="terminal">
{% highlight yaml %}ok: created action helloJava{% endhighlight %}
</div>
</li>
<li style="list-style-type: decimal">
Invoke an action <i>helloJava</i>:
<div class="terminal">
{% highlight bash %}$ wsk action invoke helloJava --blocking --result{% endhighlight %}
</div>
<div class="terminal">
{% highlight yaml %}
{
"greeting": "Hello stranger!"
}
{% endhighlight %}
</div>
</li>
</ol>
<a class="indexable" id="java-runtime"></a>
<h5>OpenWhisk Runtime for Java</h5>
<p>
OpenWhisk supports <strong>Java 8</strong> runtime.
If you wish to learn more about NodeJS runtime along with
the libraries that are supported or "built-in" by default,
please visit
<a href="https://github.com/apache/openwhisk-runtime-java/blob/master/README.md">Java Runtime GitHub Repository</a>.
</p>
<a class="indexable" id="java-additional-resources"></a>
<h5>Additional Resources</h5>
<ul>
<li>
<a href="https://www.ibm.com/blogs/bluemix/2017/02/building-openwhisk-actions-java-gradle/">Building OpenWhisk actions with Java and Gradle</a>
</li>
</ul>
<!-- TODO: Java blogs are outdated / need update -->
<!-- <h6>Medium Blogs <span style="font-weight:normal;">(tagged <a href="https://medium.com/openwhisk/tagged/java">java</a>)</span></h6>
<ul>
<li><a href="https://www.ibm.com/blogs/bluemix/2017/02/building-openwhisk-actions-java-gradle/">OpenWhisk actions with Java and Gradle</a></li>
<li><a href=""></a></li>
<li><a href=""></a></li>
</ul> -->
</div>
<!-- ************************************** -->
<!-- Actions - PHP -->
<!-- ************************************** -->
<a class="indexable" id="php"></a>
<h6 id="section-php" class="section-toggle">using PHP</h6>
<div class="section-toggleable section-toggle-start-closed">
<p></p>
<a class="indexable" id="actions-php"></a>
<h5>Creating and Invoking PHP actions</h5>
<p>
Let's look at how to write a sample hello world action in PHP.
You can visit
<a href="https://github.com/apache/openwhisk/blob/master/docs/actions-php.md#creating-and-invoking-php-actions">Creating and Invoking PHP actions</a>
page for further details.
</p>
<p>
<strong>Note:</strong> We will be using <i>wsk</i> CLI in this
section. If you don't have it installed and configured,
please refer to the section
<a href="#wsk-cli">OpenWhisk CLI (wsk)</a>.
</p>
<ol>
<li style="list-style-type: decimal">
Create a file named <i>hello.php</i>:
<div class="terminal">
{% highlight php linenos %}
{% include code/hello.php %}
{% endhighlight %}
</div>
</li>
<li style="list-style-type: decimal">
Create an action called <i>helloPHP</i> using <i>hello.php</i>:
<div class="terminal">
{% highlight bash %}$ wsk action create helloPHP hello.php{% endhighlight %}
</div>
<div class="terminal">
{% highlight bash %}ok: created action helloPHP{% endhighlight %}
</div>
</li>
<li style="list-style-type: decimal">
Invoke an action <i>helloPHP</i>:
<div class="terminal">
{% highlight bash %}$ wsk action invoke helloPHP --blocking --result --param name World{% endhighlight %}
</div>
<div class="terminal">
{% highlight yaml %}
{
"greeting": "Hello World!"
}
{% endhighlight %}
</div>
</li>
<li style="list-style-type: decimal">
Deploy using <i>wskdeploy</i>:
<p>
<strong>Note:</strong> We will be using <i>wskdeploy</i>
in this section. If you don't have the binary,
please refer to the section
on <a href="#wskdeploy">Whisk Deploy</a> to download it.
</p>
<ol>
<li>
Create <i>manifest.yaml</i> with the following
YAML content:
<div class="terminal">
{% highlight yaml linenos %}
{% include code/manifest-for-helloPhp-1.yaml %}
{% endhighlight %}
</div>
Or
<p></p>
<div class="terminal">
{% highlight yaml linenos %}
{% include code/manifest-for-helloPhp-2.yaml %}
{% endhighlight %}
</div>
</li>
<li>
Run deployment with <i>wskdeploy</i>:
<div class="terminal">
{% highlight bash %}$ wskdeploy -m manifest.yaml{% endhighlight %}
</div>
</li>
</ol>
</li>
</ol>
<a class="indexable" id="php-runtime"></a>
<h5>OpenWhisk Runtime for PHP</h5>
<p>
OpenWhisk supports <strong>PHP 7.4</strong>, <strong>PHP 7.3</strong> and <strong>PHP 7.2</strong> runtimes where PHP 7.4 is the default pick by wsk CLI and Whisk Deploy.
If you wish to learn more about PHP runtime, please visit
<a href="https://github.com/apache/openwhisk-runtime-php/blob/master/README.md">PHP Runtime GitHub Repository</a>.
</p>
<a class="indexable" id="php-additional-resources"></a>
<h5>Additional Resources</h5>
<ul>
<li><a href="https://akrabat.com/getting-started-with-serverless-php/">Getting Started with Serverless PHP</a></li>
<li><a href="https://lornajane.net/posts/2018/handle-webhooks-with-serverless-php">Handle Webhooks with Serverless PHP on OpenWhisk</a></li>
</ul>
<h6>Medium Blogs <span style="font-weight:normal;">(tagged <a href="https://medium.com/openwhisk/tagged/php">php</a>)</span></h6>
<ul>
<li><a href="https://medium.com/openwhisk/using-serverless-framework-with-apache-openwhisk-and-php-76472727e9d8">Using Serverless Framework with OpenWhisk PHP</a></li>
<li><a href="https://medium.com/openwhisk/serverless-php-how-to-implement-serverless-functions-in-php-using-openwhisk-9943dc06f544">Serverless PHP: How to implement serverless functions in PHP using OpenWhisk</a></li>
</ul>
</div>
<!-- ************************************** -->
<!-- Actions - Ruby -->
<!-- ************************************** -->
<a class="indexable" id="ruby"></a>
<h6 id="section-ruby" class="section-toggle">using Ruby</h6>
<div class="section-toggleable section-toggle-start-closed">
<p></p>
<a class="indexable" id="actions-ruby"></a>
<h5>Creating and Invoking Ruby actions</h5>
<p>
Let's look at how to write a sample hello world action in Ruby.
You can visit
<a href="https://github.com/apache/openwhisk/blob/master/docs/actions-ruby.md#creating-and-invoking-ruby-actions">Creating and Invoking Ruby actions</a>
page for further details.
</p>
<p>
<strong>Note:</strong> We will be using <i>wsk</i> CLI in this
section. If you don't have it installed and configured,
please refer to the section
<a href="#wsk-cli">OpenWhisk CLI (wsk)</a>.
</p>
<ol>
<li style="list-style-type: decimal">
Create a file named <i>hello.rb</i>:
<div class="terminal">
{% highlight ruby linenos %}
{% include code/hello.rb %}
{% endhighlight %}
</div>
</li>
<li style="list-style-type: decimal">
Create an action called <i>hello_ruby</i> using <i>hello.rb</i>:
<div class="terminal">
{% highlight bash %}$ wsk action create hello_ruby hello.rb{% endhighlight %}
</div>
<div class="terminal">
{% highlight bash %}ok: created action hello_ruby{% endhighlight %}
</div>
</li>
<li style="list-style-type: decimal">
Invoke an action <i>hello_ruby</i>:
<div class="terminal">
{% highlight bash %}$ wsk action invoke hello_ruby --blocking --result --param name World{% endhighlight %}
</div>
<div class="terminal">
{% highlight yaml %}
{
"greeting": "Hello World!"
}
{% endhighlight %}
</div>
</li>
<li style="list-style-type: decimal">
Deploy using <i>wskdeploy</i>:
<p>
<strong>Note:</strong> We will be using <i>wskdeploy</i> in this section. If you don't have the binary,
please refer to the section on <a href="#wskdeploy">Whisk Deploy</a> to download it.
</p>
<ol>
<li>
Create <i>manifest.yaml</i> with the following YAML content:
<div class="terminal">
{% highlight yaml linenos %}
{% include code/manifest-for-helloRuby-1.yaml %}
{% endhighlight %}
</div>
Or
<p></p>
<div class="terminal">
{% highlight yaml linenos %}
{% include code/manifest-for-helloRuby-2.yaml %}
{% endhighlight %}
</div>
</li>
<li>
Run deployment with <i>wskdeploy</i>:
<div class="terminal">
{% highlight bash %}$ wskdeploy -m manifest.yaml{% endhighlight %}
</div>
</li>
</ol>
</li>
</ol>
<a class="indexable" id="ruby-runtime"></a>
<h5>OpenWhisk Runtime for Ruby</h5>
<p>
OpenWhisk supports <strong>Ruby 2.5</strong> runtime.
If you wish to learn more about Ruby runtime, please visit
<a href="https://github.com/apache/openwhisk-runtime-ruby/blob/master/README.md">Ruby Runtime GitHub Repository</a>.
</p>
<a class="indexable" id="ruby-additional-resources"></a>
<h5>Additional Resources</h5>
<p></p>
<h6>Medium Blogs <span style="font-weight:normal;">(tagged <a href="https://medium.com/openwhisk/tagged/ruby">ruby</a>)</span></h6>
<ul>
<li><a href="https://medium.com/openwhisk/ruby-goes-serverless-apache-openwhisk-adds-native-support-for-ruby-7134faee14e">Ruby goes Serverless! - Apache OpenWhisk adds native support for Ruby</a></li>
</ul>
</div>
<!-- ************************************** -->
<!-- Actions - Swift -->
<!-- ************************************** -->
<a class="indexable" id="swift"></a>
<h6 id="section-swift" class="section-toggle">using Swift</h6>
<div class="section-toggleable section-toggle-start-closed">
<p></p>
<a class="indexable" id="actions-swift"></a>
<h5>Creating And Invoking Swift Actions</h5>
<p>
Let's look at how to write a sample hello world action in Swift.
You can visit
<a href="https://github.com/apache/openwhisk-runtime-swift#quick-swift-action">Quick Swift Action</a>
page for further details.
</p>
<p>
<strong>Note:</strong> We will be using <i>wsk</i> CLI in this
section. If you don't have it installed and configured,
please refer to the section
<a href="#wsk-cli">OpenWhisk CLI (wsk)</a>.
</p>
<ol>
<li style="list-style-type: decimal">
<a class="indexable" id="hello-swift"></a>
Create a file named <i>hello.swift</i>:
<div class="terminal">
{% highlight java linenos %}
{% include code/hello.swift %}
{% endhighlight %}
</div>
</li>
<li style="list-style-type: decimal">
Create an action <i>helloSwift</i>:
<div class="terminal">
{% highlight bash %}$ wsk action create helloSwift hello.swift{% endhighlight %}
</div>
</li>
<li style="list-style-type: decimal">
Invoke an action <i>helloSwift</i>:
<div class="terminal">
{% highlight bash %}$ wsk action invoke helloSwift -r -p name Carlos{% endhighlight %}
</div>
<div class="terminal">
{% highlight yaml %}
{
"msg": "Hello Carlos!"
}
{% endhighlight %}
</div>
</li>
<li style="list-style-type: decimal">
Deploy using <i>wskdeploy</i>:
<p>
<strong>Note:</strong> We will be using <i>wskdeploy</i> in
this section. If you don't have the binary,
please refer to the section
on <a href="#wskdeploy">Whisk Deploy</a> to download it.
</p>
<ol>
<li>Create a directory called <i>actions</i> with
<i>hello.swift</i> from step 1 <a href="#hello-swift">above</a>.
</li>
<li>
Create <i>manifest.yaml</i> with the following YAML content:
<div class="terminal">
{% highlight yaml linenos %}
{% include code/manifest-for-helloSwift.yaml %}
{% endhighlight %}
</div>
</li>
<li>
Run deployment with <i>wskdeploy</i>:
<div class="terminal">
{% highlight bash %}$ wskdeploy -m manifest.yaml{% endhighlight %}
</div>
</li>
</ol>
</li>
</ol>
<a class="indexable" id="swift-runtime"></a>
<h5>OpenWhisk Runtime for Swift</h5>
<p>
If you wish to learn more about Swift runtime along with
the libraries that are supported or "built-in" by
default, please visit the project README
<a href="https://github.com/apache/openwhisk-runtime-swift#apache-openwhisk-runtimes-for-swift">Apache OpenWhisk runtimes for Swift</a>.
</p>
<a class="indexable" id="swift-additional-resources"></a>
<h5>Additional Resources</h5>
<ul>
<li><a href="https://github.com/apache/openwhisk-runtime-swift#swift-4x-support">Swift 4.x Codeable style example</a></li>
<li><a href="https://github.com/apache/openwhisk-runtime-swift#packaging-an-action-as-a-swift-executable-using-swift-4">Packaging an action as a Swift executable using Swift 4</a></li>
</ul>
<h6>Medium Blogs <span style="font-weight:normal;">(tagged <a href="https://medium.com/openwhisk/tagged/swift">swift</a>)</span></h6>
<ul>
<li><a href="https://medium.com/openwhisk/serverless-swift-with-openwhisk-4f84129e6839">Serverless Swift With OpenWhisk</a></li>
<li><a href="https://medium.com/openwhisk/creating-swift-binaries-for-openwhisk-487526d0d576">Creating Swift Binaries for OpenWhisk</a></li>
<li><a href="https://medium.com/openwhisk/creating-an-openwhisk-alexa-skill-583824bf58cb">Creating an OpenWhisk Alexa skill</a> using Swift</li>
</ul>
</div>
<!-- ************************************** -->
<!-- Actions - .NET Core -->
<!-- ************************************** -->
<a class="indexable" id="dotnet"></a>
<h6 id="section-dotnet" class="section-toggle">using .NET Core</h6>
<div class="section-toggleable section-toggle-start-closed">
<p></p>
<a class="indexable" id="actions-dotnet"></a>
<h5>Creating And Invoking .NET Core Actions</h5>
<p>
Let's look at how to write a sample hello world action in .NET Core.
You can visit
<a href="https://github.com/apache/openwhisk-runtime-dotnet#quick-net-core-action">Quick .NET Core Action</a>
page for further details.
</p>
<p>
<strong>Note:</strong> We will be using <i>wsk</i> CLI in this
section. If you don't have it installed and configured,
please refer to the section
<a href="#wsk-cli">OpenWhisk CLI (wsk)</a>.
</p>
<ol>
<li style="list-style-type: decimal">
<a class="indexable" id="hello-dotnet"></a>
Create a C# project called <i>Apache.OpenWhisk.Example.Dotnet</i>:
<div class="terminal">
{% highlight bash %}
$ dotnet new classlib -n Apache.OpenWhisk.Example.Dotnet -lang C#
{% endhighlight %}
</div>
</li>
<li style="list-style-type: decimal">
Navigate to the <i>Apache.OpenWhisk.Example.Dotnet</i> directory:
<div class="terminal">
{% highlight bash %}
$ cd Apache.OpenWhisk.Example.Dotnet
{% endhighlight %}
</div>
</li>
<li style="list-style-type: decimal">
Install the <i>Newtonsoft.Json</i> NuGet package as follows:
<div class="terminal">
{% highlight bash %}
$ dotnet add package Newtonsoft.Json -v 12.0.1
{% endhighlight %}
</div>
</li>
<li style="list-style-type: decimal">
Create a file called <i>Hello.cs</i> with the following content:
<div class="terminal">
{% highlight java linenos %}
{% include code/Hello.cs %}
{% endhighlight %}
</div>
</li>
<li style="list-style-type: decimal">
Publish the project as follows:
<div class="terminal">
{% highlight bash %}
$ dotnet publish -c Release -o out
{% endhighlight %}
</div>
</li>
<li style="list-style-type: decimal">
Publish the project as follows:
<div class="terminal">
{% highlight bash %}
$ cd out
$ zip -r -0 helloDotNet.zip *
{% endhighlight %}
</div>
</li>
<li style="list-style-type: decimal">
Create an action <i>helloDotNet</i>:
<div class="terminal">
{% highlight bash %}
$ wsk action create helloDotNet helloDotNet.zip --main Apache.OpenWhisk.Example.Dotnet::Apache.OpenWhisk.Example.Dotnet.Hello::Main --kind dotnet:2.2
{% endhighlight %}
</div>
</li>
<li style="list-style-type: decimal">
Invoke an action <i>helloDotNet</i>:
<div class="terminal">
{% highlight bash %}
$ wsk action invoke helloDotNet -r -p name Shawn
{% endhighlight %}
</div>
<div class="terminal">
{% highlight yaml %}
{
"msg": "Hello Shawn!"
}
{% endhighlight %}
</div>
</li>
</ol>
<a class="indexable" id="dotnet-runtime"></a>
<h5>OpenWhisk Runtime for .NET Core</h5>
<p>
If you wish to learn more about .NET Core runtime along with
the libraries that are supported or "built-in" by
default, please visit the project README
<a href="https://github.com/apache/openwhisk-runtime-dotnet#apache-openwhisk-runtimes-for-net-core">Apache OpenWhisk runtimes for .NET Core</a>.
</p>
<a class="indexable" id="dotnet-additional-resources"></a>
<h5>Additional Resources</h5>
<a href="https://github.com/apache/openwhisk/blob/master/docs/actions-dotnet.md">Creating and invoking .NET Core actions</a>
</div>
<!-- ************************************** -->
<!-- TODO: Actions - Docker -->
<!-- ************************************** -->
<!-- <h4 id="section-docker">using Docker</h4>
<p></p>
<h5 id="docker_actions">Creating and Invoking Docker actions</h5>
<p>
OpenWhisk provides a base image for Docker actions called openwhisk/dockerskeleton. This image is based on Alpine Linux 3.4 and includes Python v2.7.12 but not much else. (For reference, the image is based on python:2.7.12-alpine).
From this base image, you can create and run an OpenWhisk action:
Let's look at how to write a sample hello world action in Docker. You can visit
<a href="https://github.com/apache/openwhisk/blob/master/docs/actions-docker.md#creating-and-invoking-docker-actions">Creating and Invoking Docker actions</a>
page for further details.
</p>
<h5 id="docker-runtime">OpenWhisk Runtime for Docker</h5>
<p>
</p>
<h5 id="docker-other-resources">Other Resources</h5>
<p>
<ul>
<li><a href="http://jamesthom.as/blog/2017/01/16/openwhisk-docker-actions/">OpenWhisk Docker Actions</a></li>
<li><a href="https://www.ibm.com/blogs/bluemix/2017/01/docker-bluemix-openwhisk/">Understanding and using Docker actions in IBM Bluemix OpenWhisk</a></li>
</ul>
</p> -->
</div>
</main> <!-- creating and invoking actions -->
<!-- *************************************************************** -->
<!-- Packages Managing Actions -->
<!-- *************************************************************** -->
<main class="doc">
<div class="content">
<a class="indexable" id="managing_actions_with_openwhisk_packages"></a>
<h3>Managing Actions with OpenWhisk Packages</h3>
<p>
<question>What is a package?</question> In OpenWhisk, you can use packages to bundle together a set of related actions, and share them with others.
OpenWhisk comes with a list of packages
You can get more details on OpenWhisk packages
<a href="https://github.com/apache/openwhisk/blob/master/docs/packages.md#using-and-creating-openwhisk-packages">here</a>.
</p>
<p>
<question>Does OpenWhisk comes with any pre-installed packages?</question>
OpenWhisk comes with a list of pre-installed public packages which can be used by anyone.
OpenWhisk has created a dedicated shared namespace <strong>/whisk.system</strong> for all the public packages.
</p>
<p>
<question>Which all packages are available under /whisk.system?</question>
You can get a list of packages available in shared namespace by using wsk CLI:
</p>
<ul>
<li>
Get a list of packages:
<div class="terminal">
{% highlight bash %}$ wsk package list /whisk.system{% endhighlight %}
</div>
</li>
<li>
Get a list of entities in a package:
<div class="terminal">
{% highlight bash %}$ wsk package get --summary /whisk.system/<package-name>{% endhighlight %}
</div>
</li>
</ul>
<p>
<question>How do I invoke an action from a public package?</question>
There are two way to invoke an action from a package,
(1) Invoking an action directly from a package
(2) Creating a package binding and then invoking an action in the binding.
</p>
<ul>
<li>
Invoking an action from a public package:
<ul>
<li style="list-style: circle">
Get a description of the /whisk.system/samples/greeting action:
<div class="terminal">
{% highlight bash %}$ wsk action get --summary /whisk.system/samples/greeting{% endhighlight %}
</div>
<div class="terminal">
<pre>action /whisk.system/samples/greeting:
Returns a friendly greeting
(parameters: name, place)</pre>
</div>
</li>
<li style="list-style: circle">
Invoking action in a package:
<div class="terminal">
{% highlight bash %}$ wsk action invoke --result /whisk.system/samples/greeting{% endhighlight %}
</div>
<div class="terminal">
{% highlight yaml %}
{
"payload": "Hello, stranger from somewhere!"
}
{% endhighlight %}
</div>
</li>
<li style="list-style: circle">
Invoke the action with parameters:
<div class="terminal">
{% highlight bash %}$ wsk action invoke --result /whisk.system/samples/greeting --param name Bernie --param place Vermont{% endhighlight %}
</div>
<div class="terminal">
{% highlight yaml %}
{
"payload": "Hello, Bernie from Vermont!"
}
{% endhighlight %}
</div>
</li>
</ul>
</li>
<li>Creating package binding and invoking action from the binding:
<ul>
<li style="list-style: circle">
Creating and using package bindings:
<div class="terminal">
{% highlight bash %}$ wsk package bind /whisk.system/samples valhallaSamples --param place Valhalla{% endhighlight %}
</div>
<div class="terminal">
{% highlight bash %}ok: created binding valhallaSamples{% endhighlight %}
</div>
</li>
<li style="list-style: circle">
Invoke an action in the package binding:
<div class="terminal">
{% highlight bash %}$ wsk action invoke --result valhallaSamples/greeting --param name Odin{% endhighlight %}
</div>
<div class="terminal">
{% highlight yaml %}
{
"payload": "Hello, Odin from Valhalla!"
}
{% endhighlight %}
</div>
</li>
</ul>
</li>
</ul>
<p>
<question>Where do I get more information on packages?</question>
Please read
<a href="https://github.com/apache/openwhisk/blob/master/docs/packages.md#using-and-creating-openwhisk-packages">OpenWhisk Packages</a>
for further details.
</p>
</div>
</main>
<main class="doc">
<div class="content">
<a class="indexable" id="automating_actions_from_event_sources"></a>
<h3>Automating Actions from Event Sources</h3>
<p>In this section, we will show how to automate Actions in response
to events coming from Event Sources.
Specifically, we will show how to create, fire
and associate a basic Trigger with input parameters to an Action
using a Rule.
</p>
<h5>Create and fire Trigger</h5>
<ul>
<li>
Create a trigger to send user location updates:
<div class="terminal">
{% highlight bash %}$ wsk trigger create locationUpdate{% endhighlight %}
</div>
</li>
<li>
Check you have created the trigger by listing the set
of triggers:
<div class="terminal">
{% highlight bash %}$ wsk trigger list{% endhighlight %}
</div>
<div class="terminal">
<pre>triggers
/someNamespace/locationUpdate private</pre>
</div>
</li>
<li>
Fire the trigger by specifying its name and parameters:
<div class="terminal">
{% highlight bash %}$ wsk trigger fire locationUpdate --param name Bob --param place NYC{% endhighlight %}
</div>
<div class="terminal">
<pre>ok: triggered locationUpdate</pre>
</div>
<p>
Firing a trigger like this currently does not do
anything. We need to associate this trigger with
an action. This kind of association is called a rule.
</p>
</li>
</ul>
<h5>Verify you have an Action created</h5>
<ul>
<li>
Please make sure you have the <i>hello</i> action created.
If not, you can follow instruction in the section
<a href="#actions-nodejs">above</a> with the
following <i>hello.js</i>.
<div class="terminal">
{% highlight javascript linenos %}
{% include code/hello-with-params.js %}
{% endhighlight %}
</div>
<div class="terminal">
{% highlight bash %}$ wsk action create hello hello.js{% endhighlight %}
</div>
<div class="terminal">
{% highlight bash %}$ wsk action invoke --result hello --param name Bernie --param place Vermont{% endhighlight %}
</div>
<div class="terminal">
{% highlight yaml %}
{
"payload": "Hello, Bernie from Vermont"
}
{% endhighlight %}
</div>
</li>
</ul>
<h5>Associate the Trigger and Action using a Rule</h5>
<ul>
<li>
Create the rule (i.e., an association):
<div class="terminal">
{% highlight bash %}$ wsk rule create myRule locationUpdate hello{% endhighlight %}
</div>
<div class="terminal">
<pre>ok: created rule myRule</pre>
</div>
</li>
</ul>
<h5>Invoke the Action by Firing the Trigger</h5>
<ul>
<li>
Fire the <i>locationUpdate</i> trigger:
<div class="terminal">
{% highlight bash %}$ wsk trigger fire locationUpdate --param name Bob --param place NYC{% endhighlight %}
</div>
<div class="terminal">
<pre>ok: triggered /_/locationUpdate with id abcd...</pre>
</div>
</li>
<li>
Verify that the action was invoked by checking the activations list:
<div class="terminal">
{% highlight bash %}$ wsk activation list --limit 2{% endhighlight %}
</div>
<div class="terminal">
<pre>activations
1234.... hello
abcd.... locationUpdate
</pre>
</div>
</li>
<li>
Retrieving the trigger activation record:
<div class="terminal">
{% highlight bash %}$ wsk activation result 1234....{% endhighlight %}
</div>
<div class="terminal">
{% highlight yaml %}{
"payload": "Hello, Bob from NYC"
}
{% endhighlight %}
</div>
You can see that the hello action received the event payload and returned the expected string.
</li>
</ul>
</div>
</main>
<main class="doc">
<div class="content">
<a class="indexable" id="using_openwhisk_enabled_services"></a>
<h3>Using OpenWhisk Enabled Services</h3>
<p></p>
<p>
OpenWhisk offers a catalog of packages which gives you can easy
way to enhance your application with useful capabilities, and
to access external services in the ecosystem.
Examples of external services which are OpenWhisk-enabled
include Slack, GitHub, Alarms, etc.
</p>
<p>
The catalog is available as packages under <i>/whisk.system</i>
namespace. Using the following command, you can get a list of
packages under <i>/whisk.system:</i>
</p>
<div class="terminal">
{% highlight bash %}$ wsk package list /whisk.system{% endhighlight %}
</div>
<div class="terminal">
<pre>packages
/whisk.system/alarms shared
/whisk.system/system shared
/whisk.system/utils shared
/whisk.system/samples shared
/whisk.system/slack shared
/whisk.system/github shared
...
</pre>
</div>
<p>
Each of the packages under
<a href="https://github.com/apache/openwhisk-catalog#openwhisk-catalog">OpenWhisk Catalog</a>
is hosted in a GitHub repo.
Please refer to these package repositories for further details:
</p>
<ul>
<li>
<a href="https://github.com/apache/openwhisk-package-alarms/blob/master/README.md">openwhisk-package-alarm</a>
is an Apache OpenWhisk alarm package that can be
used to create periodic, time-based alarms.
</li>
<li>
<a href="https://github.com/apache/openwhisk-package-cloudant/blob/master/README.md">openwhisk-package-cloudant</a>
enables you to work with a Cloudant database.
</li>
<li>
<a href="https://github.com/apache/openwhisk-package-kafka/blob/master/README.md">openwhisk-package-kafka</a>
allows you to communicate with Kafka or Message Hub instances
for publishing and consuming messages using native high
performance Kafka API.
</li>
<li>
<a href="https://github.com/apache/openwhisk-package-rss/blob/master/README.md">openwhisk-package-rss</a>
allows users to subscribe to RSS/ATOM feeds and
receive events when a new feed item is available.
</li>
<li>
<a href="https://github.com/apache/openwhisk-package-deploy/blob/master/README.md">openwhisk-package-deploy</a>
offers a convenient way for you to describe and deploy
any part of the OpenWhisk programming model using a
Manifest file written in YAML.
</li>
<li>
<a href="https://github.com/apache/openwhisk-package-jira/blob/master/README.md">openwhisk-package-jira</a>
includes actions that interact with JIRA software
software development tool used for issue tracking,
and project management functions.
</li>
<li>
<a href="https://github.com/apache/openwhisk-package-template/blob/master/README.md">openwhisk-package-template</a>
is a template for Openwhisk Packages, it can be used
to build, test and integrate new packages.
</li>
</ul>
</div>
</main>
<main class="doc">
<div class="content">
<a class="indexable" id="sample_openwhisk_applications"></a>
<h3>Sample OpenWhisk Applications</h3>
<p></p>
<h5>GitHub Slack Bot</h5>
<p style="padding-left: 2em;">
<a href="https://github.com/apache/openwhisk-GitHubSlackBot/blob/master/README.md">openwhisk-GitHubSlackBot</a>
demonstrates integration of GitHub Pull Request management
with Slack and using Alarms.
</p>
<h5>Serverless Message Archiver To Object Storage (MATOS)
Sample Application</h5>
<p style="padding-left: 2em;">
<a href="https://github.com/apache/openwhisk-sample-matos/blob/master/README.md">openwhisk-sample-matos</a>
demonstrates an implementation of a simple pipeline that
reads messages from a Message Hub topic and archives them
in batches into an Object Storage folder.
</p>
<h5>Slackbot for OpenWhisk:</h5>
<p style="padding-left: 2em;">
<a href="https://github.com/apache/openwhisk-sample-slackbot/blob/master/README.md">openwhisk-sample-slackbot</a>
a proof-of-concept Slackbot to invoke OpenWhisk actions.
</p>
<h5>openwhisk-slackinvite:</h5>
<p style="padding-left: 2em;">
<a href="https://github.com/apache/openwhisk-slackinvite/blob/master/README.md">openwhisk-slackinvite</a>
implements invitations for Apache OpenWhisk Slack Community.
</p>
</div>
</main>
<main class="doc">
<div class="content">
<a class="indexable" id="tutorial_and_workshop"></a>
<h3>Tutorial and Workshop</h3>
<p></p>
<h5>OpenWhisk Tutorial</h5>
<p style="padding-left: 2em;">
<a href="https://github.com/apache/openwhisk-tutorial/blob/master/README.md">openwhisk-tutorial</a>
contains an interactive tutorials for the OpenWhisk CLI.
</p>
<h5>OpenWhisk Workshop</h5>
<p style="padding-left: 2em;">
<a href="https://github.com/apache/openwhisk-workshop/blob/master/README.md">openwhisk-workshop</a>
provides a series of exercises to help you understand how to
use OpenWhisk to build serverless applications.
</p>
</div>
</main>
<main class="doc">
<div class="content">
<a class="indexable" id="development_tools"></a>
<h3>Development Tools</h3>
<p></p>
<h5>The OpenWhisk Debugger</h5>
<p class="indented">
<a href="https://github.com/apache/openwhisk-debugger/blob/master/client/README.md">openwhisk-debugger</a>
supports debugging OpenWhisk actions. The debugger will arrange
things so that the actions you wish to debug will be offloaded
from the main OpenWhisk servers
and instead run locally on your laptop. You can then, from within
the debugger, inspect and modify values.
</p>
</div>
</main>
<!-- *************************************************************** -->
<!-- Contributors -->
<!-- *************************************************************** -->
<main class="doc">
<div class="content">
<a class="indexable" id="contributors"></a>
<h2>Contributors</h2>
<p>The Apache OpenWhisk project welcomes any and all developers to
become a Contributor to any part of our project. Contributions can
range from fixing documentation and adding testcases, to fixing
bugs, proposing and implementing new features and reviewing
others' Pull Requests (PRs).
</p>
<p>
The following Wiki pages describe the "How Tos" of becoming an
official Contributor:
</p>
<ul>
<li><a href="https://cwiki.apache.org/confluence/display/OPENWHISK/Apache+OpenWhisk+Project+Wiki">How to Contribute?</a></li>
<li><a href="https://cwiki.apache.org/confluence/display/OPENWHISK/Apache+OpenWhisk+Project+Wiki">How do I become a Contributor or Committer?</a></li>
</ul>
<!-- ******************************************************* -->
<!-- Contributors - project Structure -->
<!-- ******************************************************* -->
<a class="indexable" id="project-structure"></a>
<h3>Project Structure</h3>
<p>OpenWhisk is comprised of multiple repositories that can be
found in Apache GitHub (using a name query by repository):</p>
<ul>
<li><a href="https://github.com/apache?q=openwhisk">https://github.com/apache?q=openwhisk</a></li>
</ul>
<p>For convenience, here is a listing of current Apache OpenWhisk
project repositories (by category).</p>
<div class="flow-columns">
<div class="project-structure-repo theme-deeper-sea-green">
<h5>Platform</h5>
<p>Primary source code repositories including platform code,
run books, tests and more.</p>
<p class="repo-title border-deeper-sea-green">
<a href="https://github.com/apache/openwhisk"
title="Core OpenWhisk repository including controller,
invoker, run books, and more.">
openwhisk</a>
</p>
<p class="repo-title border-deeper-sea-green">
<a href="https://github.com/apache/openwhisk-cli"
title="Pluggable Command Line Interface (CLI) for wsk
command using the Cobra framework.">
openwhisk-cli</a>
</p>
<p class="repo-title border-deeper-sea-green">
<a href="https://github.com/apache/openwhisk-apigateway"
title="A performant API Gateway based on Openresty
and NGINX.">
openwhisk-apigateway</a>
</p>
<p class="repo-title border-deeper-sea-green">
<a href="https://github.com/apache/openwhisk-catalog"
title="Catalog of built-in system, utility, test and sample
Actions, Feeds and provider integration services and catalog
packaging tooling.">
openwhisk-catalog</a>
</p>
</div>
<div class="project-structure-repo theme-deeper-sky-blue">
<h5>Runtimes</h5>
<p>OpenWhisk supports several languages via Docker runtime
containers.</p>
<p class="repo-title border-deeper-sky-blue">
<a href="https://github.com/apache/openwhisk-runtime-nodejs"
title="Apache openwhisk nodejs runtime">
openwhisk-runtime-nodejs</a>
</p>
<p class="repo-title border-deeper-sky-blue">
<a href="https://github.com/apache/openwhisk-runtime-docker"
title="Apache openwhisk docker runtime.">
openwhisk-runtime-docker</a>
</p>
<p class="repo-title border-deeper-sky-blue">
<a href="https://github.com/apache/openwhisk-runtime-python"
title="Apache openwhisk python runtime.">
openwhisk-runtime-python</a>
</p>
<p class="repo-title border-deeper-sky-blue">
<a href="https://github.com/apache/openwhisk-runtime-go"
title="Apache openwhisk go runtime.">
openwhisk-runtime-go</a>
</p>
<p class="repo-title border-deeper-sky-blue">
<a href="https://github.com/apache/openwhisk-runtime-swift"
title="Apache openwhisk swift runtime.">
openwhisk-runtime-swift</a>
</p>
<p class="repo-title border-deeper-sky-blue">
<a href="https://github.com/apache/openwhisk-runtime-php"
title="Apache openwhisk php runtime.">
openwhisk-runtime-php</a>
</p>
<p class="repo-title border-deeper-sky-blue">
<a href="https://github.com/apache/openwhisk-runtime-java"
title="Apache openwhisk java runtime.">
openwhisk-runtime-java</a>
</p>
<p class="repo-title border-deeper-sky-blue">
<a href="https://github.com/apache/openwhisk-runtime-ruby"
title="Apache openwhisk ruby runtime.">
openwhisk-runtime-ruby</a>
</p>
</div>
<div class="project-structure-repo theme-darkgoldenrod">
<h5>Deployments</h5>
<p>OpenWhisk can be deployed and configured on variety of platforms.</p>
<p class="repo-title border-darkgoldenrod">
<a href="https://github.com/apache/openwhisk-deploy-kube"
title="This project can be used to deploy Apache OpenWhisk
to a Kubernetes cluster.">
openwhisk-deploy-kube
</a>
</p>
<p class="repo-title border-darkgoldenrod">
<a href="https://github.com/apache/openwhisk-devtools/blob/master/docker-compose/README.md"
title="An easy way to try OpenWhisk locally is to use
Docker Compose.">
openwhisk-devtools/docker-compose
</a>
</p>
<p class="repo-title border-darkgoldenrod">
<a href="https://github.com/apache/openwhisk-deploy-mesos"
title="Apache OpenWhisk deployment scripts and
configuration files for running under Apache Mesos.">
openwhisk-deploy-mesos
</a>
</p>
<p class="repo-title border-darkgoldenrod">
<a href="https://github.com/apache/openwhisk/blob/master/ansible/README.md#deploying-openwhisk-using-ansible"
title="Deploy OpenWhisk locally using Ansible.">
openwhisk/ansible
</a>
</p>
<p class="repo-title border-darkgoldenrod">
<a href="https://github.com/apache/openwhisk#vagrant-setup"
title="Deploy OpenWhisk locally using Vagrant.">
openwhisk/vagrant-setup
</a>
</p>
</div>
<div class="project-structure-repo theme-deeper-aquamarine">
<h5>Tooling</h5>
<p>OpenWhisk provides variety of tools around deployment and development.</p>
<p class="repo-title border-deeper-aquamarine">
<a href="https://github.com/apache/openwhisk-wskdeploy"
title="Utility to deploy all your OpenWhisk Packages,
Actions, Triggers, Rules and more using a single command!">
openwhisk-wskdeploy
</a>
</p>
<p class="repo-title border-deeper-aquamarine">
<a href="https://github.com/apache/openwhisk-devtools"
title="This repository provides developer tools that
help with local development, testing and operation
of OpenWhisk.">
openwhisk-devtools
</a>
</p>
<p class="repo-title border-deeper-aquamarine">
<a href="https://github.com/apache/openwhisk-debugger"
title="This repository provides wskdb, the OpenWhisk
debugger.">
openwhisk-debugger
</a>
</p>
<p class="repo-title border-deeper-aquamarine">
<a href="https://github.com/apache/openwhisk-playground"
title="This library provides functionality of executing
a snippet of source code as OpenWhisk action for
OpenWhisk Xcode Source Editor Extension in order to
test Swift OpenWhisk functions quickly.">
openwhisk-playground
</a>
</p>
<p class="repo-title border-deeper-aquamarine">
<a href="https://github.com/apache/openwhisk-vscode"
title="This is a prototype extension for Visual Studio
Code that enables complete round trip cycles for
authoring OpenWhisk actions inside the editor. ">
openwhisk-vscode
</a>
</p>
<p class="repo-title border-deeper-aquamarine">
<a
href="https://github.com/apache/openwhisk-xcode"
title="This repository has three projects, OpenWhisk
Xcode Extension, WhiskBot - OpenWhisk Watson
Conversation Chatbot, and wskTools.">
openwhisk-xcode
</a>
</p>
</div>
<div class="project-structure-repo theme-darksalmon">
<h5>Packages</h5>
<p>Several common service integrations are made available as
packages. By default they are registered in the OpenWhisk
catalog, under the <em>/whisk.system/</em> namespace,
and include:</p>
<p class="repo-title border-darksalmon">
<a href="https://github.com/apache/openwhisk-package-alarms"
title="Apache OpenWhisk package that can be used to
create periodic, time-based alarms.">
openwhisk-package-alarms
</a>
</p>
<p class="repo-title border-darksalmon">
<a href="https://github.com/apache/openwhisk-package-cloudant"
title="The /whisk.system/cloudant package enables you
to work with a Cloudant database.">
openwhisk-package-cloudant
</a>
</p>
<p class="repo-title border-darksalmon">
<a href="https://github.com/apache/openwhisk-package-kafka"
title="Apache OpenWhisk package for communicating with
Kafka or Message Hub">
openwhisk-package-kafka
</a>
</p>
<p class="repo-title border-darksalmon">
<a href="https://github.com/apache/openwhisk-package-deploy"
title="The /whisk.system/deploy package offers a
convenient way for you to describe and deploy any p
art of the OpenWhisk programming model using a Manifest
file written in YAML.">
openwhisk-package-deploy
</a>
</p>
<p class="repo-title border-darksalmon">
<a href="https://github.com/apache/openwhisk-package-pushnotifications"
title="The /whisk.system/pushnotifications package
enables you to work with a push service.">
openwhisk-package-pushnotifications
</a>
</p>
<p class="repo-title border-darksalmon">
<a href="https://github.com/apache/openwhisk-package-rss"
title="This package allows users to subscribe to
RSS/ATOM feeds and receive events when a new feed
item is available.">
openwhisk-package-rss
</a>
</p>
<p class="repo-title border-darksalmon">
<a href="https://github.com/apache/openwhisk-package-jira"
title="This package includes actions that interact
with JIRA software software development tool used
for issue tracking, and project management functions.">
openwhisk-package-jira
</a>
</p>
<p class="repo-title border-darksalmon">
<a href="https://github.com/apache/openwhisk-package-template"
title="This package is a template for Openwhisk Packages,
it can be used to build, test and integrate new packages.">
openwhisk-package-template
</a>
</p>
</div>
<div class="project-structure-repo theme-deeper-aquamarine">
<h5>Clients and SDK</h5>
<p>Here are the clients to access to OpenWhisk API:</p>
<p class="repo-title border-deeper-aquamarine">
<a href="https://github.com/apache/openwhisk-client-go"
title="This project openwhisk-client-go is a Go client
library to access Openwhisk API.">
openwhisk-client-go</a>
</p>
<p class="repo-title border-deeper-aquamarine">
<a href="https://github.com/apache/openwhisk-client-js"
title="JavaScript client library for the OpenWhisk
platform.">
openwhisk-client-js</a>
</p>
</div>
<div class="project-structure-repo theme-darkorange">
<h5>Samples</h5>
<p>Few example applications to demonstrate OpenWhisk features and functionalities:</p>
<p class="repo-title border-darkorange">
<a href="https://github.com/apache/openwhisk-sample-slackbot"
title="This repository contains proof-of-concept-quality
code to deploy a Slackbot with the capability to run
OpenWhisk actions.">
openwhisk-sample-slackbot</a>
</p>
<p class="repo-title border-darkorange">
<a href="https://github.com/apache/openwhisk-slackinvite"
title="Invite for Apache OpenWhisk Team on Slack.">
openwhisk-slackinvite</a>
</p>
<p class="repo-title border-darkorange">
<a href="https://github.com/apache/openwhisk-GitHubSlackBot"
title="This bot is designed to post updates to Slack when
a GitHub pull request is ready to merge or a list of pull
requests are under review for certain days and haven't
merged.">
openwhisk-GitHubSlackBot</a>
</p>
<p class="repo-title border-darkorange">
<a href="https://github.com/apache/openwhisk-sample-matos"
title="Sample application with Message Hub and Object Store.">
openwhisk-sample-matos</a>
</p>
<p class="repo-title border-darkorange">
<a href="https://github.com/apache/openwhisk-tutorial"
title="An interactive learning environment for the
Apache OpenWhisk command line.">
openwhisk-tutorial</a>
</p>
<p class="repo-title border-darkorange">
<a href="https://github.com/apache/openwhisk-workshop"
title="OpenWhisk workshop to help developers learn how
to build serverless applications using the platform.">
openwhisk-workshop</a>
</p>
</div>
<div class="project-structure-repo theme-darkred">
<h5>Others</h5>
<p>Few other misc. but crucial repositories.</p>
<p class="repo-title border-darkred">
<a href="https://github.com/apache/openwhisk-release"
title="This repository provides Release Management of all
designated Apache OpenWhisk project repositories.">
openwhisk-release</a>
</p>
<p class="repo-title border-darkred">
<a href="https://github.com/apache/openwhisk-website"
title="This repository contains source of this website
(openwhisk.apache.org) which is built using Jekyll.">
openwhisk-website</a>
</p>
<p class="repo-title border-darkred">
<a href="https://github.com/apache/openwhisk-external-resources"
title="Curated list of awesome OpenWhisk things.">
openwhisk-external-resources</a>
</p>
</div>
</div>
<!-- ******************************************************* -->
<!-- Contributors - Resources -->
<!-- ******************************************************* -->
<spacer></spacer>
<a class="indexable" id="contributor-resources"></a>
<h3>Contributor Resources</h3>
<p>This section lists a number of resources for OpenWhisk Contributors:</p>
<ul>
<li><a href="https://cwiki.apache.org/confluence/display/OPENWHISK/Proposals">Proposals (Designs)</a></li>
<li><a href="https://cwiki.apache.org/confluence/display/OPENWHISK/Presentations%2C+Meeting+Notes+and+Transcripts">Meeting Notes and Transcripts</a></li>
<li><a href="https://cwiki.apache.org/confluence/display/OPENWHISK/Processes">Processes</a></li>
<li><a href="https://cwiki.apache.org/confluence/display/OPENWHISK/Project+Status">Project Status</a></li>
<li><a href="https://github.com/apache/openwhisk/issues">Report Bugs or Request Features</a></li>
<li><a href="https://github.com/apache/openwhisk-release#apache-openwhisk-project-release-management">Project Release Management</a></li>
</ul>
<!-- ******************************************************* -->
<!-- Contributors - What to Contribute? -->
<!-- ******************************************************* -->
<a class="indexable" id="contributing-what-to-contribute"></a>
<h3>What Can I Contribute?</h3>
<p>Usually, contributors come because they want to fix or improve some part of the project. This can include the code itself in any of the project repositories under our project, project documentation, test cases, literally anything!</p>
<p>Here are some specific ideas to get you thinking ...</p>
<ul>
<li><b>Fix open issues</b>: both bugs and feature issues in GitHub.</li>
<li><b>Improve Documentation</b>: READMEs, Website Developer or Operator docs (Examples, How Tos), Medium blog articles, etc.</li>
<li><b>Testcases</b> (any repo.): e.g., functional code coverage, performance, config. variants, parallelize test buckets, etc.</li>
<li><b>Add Operational Plug-ins</b>: e.g., metrics, logging, artifact storage impls., etc.)</li>
<li><b>Add/Improve Language Runtimes</b>: See <b><em>Contributing new Action Language Runtimes</em></b> below. e.g., new languages, additional framework variants), etc.</li>
<li><b>Improve tooling</b>: Enhance CLI features, extend APIs for new use cases, etc.</li>
<li><b>Feature ideas, Use cases, Design proposals</b>: Support new scenarios, deployments (platforms), schedulers, etc. Submit ideas via our developer email list and use our Confluence Wiki to develop your ideas.</li>
</ul>
<!-- ******************************************************* -->
<!-- Contributors - Language Runtimes -->
<!-- ******************************************************* -->
<a class="indexable" id="contributing-runtimes"></a>
<h3>Contributing Language Runtimes</h3>
<p>OpenWhisk supports several languages via its Action Runtimes,
but there may be other languages you would like supported or even language variants with different frameworks for languages we support today. OpenWhisk is all about making it easy for ANY developer, using any functional language they are comfortable with, to develop Actions for our platform!</p>
<p>You can create a new runtime in two ways:</p>
<ul>
<li>Implementing the <a href="https://github.com/apache/openwhisk/blob/master/docs/actions-new.md#Adding-Action-Language-Runtimes">Runtime specification</a> yourself, <i>or by</i></li>
<li>Using the <a href="https://github.com/apache/openwhisk/blob/master/docs/actions-actionloop.md#Developing-a-new-Runtime-with-the-ActionLoop-proxy">ActionLoop engine</a> that provides a simplified path for building a new runtime.</li>
</ul>
</div>
</main>
<!-- *************************************************************** -->
<!-- Operators -->
<!-- *************************************************************** -->
<main class="doc">
<div class="content">
<a class="indexable" id="operators"></a>
<h2>Operators</h2>
<p>This section has information that is primarily focused
on deploying, configuring and administrating an Apache
OpenWhisk Serverless platform.
</p>
<!-- ***************************************************** -->
<!-- Operators - OpenWhisk Architecture -->
<!-- ***************************************************** -->
<a class="indexable" id="openwhisk_architecture"></a>
<h3>OpenWhisk Architecture</h3>
<p>
The diagram below depicts the high-level architecture of
OpenWhisk. From Nginx to Kafka to Docker, multiple
technologies are powering Apache OpenWhisk which
shows its committment to be a true Open Source Serverless
Cloud Platform.
</p>
<img style="padding-top:20px; width: 400px;" src="https://raw.githubusercontent.com/apache/openwhisk/master/docs/images/OpenWhisk_flow_of_processing.png"
alt="OpenWhisk Architecture"/>
<p>
You can read more about the OpenWhisk platform
components along with its internal flow of processing here:
</p>
<ul>
<li>
<a href="https://github.com/apache/openwhisk/blob/master/docs/about.md#how-openWhisk-works">How OpenWhisk works</a>.
</li>
</ul>
<!-- ***************************************************** -->
<!-- Operators - Deployment Options -->
<!-- ***************************************************** -->
<a class="indexable" id="openwhisk_deployment"></a>
<h3>Deployment Options</h3>
<p>
OpenWhisk offers different deployment options
for installing and configuring the OpenWhisk platform components.
However, Kubernetes is the recommended option as it is supported
on most major platforms and includes great options for local
developers to get running quickly, as well as supports
operators needing to manage large scale production deployments.
</p>
<a class="indexable" id="deploy_kubernetes"></a>
<h5>Kubernetes</h5>
<p>
OpenWhisk can be deployed using <a href="https://helm.sh/">Helm</a>
charts on any Kubernetes provisioned locally or from a
public cloud provider.
</p>
<p>Please refer to:
<a href="https://github.com/apache/openwhisk-deploy-kube/blob/master/README.md#kubernetes">Deploy OpenWhisk to a Kubernetes Cluster</a>
for detailed deployment instructions which includes specific
<a href="https://github.com/apache/openwhisk-deploy-kube/blob/master/README.md#customize-the-deployment">customizations</a>
including Docker Desktop (Mac, Windows), Minikube,
Google, IBM Cloud, IBM Cloud Private, etc.).
</p>
<h3>Alternative options</h3>
<p>Here are some alternate choices for deploying the OpenWhisk
platform:
</p>
<!-- TODO: add left margin for all these alt. options. -->
<div>
<!-- ******************************** -->
<!-- Quick Start -->
<!-- ******************************** -->
<a class="indexable" id="quick_start"></a>
<h5>Quick Start</h5>
<p>
The easiest way to start using OpenWhisk is to install the "Standalone"
OpenWhisk stack. This is a full-featured OpenWhisk stack running as a Java process
for convenience. Serverless functions run within Docker containers.
You will need <a href="https://docs.docker.com/get-docker/">Docker</a>,
<a href="https://java.com/en/download/help/download_options.xml">Java</a> and
<a href="https://nodejs.org/en/download/">Node.js</a> available on your machine.
</p>
<p>
To get started:
</p>
<div class="terminal">
{% highlight bash %}
$ git clone https://github.com/apache/openwhisk.git
$ cd openwhisk
$ ./gradlew core:standalone:bootRun
{% endhighlight %}
</div>
<p>
<ul>
<li>When the OpenWhisk stack is up, it will open your browser to a functions Playground,
typically served from <strong>http://localhost:3232</strong>.
The Playground allows you create and run functions directly from your browser.
</li>
<li>To make use of all OpenWhisk features, you will need the OpenWhisk command line tool
called wsk which you can download from <a href="https://s.apache.org/openwhisk-cli-download">https://s.apache.org/openwhisk-cli-download</a>.
Please refer to the <a href="https://github.com/apache/openwhisk/blob/master/docs/cli.md">CLI configuration</a> for additional details. Typically you configure the CLI for
Standalone OpenWhisk as follows:
</li>
</ul>
</p>
<div class="terminal">
{% highlight bash %}
wsk property set \
--apihost 'http://localhost:3233' \
--auth '23bc46b1-71f6-4ed5-8c54-816aa4f8c502:123zO3xZCLrMN6v2BKK1dXYFpXlPkccOFqm12CdAsMgRU4VrNZ9lyGVCGuMDGIwP'
{% endhighlight %}
</div>
<p>
<ul>
<li> Standalone OpenWhisk can be configured to deploy additional capabilities when
that is desirable. Additional resources are available <a href="https://github.com/apache/openwhisk/blob/master/core/standalone/README.md">here</a>.
</li>
</ul>
</p>
</div>
<!-- TODO: add left margin for all these alt. options. -->
<div>
<!-- ******************************** -->
<!-- Docker Compose -->
<!-- ******************************** -->
<a class="indexable" id="deploy_docker_compose"></a>
<h5>Docker Compose</h5>
<p>
If you like using Docker directly, another easy local alternative
is to get Docker installed on Mac, Windows or Linux and use
Docker Compose. Please note that this option does not give you
a production deployment but gives you enough of the pieces to
start writing functions and seeing them executing.
</p>
<div class="terminal">
{% highlight bash %}
$ git clone https://github.com/apache/openwhisk-devtools.git
$ cd openwhisk-devtools/docker-compose
$ make quick-start
{% endhighlight %}
</div>
<p>
For more detailed instructions, see the
<a href="https://github.com/apache/openwhisk-devtools/blob/master/docker-compose/README.md">OpenWhisk with Docker Compose project</a>.
</p>
<!-- ******************************** -->
<!-- Ansible -->
<!-- ******************************** -->
<a class="indexable" id="deploy_ansible"></a>
<h5>Ansible</h5>
<p>
<a href="https://github.com/apache/openwhisk/blob/master/ansible/README.md">Deploying OpenWhisk using Ansible</a>
is a more imperative, script-based deployment
option such as in a CI/CD (Travis) pipeline.
The OpenWhisk playbooks are structured such that it
allows cleaning, deploying, or re-deploying a single
component as well as the entire OpenWhisk stack.
</p>
<!-- ******************************** -->
<!-- Vagrant -->
<!-- ******************************** -->
<a class="indexable" id="deploy_vagrant"></a>
<h5>Vagrant</h5>
<p>
A Vagrant machine is also available to run OpenWhisk on
Mac, Windows PC or GNU/Linux.
Downloading and install VirtualBox and Vagrant for your
operating system and architecture.
You can follow the steps under
<a href="https://github.com/apache/openwhisk#vagrant-setup">Vagrant Setup</a>
to run your first OpenWhisk action using Vagrant.
</p>
<!-- ******************************** -->
<!-- Mesos -->
<!-- ******************************** -->
<a class="indexable" id="deploy_mesos"></a>
<h5>Mesos</h5>
<p>
<a href="https://github.com/apache/openwhisk-deploy-mesos/blob/master/README.md">Deploy OpenWhisk to a Mesos Cluster</a>
is under active development.
</p>
</div>
<!-- ******************************************************* -->
<!-- Operators - Admin -->
<!-- ******************************************************* -->
<a class="indexable" id="deployment_admin"></a>
<h3>Administrative Operations</h3>
<p>
This section contains a list of resources which can be utilized
to administer the running OpenWhisk instance.
</p>
<ul>
<li><a href="https://github.com/apache/openwhisk/tree/master/tools/admin">wskadmin</a></li>
</ul>
<!-- ******************************************************* -->
<!-- Operators - Resources -->
<!-- ******************************************************* -->
<a class="indexable" id="operators_resources"></a>
<h3>Operator Resources</h3>
<ul>
<li><a href="https://medium.com/openwhisk/five-minute-intro-to-open-source-serverless-development-with-openwhisk-328b0ebfa160">Five minute intro to open source serverless development with OpenWhisk</a></li>
<li><a href="https://thenewstack.io/behind-scenes-apache-openwhisk-serverless-platform/">An Architectural View of Apache OpenWhisk</a></li>
<li><a href="https://medium.com/@rabbah/the-state-of-openwhisk-ae8c129e8a48">The State of OpenWhisk</a></li>
<li><a href="https://medium.com/openwhisk/starting-openwhisk-in-sixty-seconds-9288bfb4863d">Starting OpenWhisk in Sixty Seconds</a></li>
<li><a href="https://medium.com/openwhisk/deploying-openwhisk-on-kubernetes-3f55f781fbab">Deploying OpenWhisk on Kubernetes</a></li>
<li><a href="https://medium.com/openwhisk/uncovering-the-magic-how-serverless-platforms-really-work-3cb127b05f71">Uncovering the magic: How serverless platforms really work!</a></li>
</ul>
</div>
</main>
<!-- Other Resources Section -->
<main class="doc">
<div class="content">
<a class="indexable" id="other-resources"></a>
<h3>Other Resources</h3>
<ul>
<li><a href="events.html">Events</a> - list of past OpenWhisk
events</li>
<li><a href="https://github.com/apache/openwhisk-external-resources#awesome-openwhisk--">Awesome OpenWhisk</a>
- list of OpenWhisk resources and tips including articles,
books, videos, presentations, podcasts, etc.</li>
</ul>
</div>
</main>
<!-- Frequently Asked Questions -->
<main class="doc">
<div class="content">
<a class="indexable" id="faq"></a>
<h3>Frequently Asked Questions</h3>
{% include partial/faq.html %}
</div>
</main>
</section>
</div>