The Serverless Framework needs access to account credentials for your OpenWhisk provider so that it can create and manage resources on your behalf.
OpenWhisk is an open-source serverless platform. This means you can either choose to run the platform yourself or choose to use a hosted provider's instance.
Here we'll provide setup instructions for both options, just pick the one that you're using.
IBM's Bluemix cloud platform provides a hosted serverless solution based upon Apache OpenWhisk.
Here's how to get started…
IBM Bluemix comes with a free trial that doesn't need credit card details for the first 30 days. Following the trial, developers have to enrol using a credit card but get a free tier for the platform and services.
All IBM Bluemix users get access to the Free Tier for OpenWhisk. This includes 400,000 GB-seconds of serverless function compute time per month.
Additional execution time is charged at $0.000017 per GB-second of execution, rounded to the nearest 100ms.
The second point in the instructions contains a command-line which includes the platform endpoint and authentication keys.
wsk property set --apihost openwhisk.ng.bluemix.net --auth XXX:YYY
Make a note of the
auth command flag values.
Following the Quick Start guide will let you run the platform locally using a Virtual Machine.
# Clone openwhisk git clone --depth=1 https://github.com/openwhisk/openwhisk.git # Change directory to tools/vagrant cd openwhisk/tools/vagrant # Run script to create vm and run hello action ./hello
This platform will now be running inside a virtual machine at the following IP address:
Please note: If you are using a self-hosted platform, the
ignore_certs property in
serverless.yaml needs to be
true. This allows the client to be used against local deployments of OpenWhisk with a self-signed certificate.
service: testing provider: name: openwhisk ignore_certs: true functions: ...
The default environment has a guest account configured with the authentication key available here: https://github.com/openwhisk/openwhisk/blob/master/ansible/files/auth.guest
192.168.33.13 address as the
apihost value needed below.
Building OpenWhisk from a cloned repository will result in the generation of the command line interface in
openwhisk/bin/go-cli/. The default executable in this location will run on the operating system and CPU architecture on which it was built.
Executables for other operating system, and CPU architectures are located in the following directories:
Download and install the correct binary into a location in your shell path.
You can configure the Serverless Framework to use your OpenWhisk credentials in two ways:
As a quick setup to get started you can export them as environment variables so they would be accessible to Serverless Framework:
export OW_AUTH=<your-key-here> export OW_APIHOST=<your-api-host> # OW_AUTH and OW_APIHOST are now available for serverless to use serverless deploy
For a more permanent solution you can also set up credentials through a configuration file. Here are different methods you can use to do so.
If you have followed the instructions above to install the
wsk command-line utility, run the following command to create the configuration file.
$ wsk property set --apihost PLATFORM_API_HOST --auth USER_AUTH_KEY
Credentials are stored in
~/.wskprops, which you can edit directly if needed.
The following configuration values should be stored in a new file (
.wskprops) in your home directory. Replace the
USER_AUTH_KEY values will the credentials from above.