It’s now even easier to get started with Serverless using the new standalone Apache OpenWhisk!
Tags: javascript, openwhisk, apacheopenwhisk, ibm
Published: 2019-11-16 00:10:16

---
title: It’s now even easier to get started with Serverless using the new standalone Apache OpenWhisk!
published: true
date: 2019-11-16 00:01:23 UTC
tags: javascript,openwhisk,apache-openwhisk,ibm
canonical_url: 
---

![](https://cdn-images-1.medium.com/max/1024/1*dgYWPCF8TBKG9om93tF5Lg.png)<figcaption>Subset of OpenWhisk runtimes</figcaption>

One of the cool things about OpenWhisk was the ability to start a local copy and get coding very quickly. [James Thomas](https://medium.com/u/604ac4ebfc5f) has an awesome post on this — [Starting OpenWhisk in Sixty Seconds](http://jamesthom.as/blog/2018/01/19/starting-openwhisk-in-sixty-seconds/). This also enabled developers to create and test their Serverless solutions on their machines. The amazing OpenWhisk community have taken this one step further. [Chetan Mehrotra](https://twitter.com/chetanmeh) recently added code to enable running OpenWhisk as a standalone jar! How cool is that!

At a high level, they have taken out CouchDB and Kafka and replaced them with in memory persistence layer and a queueing system. The controller and invoker have also been slimmed down. There is obviously more to it and is well captured in the following links.

- [https://github.com/apache/openwhisk/pull/4516](https://github.com/apache/openwhisk/pull/4516#4216)
- [https://github.com/apache/openwhisk/pull/4216](https://github.com/apache/openwhisk/pull/4516#4216)
- [https://lists.apache.org/thread.html/7425131f1fc11a9fd21e9c049be702837841c47004da03b7f215a0d6@%3Cdev.openwhisk.apache.org%3E](https://lists.apache.org/thread.html/7425131f1fc11a9fd21e9c049be702837841c47004da03b7f215a0d6@%3Cdev.openwhisk.apache.org%3E)

So how do you get started?

#### Step 1: Build the jar file

1. You can build it yourself by following the steps in the [official repo](https://github.com/apache/openwhisk/tree/master/core/standalone). The final jar will be available in the /bin folder. This is the preferable approach as you always get the latest features
2. Alternatively, if you must insist, you can download the [pre-built jar file from here](https://github.com/chetanmeh/incubator-openwhisk/releases/tag/0.14). I am not sure if this will be kept up to date. So try at your own risk!

#### Step 2: run the jar file

Once you have the jar file, you can run it as follows

java -jar bin/openwhisk-standalone.jar

There are numerous other options available, but this will suffice for now. That’s it! You have a Serverless platform running on your local machine. You can run all your favorite wsk commands just as your would with a production level distributed OpenWhisk installation!

#### Step 3: create and deploy a simple action

If you have never deployed an action on Apache OpenWhisk or IBM Cloud, you can follow these steps

3.1 Download the [wsk cli](https://github.com/apache/openwhisk-cli#where-to-download-the-binary-of-openwhisk-cli).

3.2 Create your function

```
function main(args) {
 if (args && args.name) {
 console.log(`hello ${args.name}`);
 return { msg: `hello ${args.name}` };
 } else {
 console.log(`hello world`);
 return { msg: `hello world` };
 }
}
```

3.3 Before you deploy your function/action, you need to set the auth property using the wsk cli. This command was provided to you when you started the jar file. Simply copy paste in terminal!

![](https://cdn-images-1.medium.com/max/1024/1*8S4Pxu1F8r0uZo15IYdSZg.png)

4. That’s it! Let’s deploy the index.js file as an action

```
$ wsk action create hello index.js
ok: created action hello
```

We can now invoke this action

```
$ wsk action invoke hello -r
{
 "msg": "hello world"
}

# with params
$ wsk action invoke hello -r -p name upkar
{
 "msg": "hello upkar"
}
```

If you were paying close attention you would have noticed that when you run the jar file, it opens a browser with the new OpenWhisk Function Playground! This makes it even easier to write and test your functions if you are new to OpenWhisk. Go ahead and try it out!

![](https://cdn-images-1.medium.com/max/1024/1*gBsfxZvJqNOPeh9B9ZNleg.png)<figcaption>OpenWhisk Function Playground</figcaption>

How cool was that! If you like this, [please give the repo some love](https://github.com/apache/openwhisk)! More to come on how this blazingly fast jar can help developers in their Serverless journeys.