IBM Cloud Platform Boilerplates Guide

Want to use know what to use within IBM Cloud Platform and how to get started with Watson? Then you are reading the correct article.

I will be covering different functionalities of IBM Cloud and how to use them through a series of articles. This guide was made for other developers.

Watson robot named Pepper!

ARTICLE GUIDE BY SECTION

Here are sections of this article. You can scroll or search the text to get to the parts of this guide that you want to actually know about.

  1. IBM Cloud Introduction
  2. Cloud Deployment Models
  3. IBM Cloud Public
  4. Choose a Data Center
  5. Introduction to Building Applications: Boilerplates
  6. Beginning with Boilerplates Tutorial: ASP.Net Core Cloudant boilerplate
  7. Change Application Locally
  8. Java Cloudant Web Starter boilerplate
  9. MobileFirst Services Starter boilerplate
  10. Personality Insights Node.js Web Starter boilerplate
  11. Node-RED Starter boilerplate
  12. Vaadin Rich Web Starter boilerplate
  13. Internet of Things Platform Starter boilerplate
  14. Java Workload Scheduler Web Starter boilerplate
  15. Node.js Cloudant DB Web Starter boilerplate
  16. StrongLoop Arc boilerplate
  17. Python Flask boilerplate
  18. IoT for Electronics Starter boilerplate
  19. Personality Insights Java Web Starter boilerplate
  20. Mendix Rapid Apps boilerplate
  21. Ruby Sinatra boilerplate

IBM Cloud Introduction

IBM Cloud is a catalog of infrastructure, platform, and application services.

Our infrastructure [IaaS] offerings are from Softlayer, our platform [PaaS] is IBM Cloud - which is an IBM Open Cloud Architecture based on Cloud Foundry, and our application software [SaaS] services are open source and feature Watson services [AIaaS] for you to play with as well.

With IBM Cloud, developers of all skill levels can build, deploy and manage cloud applications. Before we get to IBM Cloud and “what is all this stuff”, let’s go over the cloud platform.

“That is great. But I already started a free trial, what’s it to me?”

You should know that when you sign up for a trial and use IBM Cloud, you are using the Public Cloud, fittingly named “IBM Cloud Public”.

CLOUD DEPLOYMENT MODELS

There are three cloud deployment models. Public, Dedicated, and Local.

Public, Dedicated, and Local are the three cloud deployment models.
“IBM Cloud environments can be deployed in the public cloud (IBM Cloud Public), in a single-tenant public cloud environment (IBM Cloud Dedicated), or private on-premises in a customer data center (IBM Cloud Private).” — IBM

For more information on each of these deployment models, click here.

IBM Cloud Public

When you start in IBM Cloud you are utilizing a public cloud environment. There are multiple regions of data centers you can use throughout the world. What does that mean to the developer? That means you can pick which ones you use by selecting the region for your application.

For the IBM Cloud services by region, go here!

This minimizes latency, increases performance and health, you can even choose the region based on your preferences for security, redundancy, disaster recovery and resiliency concerns for your applications.

Access as well as execution control within this public platform is isolated from other users and their applications. But the platform is still a shared environment, and this is why we have IBM Cloud Dedicated and Cloud Private offerings.

IBM cloud data center

For a list of our data centers, information + speed tests, click here.

Choose a Data Center

“You said I as a developer can choose the data center locations?”

Yes. You can do this within the IBM Cloud console under the right sidebar that has your account information by selecting ‘Region’. You can set regions via your command line, it will help in knowing this with your development to know how to do this.

If you want to watch a video rather than read below on how to do this straight-away, click here. You will need the Cloud Foundry CLI for both tutorials. The link for the CLI above takes you straight to the Downloads section in GitHub.

Introduction to Building Applications: Boilerplates

We at IBM like to do things big and we have made a book on IBM Cloud, as you can see here. So if you want to explore and do not want to cover boilerplates, I would search through that.

Today I am going to cover boilerplates. All of them below.

“In IBM® IBM Cloud, a boilerplate is a container for an application and its associated runtime environment and predefined services for a particular domain. You can use a boilerplate to quickly get up and running.” — IBM
IBM Cloud Boilerplates

Note for the Beginner Developers (skip if you are not a newbie)

Say you deploy an application from the ASP.Net boilerplate. Then you deploy an application from another boilerplate such as Node. Those two applications can look the exact same on whatever interface you choose to build from there. Think of a boilerplate as a Texan quick draw.

Common scenario — extracting Twitter insights:

Example: Your company had negative feedback and most of it came from Twitter from a particular situation that might have tarnished goodwill with certain customers. Your boss told you to use “machine learning to know how we are affecting people and who we are affecting too. I want the cause and the demographic and what they want to see from us as a business now”.

You don’t want to have to build out an entire system for this. And how are you suppose to know such intangible information anyway? We are talking about people. And what about having to segment this per user and then analyze each Twitter username? How are you going to gauge who these people are individually and then collectively? Term frequency per hashtag won’t lend a framework built upon cognitive psychology, but that is what Watson Personality Insights can give to you. How to start with that? Personality Insights Node Web Starter boilerplate can get you to where you have a live instance up and ready to go. You don’t have to worry about deploying the application and trailing the logs to watch for errors when you deploy the boilerplate in IBM Cloud. Within five minutes, you have the skeleton of an application and can now program to extract not only who those people are on Twitter, but what they want, what they value, and what kind of consumer they are based on their Twitter profiles.

If you want to do this in a different language than Node engine, go ahead we have several SDKs in different languages and the amount of SDKs is only expanding.

IBM Cloud Github

Watson Developer Cloud Github

Now let’s begin with boilerplates and how they accelerate your development.

Beginning with Boilerplates

ASP.NET CORE CLOUDANT STARTER BOILERPLATE

Use the Cloudant NoSQL DB Service in an ASP.NET Core application.
This is how it looks when you select the ASP.Net boilerplate in IBM Cloud.

These images are the process you would go through if you used boilerplates on IBM Cloud. You select the boilerplate in our IBM Cloud catalog. You can name your application on this page and choose which domain your application is under, and what the services that are provisioned will be, be it ‘Lite’ or ‘Default’ in this scenario for ASP.NET Core or Cloudant NoSQL DB.

Download the starter code used by the boilerplate

After you create your application utilizing the boilerplate, you are directed to the landing page for your new application. I would download the starter code used by this boilerplate to get the application running, extract it, and start building.

Let’s take a look at the project.json for this ASP.Net application.

Oh wow, looks ASP.Netty.

Here is the documentation on the ASP.Net Core Cloudant boilerplate.

Change Application Locally

“Okay great. But how do I redeploy the app to IBM Cloud with the changes I have made locally?”

That would be the Cloud Foundry CLI I told you about earlier.

For a list of all these commands, click here.

To begin, you really need to know these few key commands:

cf login: login into your IBM Cloud account, so use your IBM Cloud credentials.

cf marketplace: See list of services we offer.

cf create-service: Instantiate a IBM Cloud service in your account, which you will then be able to see in your IBM Cloud console dashboard.

cf bind-service: Bind a service to an application in your IBM Cloud account.

cf push: When your application is ready locally, push it into the cloud!

cf logs -recent: Troubleshoot by viewing the logs of your applications.

cf env: See your environment information of an application

cf target: See your API endpoint.

Change your data center by specifying the API Endpoint in the command line upon using the command “cf login”. Then it should prompt you for your endpoint. Here are the API endpoints:

US South region, Dallas: api.ng.bluemix.net

United Kingdom region, London: api.eu-gb.bluemix.net

Australia region, Sydney: api.au-syd.bluemix.net

Germany region, Frankfurt: api.eu-de.bluemix.net

JAVA CLOUDANT WEB STARTER BOILERPLATE

Use the Cloudant NoSQL DB service with the ‘Liberty for Java™’ runtime.

Even though this is a boilerplate for Java Cloudant, the way you set it up and utilize the boilerplate is the same as it appears within the original tutorial above we did with ASP.Net.

When you deploy the boilerplate, it does populate with a sample application, and this is outlined within the documentation for the Java Cloudant Web Starter boilerplate.

Creating apps with Java Cloudant Web Starter
IBM® IBM Cloud provides a Java™ Cloudant Web Starter application. You can add your code, or modify the code and push the changes back to the IBM Cloud environment.
When you run the sample application included with the boilerplate, you get a favorites organizer for organizing the files on your computer in different categories. You can create, modify, and delete categories and upload files of different types in each of the categories. Cloudant® NoSQL DB saves the data on the back end. The application creates a sample category by default.
About the App
The sample application demonstrates how to use the Cloudant Java client, the official Cloudant library for Java, to access the Cloudant NoSQL DB service that is bound to the application. It illustrates the flexible schema feature of Cloudant NoSQL DB, which allows users to attach different types of files to an underlying document in the database.
The Java Cloudant Web Starter is a Java application that dispatches user requests from web client to a servlet.

MOBILEFIRST SERVICES STARTER BOILERPLATE

You can use MobileFirst starter boilerplate to configure mobile application expeditiously through IBM Cloud. It comes with a Node.js SDK, Mobile Client Access, Push Notifications, and the Cloudant NoSQL DB.

MobileFirst itself is a way to set up mobile applications easier. It gives you ways to monitor your application, push notification management, online/offline persistence in storage, and more.

Here are tutorials on using MobileFirst on IBM Cloud!

Mobile Client Access: Use the IBM® Mobile Client Access for IBM Cloud service to protect Node.js and Java for Liberty applications that are hosted on IBM Cloud. By instrumenting your mobile app with the Mobile Client Access SDK, you can require users to log in to access to Node.js or IBM Cloud Mobile services
The IBM® Push Notifications for IBM Cloud service provides a unified platform to send and manage push notifications targeted to Mobile (iOS & Android) platforms, and Web browser applications. This service manages the mapping of your application users to their devices, device platform, and browsers, and handles dispatching push notifications to subscribers. With this service, you can send broadcasts, unicasts (based on userID, deviceID), and tags (or topics) based on push notifications to your customers.
MobileFirst boilerplate architecture

PERSONALITY INSIGHTS NODE.JS BOILERPLATE

A simple Node.js app that uses Personality Insights to analyze text to derive personality traits.

This is the associated documentation for this Personality Insights Node.js boilerplate .

NODE-RED STARTER BOILERPLATE

Node-RED is a tool for wiring together the Internet of Things in new and interesting ways, including hardware devices, APIs, and online services. It is built on top of Node.js and takes advantage of the huge node module ecosystem to provide a tool that is capable of integrating many different systems. Its lightweight nature makes it ideal to run at the edge of the network as well, such as on the Raspberry Pi, and other hack-friendly platforms. — Watson_IoT

My favorite boilerplate. There is a website for Node-RED on IBM Cloud too!

Node-RED Website

Node-RED Watson nodes!!

Node-RED boilerplate documentation

This boilerplate simply offers a browser-based flow editor that you can use to wire APIs, devices and different services together with a bunch of nodes (code blocks)!

npm package Node-RED for Cloudant

The flows you make then can be deployed to a Node.js runtime within this particular functionality of the boilerplate. You can use the Cloudant DB to store anything in relation to your Node-RED flow.

An example of Watson in use within the nodes of the Node-RED boilerplate!!

It might be confusing to begin with this Node-red service. If you are having trouble finding how to get started after instantiating the service on IBM Cloud, try clicking on the app URL for your application in your IBM Cloud console that you have deployed. So, go back to the landing page for all of your applications, and go to your Node-red associated application, and click on that application’s URL. Then keep clicking “Next”, its just showing you all the cool stuff you can do in Node-red, don’t mind it, keep clicking “Next” until you see some text detailing information about your Node flow editor. That is where you want to be to start building!

There you can start using these nodes as you see in the above picture to build your connections. Try going on developworks, DWanswers, Stack Overflow and the like if you have any code questions, someone else likely had your same question too. And if not, ask!

VAADIN RICH WEB STARTER BOILERPLATE

Vaadin is for Java applications and runs on IBM Liberty for Java runtime. This boilerplate contains Vaadin as well as ElephantSQL, aka PostgreSQL as a Service. Sing Li has an article below and has a very nice application that results from that article’s tutorial.

Vaadin was the third boilerplate to be made on IBM Cloud, so if you want any tutorials its just a…..

…. Google away!

Develop, deploy, and scale Java web apps with ease. IBM WebSphere Liberty Profile is a highly composable, ultra-fast, ultra-light profile of IBM WebSphere Application Server designed for the cloud.
As a Java developer, you don’t need to learn HTML5, CSS, or JavaScript to start creating interactive web applications. With the Vaadin framework and its huge library of ready-to-deploy add-ons and components, you can create 100 percent full-stack Java applications by using familiar IDE and server-side technologies. — Sing Li, IBM Java developer

See Sing Li’s article here for a guide on using Vaadin boilerplate for your Java application! Also see this live coding session where they program a Vaadin application on IBM Cloud.

INTERNET OF THINGS PLATFORM BOILERPLATE

The IoT Platform is using the Node-RED service, as detailed above in a different boilerplate. This simply has a different dashboard and overall orientation as a boilerplate package.

Want to control a droid with your mind? You came to the right boilerplate.

Here is the link to the droid mind control IoT Java project!

Another architecture involving sensors and not droid mind control
Get started with IBM® Watson™ IoT Platform by using the Watson IoT Platform Starter boilerplate. With the Starter, you can quickly simulate a device, create cards, generate data, and begin analyzing and displaying data in the Watson IoT Platform dashboard.

The Starter automatically deploys and connects these services:

Watson IoT Platform — The platform gives you a versatile IoT toolkit that includes gateway devices, device management, and powerful application access. By using Watson IoT Platform, you can collect connected device data and perform analytics on real-time data from your organization.

SDK for Node.js — creates a runtime environment in which Node-RED runs.

Cloudant NoSQL DB— a database in which Node-RED stores metadata.

Here is the documentation for this IoT Platform boilerplate.

A tutorial guide on hooking up a sensor and getting metrics on the functionality through Watson IoT Platform.

In this post, we show how to turn your laptop into an IoT device and connect it to the Watson IoT platform. We will control the device from a sample web application as well as gather and visualize data from it.
Stats taken from InterConnect 2016 on Watson IoT service leadership

JAVA WORKLOAD SCHEDULER BOILERPLATE

Getting Started with Workload Scheduler

Walkthrough overview of the service from developers

What is new in the sample application within the boilerplate?
The sample application provided with the boilerplate shows how a favorite organizer can be set up and and how you can load files from your computer and organize them into categories. After creating a category, you can also modify it or eliminate it altogether. In this case, the application lacked a cleanup process aimed at clearing the database of obsolete files.
The following diagram illustrates the architecture of the application and how the services of the new boilerplate can be used to address the cleanup process. The cleanup process consists of two parts: the development of APIs that run on the runtime Liberty, and the creation and scheduling of a process that uses such APIs through the Workload Scheduler service.

NODE.JS CLOUDANT DB BOILERPLATE

Another boilerplate for getting a starter application going automagically with region being picked already, you have your Cloudant DB, everything done for you for Node.

Cloudant NoSQL DB is a fully managed data layer designed for modern web and mobile applications that leverages a flexible JSON schema. Cloudant is built upon and compatible with Apache CouchDB and accessible through a secure HTTPS API, which scales as your application grows. Cloudant is ISO27001 and SOC2 Type 1 certified, and all data is stored in triplicate across separate physical nodes in a cluster for HA/DR within a data center.

STRONGLOOP ARC BOILERPLATE

IBM® IBM Cloud provides a StrongLoop Arc Starter app. You can use StrongLoop Arc to manage your Node.js apps that run on and are supervised by StrongLoop Process Manager.

So StrongLoop Starter and StrongLoop Arc Boilerplate are being deprecated in place of API Connect. The note on StrongLoop website goes to say:

StrongLoop Arc is no longer under active development, and will soon be deprecated. Arc’s features are being included in the IBM API Connect Developer Toolkit: Please use it instead.

API CONNECT TUTORIAL DOCUMENTATION

PYTHON FLASK BOILERPLATE

Flask is a microframework for Python applications, just providing libraries and an ease of use for Pythonic application development. Here is a Mega Tutorial to using Flask for your .py.

This boilerplate just gets a default application live utilizing Python and Flask within IBM Cloud platform. It literally contains the service of Python and that is it. Literally is all.

But if you want to use Flask and Python on IBM Cloud, deploy this boilerplate, download the starter code, and get off to building an application good and fast — this is your ticket.

Hello-World via IBM Cloud GitHub for Python-Flask

IoT FOR ELECTRONICS STARTER BOILERPLATE

This boilerplate is made especially to get you started on the IoT Platform with IoT for Electronics on IBM Cloud, Mobile Client Access service, and Node.js SDK.

What is cool about this particular boilerplate is that you do not necessarily need a device to utilize the service, as you would think the title of the service would imply. You can deploy simulated devices, utilities and appliances with this boilerplate. The added services in the pack address to any other configurations you might want, like mobile services or analytical information on the Watson IoT Platform (as the other service in the boilerplate). The Watson IoT Platform has a dashboard for status, consumption, and device cards within it.

Within IoT Platform for Electronics on IBM Cloud, you can make up to five simulated “washers” which are simply used by the default application formed by the buildpack to show off the service. You can monitor how the wash is going, cause device failure and fix the failure, monitor what load the wash is on, receive alerts and status updates on the washer, and much more. But, the washing should not be the star of this service, just look at how you could utilize this for your own devices within the functionality shown to you!

Create simulated appliances and connect them to the platform to see streaming live data. Use a web-based app to simulate how an appliance receives commands and performs operations. Mimic failures to generate notices and alerts. For the purposes of demonstration, washers are used as the simulated appliance within the IoT for Electronics starter. The appliance you choose to connect could be any type of smart electronics device.

PERSONALITY INSIGHTS JAVA BOILERPLATE

This is literally a boilerplate for a Java application in which contains Liberty for Java runtime with Personality Insights for Watson easily and automatically deployable within IBM Cloud. After that you can download the starter code and start building locally, then pushing it back up via the CF CLI.

MENDIX RAPID APPS BOILERPLATE

This is an excellent boilerplate to know about if you want to utilize Watson services and do it with rapid application deployment [RAD].

Here is the GitHub of an entire suite of Connectors for the Watson services via Mendix!

It comes with the Liberty for Java Cloud Foundry runtime as well as ClearDB MySql DB in tow.

Mendix is an open-standards model-driven development environment that uses graphical models and pre-built application components to let you build sophisticated enterprise grade applications. It’s cloud-native with built in multi-tenancy, platform security and scalability with one-click deployment. -IBM

Here is the A to Z IBM Cloud guide for deploying Mendix applications as well as setting up the Mendix modeler you see above for deployments. This boilerplate works with Java.

RUBY SINATRA BOILERPLATE

So similar to the Python/Flask boilerplate we have the Ruby/Sinatra boilerplate as well. It gives you a quick start in deploying a Ruby application with the Sinatra framework. It just lends to ease of starting to build you application without having to troubleshoot how you have the application hosted on IBM Cloud.

Link to documentation for Ruby Sinatra boilerplate

Whenever there is an application I need on IBM Cloud in a different programming language than I am normally acquainted to using IBM Cloud with, what I would do is start with a boilerplate, download the starter code and integrate that code in with an existing interface or grab some code and integrate it, then start checking everything and pushing the application up to IBM Cloud and watch the logs via command line.

Boilerplates, they just make that transition that much more easier in using IBM Cloud services as well as the Watson Developer Cloud in whatever way you want to start.

Message me if you have any questions on the IBM Cloud usage, deployment models and numerous boilerplates we went over today, thank you!!

❤ Julia

One clap, two clap, three clap, forty?

By clapping more or less, you can signal to us which stories really stand out.