This is the third article in a series on how to use GitHub pages (the service that hosts this blog) and Cloudant on the BlueMix PaaS to create an automatically updating news section for a blog. This post will explore how to setup Openwhisk which will be configured to push updates to the news page.
To setup Openwhisk go to this page on Bluemix. The documentation on that page will guide you through a 3 step process to for Openwhisk setup.
Execute the supplied test command and verify you get the expected output.
In a previous post we manually updated news articles by making Cloudant documents on the web interface. In this post we are going to configure Openwhisk to push updates into Cloudant.
Create a user that can read and write
Follow the steps in the previous post for creating a new user. When creating this new user enable both _reader and _writer permissions.
Store the password for this user somewhere - you can’t retrieve it later.
Bind Openwhisk to Cloudant
Once the new user is created follow these instructions to bind the username and password to the new user that was created. Replace ‘MYUSERNAME’, ‘MYPASSWORD’ with the key and password for the new user that was created. Replace ‘MYCLOUDANTACCOUNT.cloudant.com’ with the Cloudant hostname you provided by Bluemix.
Retrieve the name of the package binding and note it.
Post a sample news item from the command line
After executing that command the sample news item should show up in the blog’s news article list.
You can now use the command line Openwhisk to push news articles directly to your blog without having to edit database documents directly on Cloudant.