Skip to content

malibupctn/daytrader-example-webrepo

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DayTrader Web

The Web UI 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 requests from the browser and delegates them to the Gateway Microservice. The Gateway Microservice 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-web/pom.xml change the ${user.name} to your DockerHub user name:

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

    image: YOUR_DOCKERHUB_USERNAME/daytrader-gateway:4.0.18
  3. In daytrader-web/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 Web UI Spring Boot Application to Kubernetes.

  1. Generate the Docker Image

  2. Create the Kubernetes Deployment

  3. Create the Kubernetes Service

  4. Create the Certificate and Prvate Key

  5. Create the Kubernetes Secret

  6. Create the Kubernetes Ingress

  7. Configure the DNS 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

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Java 83.5%
  • HTML 14.9%
  • Other 1.6%