Skip to content

cnxtech/daytrader-example-gatewayrepo

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

40 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Gateway Microservice

The Gateway to the DayTrader business operations

Monolithic Architecture

DayTrader is multi-tier application is built around the paradigm of an online stock trading system. Example business operations include login, register, view portfolio, lookup stock quotes, and buy or sell stock. DayTrader was originally developed by IBM and donated to the Apache Geronimo community in the 2005 timeframe. The DayTrader architecture is representitive of monolithic applications that many businesses are still using. For that reason, we selected it to clarify the techniques for refactoring a monolith to microservices. For the monolithic architecture, see daytrader - a more complex application.

Microservices Architecture

Consider the following microservices architecture diagram. In this architecture, the Web is responsible for the UI to the DayTrader business operations. It accepts incoming HTTPS requests from the browser and delegates them to the Gateway Microservice. The Gateway in turn redirects the request to the (Accounts Microservice, Portfolios Microservice, or Quotes Microservice; which implements that business operation. All of these components are Spring Boot applications.

Target-State-Architecture

Prerequisites

  1. Install Java 8

  2. Install Maven 3.3.9+

  3. Install Docker

  4. Install Helm Client

  5. Create DockerHub Account

Configuration

Maven must be able to authenticate to your DockerHub account so it can push Docker images

  1. In daytrader-gateway/pom.xml change the ${user.name} to your DockerHub user name:

    <docker.image.prefix>${user.name}</docker.image.prefix>
  2. In daytrader-gateway/env/external/k8s/gateway-deployment.yaml, change the image to your DockerHub username

    image: YOUR_DOCKERHUB_USERNAME/daytrader-gateway:4.0.18
  3. In daytrader-gateway/pom.xml, you don't have to change the <tag>, but if you do, change the above version too.

    <tag>4.0.18</tag>
  4. In ~/.m2/settings.xml, add the following so Maven can push images to your DockerHub account

    <servers>
        <server>
            <id>docker.io</id>
            <username>YOUR_DOCKERHUB_USERNAME</username>
            <password>YOUR_DOCKERHUB_PASSWORD</password>
        </server>
    </servers> 

Setup

You will need a cluster to run the application. If you already have a cluster with the NGINX Ingress Controller installed then feel free to use it. If not, we have provided instructions to help you setup a cluster on Minikube, Amazon EKS, Google Kubernetes Engine, and Azure Kubernetes Service. We have also tested the application on those platforms. For other platforms, see Picking the right Solution.

  1. Setup on Minikube

  2. Setup on Amazon EKS

  3. Setup on Google GKE

  4. Setup on Azure AKS

Build, Release, and Run

You can run the application on Spring Boot or on the Kubernetes Cluser.

  1. Run on Spring Boot

  2. Run on Kubernetes

Notes

  1. The application code and build scripts were 100% portable across the Kubernetes platforms we tested.

  2. This means you can write the code once and run it on any platform. This is great news for developers!

Migration Approach

In this section we will take a look at how we migrated the Gateway Spring Boot Application to Kubernetes.

  1. Generate the Docker Image

  2. Create the Kubernetes Deployment

  3. Create the Kubernetes Service

Notes

  1. The application deployment scripts and commands were 100% portable across the Kubernetes platforms we tested.

  2. This means you can write the scripts once and deploy to any Kubernetes platform. This is great news for DevOps!

About

No description, website, or topics provided.

Resources

Code of conduct

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Java 98.5%
  • Dockerfile 1.5%