The Blog

 

The IBM Stock Trader application is a simple stock trading sample application where you create various stock portfolios and add shares of stock to each for a commission. It consists of a set of microservices that can be deployed into a Kubernetes cluster running in IBM Cloud Private. It demonstrates using a database, message queue, and business rule management system that are deployed to the same cluster and using services such as API Connect, Cloud Functions, and Tone Analyzer that are hosted in the IBM Cloud. The following diagram shows the interactions between the microservices and their dependencies:

Interactions between the microservices and their dependencies in the IBM Stock Trader sample application

The IBM Stock Trader microservices are available as a set of projects in GitHub.

However, it was hard to figure out how to set up the complete application from the documentation in each project. I set out to fix that by creating a new project that included:

  • A full set of instructions to deploy each middleware and service dependency
  • A set of scripts to help automate configuration steps where possible
  • A Helm chart to deploy the microservices from Docker Hub

Get started

The instructions walk you through setting up the middleware dependencies (IBM Db2 Developer-C, IBM MQ Advanced for Developers, IBM Operational Decision Manager, and Redis) in IBM Cloud Private. They also walk you through setting up API Connect, Tone Analyzer, and Cloud Functions in the IBM Cloud.

The most interesting aspect of this work was developing the scripts. They were designed to work with no input from the user. They use kubectl commands to find key Kubernetes resources, such as services that were created by the middleware Helm charts. They use this information to create Kubernetes secrets for IBM Stock Trader to access the middleware service and to create middleware artifacts, such as database tables and messaging queues.

The approach I took focuses on the fundamentals. In other words, the user must deploy the application step-by-step and build it from the ground up. This could be used to build a higher-level turnkey solution that would deploy everything at once, using tools such as Helm, Ansible, or UrbanCode Deploy. I originally tried to develop the all-in-one solution first, but found it was too difficult to start there. I needed to develop the groundwork first. Now that it’s there, future efforts to automate the complete deployment should be easier.

I encourage you to try running the IBM Stock Trader application yourself to see how to construct a hybrid cloud application using microservices, collocated middleware, and cloud-hosted services.