Apache OpenWhisk is a free software for setting up serverless computing platform. It is an open source implementation of a distributed, event-driven compute service. You can run it on your own hardware on premise, or in the cloud. Previously we have talked about the basics of serverless computing. Here is How To Install Apache OpenWhisk On Ubuntu Server Single Instance. We normally install Vagrant, then install Apache OpenWhisk on top. Basically Ubuntu 14.04 is preferred over Ubuntu 15, Ubuntu 16 etc newer versions as many things changed in the later version and bug is common.
Steps To Install Apache OpenWhisk On Ubuntu Server : With Vagrant
It is actually easy to install Vagrant :
1 2 3 | sudo apt-get update # apt-cache show vagrant sudo apt-get install vagrant |
You can check installation by running :
---
1 | vagrant -v |
Show list of VMs :
1 | vagrant box list |
Start Vagrant instance :
1 | vagrant up |
SSH to Vagrant :
1 | vagrant ssh |
For that SSH part, practically you should know how to create Vagrant file and tit bits. It is definitely out of scope of this guide to talk about Vagrant.
Next steps are really easy. Simply run :
1 2 3 4 5 | # clone openwhisk git clone --depth=1 https://github.com/openwhisk/openwhisk.git # directory to tools/vagrant cd openwhisk/tools/vagrant |
In this directory, you can run test script :
1 2 | # Run script to create vm and run hello action ./hello |
You’ll get response like this :
1 2 3 4 | wsk action invoke /whisk.system/utils/echo -p message hello --result { "message": "hello" } |
Steps To Install Apache OpenWhisk On Ubuntu Server : Native Installation
Before you build and deploy Apache OpenWhisk, it is optional but practical to configure a backing data store. It can be CouchDB instance or a cloud-based database service. It is actually easy to run these commands :
1 2 3 4 5 6 7 8 9 10 11 | # Install git if it is not installed sudo apt-get install git -y # Clone openwhisk git clone https://github.com/openwhisk/openwhisk.git # Change current directory to openwhisk cd openwhisk # Install all required software (cd tools/ubuntu-setup && ./all.sh) # build like docker cd ./gradlew distDocker |
Add these on bash profile file :
1 2 3 | echo 'export PATH=$HOME/openwhisk/bin:$PATH' > "$HOME/.bash_profile" echo 'eval "$(register-python-argcomplete wsk)"' >> "$HOME/.bash_profile" echo 'eval "$(register-python-argcomplete wskadmin)"' >> "$HOME/.bash_profile" |
Serverless functions can be exposed as HTTP endpoints. Building OpenWhisk from repository results in the generation of the command line interface. The generated CLIs are located in openwhisk/bin/
. The main CLI is located in openwhisk/bin/wsk
that runs on the operating system, and CPU architecture on which it was built. Executables for other operating system, and CPU architectures are located in openwhisk/bin/linux/
.
To download the CLI from an existing deployment, you will need to download the CLI using the deployment’s base URL – {BASE URL}/cli/go/download
. {BASE URL}
is the OpenWhisk API hostname or IP address.
There are some projects which either are related now or will be related with Apache OpenWhisk in future :
- Kafka for message hub service
- Camel
- ActiveMQ
- CouchDB
- Mesos
- Spark