There are many advantages to a microservice architecture, and just as many advantages for why Bluemix is a platform ideally suited to that application construction technique.
One of the benefits of microservices is that each of the applications that compose your solution can be built using whatever language or framework makes sense for that particular application. Each application has different needs based on its function: UI, API, worker, etc. Because every language has its own advantages and disadvantages, this architecture makes sense.
What if each of the microservices could not only be built with a different language but also using a different Bluemix compute platform? That would allow the most flexible implementation, and provide a range of benefits that you might not have initially realized.
Let’s check it out.
Bluemix and Cloud Foundry
Cloud Foundry applications are a great choice when you want to quickly develop a 12-factor application (node, java, php, python..), with the ability to bring in frameworks (Express, MEAN, Loopback, Java EE, Spring, Flask), connect to databases with an object modeler (mongoose) and manage authentications and sessions (passport), etc. The platform gives you the ability to deploy these applications and scale easily while still giving you the control over your entire application.
An event-driven computing platform such as Bluemix OpenWhisk allows you to write code snippets or functions in your favorite language. Called actions, these are suitable for when you want to run stateless logic in response to some event/trigger. You can still connect to databases and APIs, but each action usually completes a small stateless task and returns quickly.
Imagine if you split apart all the process/memory/network intensive functions and put them on their own — these would be your actions. Deploying them to OpenWhisk would allow them to scale on demand, and you would only pay for actual usage. No application servers to manage!
Logistics Wizard: Full microservices demo application
Logistics Wizard is an enterprise-grade sample application which leverages both of these compute options. Written as a full application by the Developer Super Hero Squad, it is a smart supply chain management solution that aims to simulate an environment running an ERP system. It augments this ERP system with applications to improve the visibility and agility of supply chain managers.
We used an architecture that is comprised of a set of loosely-coupled, distributed services that take an existing ERP system and extend its functionality by leveraging various cloud services. In essence, a full microservices approach.
Logistics Wizard Components
Logistics Wizard consists of four main parts:
ERP (Cloud Foundry – Node.js w/ Loopback) — defines the API used by the Logistics Wizard to access data from an ERP system. The simulator is a Node.js application connected to a PostgreSQL database. Through its API, it manages users (supply chain managers and retail store managers), distribution centers, retail stores, and shipments.
WEBUI (Cloud Foundry – React) — the main UI which provides a dashboard for supply chain managers and retail managers to see all the shipments, retail locations and distribution centers, as well as weather and its effect on the supply chain.
Controller (Cloud Foundry – Python Flask) — acts as the main controller for interaction between the services. It receives requests from the user interface and routes them to the ERP or the weather recommendation module.
Logistics Wizard Cloud Foundry Applications
You’ll notice that we deploy “dev” and “prod” versions of each of the three Cloud Foundry applications.
Logistics Wizard OpenWhisk actions
Check out Logistics Wizard’s main github repository for more details about all the components that make up this solution and how they all come together. We use continuous integration to automate the entire lifecycle for all the microservices independently.
Learn more about the Logistics Wizard on Bluemix by viewing the video below.
Create your own microservices
Interested? Read these posts to discover everything we did to build the Logistics Wizard UI, API, testing and do continuous delivery. We very much encourage you to crib our code and extend it or use it as a base for your own applications.
Perhaps the next great advancement of our age, a better way to protect people from destruction, is an idea you have . . . a code that can save lives. Learn more about Call for Code, a rallying cry for developers to help create the next big solution to disaster crisis.
Delivering at scale: In the final part of the series, we discuss integrations with on-site systems at the All England Club and how we used Multi-Region within IBM Cloud to ensure scale and availability.
Integration with the Facebook platform: This is the first in a series of posts that will detail how IBM iX designed, developed, and delivered the Facebook Messenger Bot available at the The Championships, Wimbledon 2018.