Digital Developer Conference: Cloud Security 2021 -- Build the skills to secure your cloud and data Register free

Deploy a microservices app to IBM Cloud Code Engine

Summary

This code pattern introduces you to IBM Cloud Code Engine and shows you how to deploy a polyglot microservices application to the managed serverless platform. The sample application used in this code pattern is a part of the Bee Travels project. The microservices included in this code pattern are:

  • Destination v1 (Node.js)
  • Car Rental v1 (Node.js)
  • Hotel v1 (Python)
  • UI (Node.js and React)

Description

Bee Travels is a conceptual travel booking web application designed to demonstrate a polyglot microservices architecture. It uses best practices in the software development lifecycle and popular open source technologies. The application encompasses the full, developer lifecycle experience and is also written in recommended coding languages.

Because Bee Travels is a microservices application, it has services that depend on one another and the application depends on various cloud-native technologies. This is where IBM Cloud Code Engine comes into play.

Code Engine is a managed serverless platform that can run both applications that serve HTTP requests, which include web applications or microservices, and batch jobs that run once in order to complete a task. These workloads are built within the same Kubernetes infrastructure and take advantage of open source technologies such as Knative and Istio. With Knative, Code Engine can run serverless and autoscale applications. With Istio, Code Engine can route and manage application traffic. In addition, Code Engine is integrated with LogDNA, which enables you to log your applications.

As a developer, the benefit of using Code Engine is that the Kubernetes infrastructure and cluster complexity is invisible to you. You do not need Kubernetes training and you can just focus on your code.

Flow

architecture flow diagram

  1. The build feature of IBM Cloud Code Engine clones the GitHub repo and creates the container images for the different Bee Travels microservices in the repo based on the provided Dockerfiles.
  2. The newly-built container images are pushed to repos on the provided image registry, which is Docker Hub in this case.
  3. Code Engine applications are created for the Bee Travels microservices from the newly-built container images on Docker Hub.
  4. The IBM Cloud Load Generator service drives traffic to the Bee Travels application running in Code Engine. The autoscaling component of Code Engine adjusts the number of running instances of the application based on the amount of incoming traffic.

Instructions

The detailed steps for this code pattern are available in the README.md file. The steps show you how to:

  • Clone the repo
  • Build and deploy to Code Engine
  • Generate traffic