The Web UI to the DayTrader business operations
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.
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.
Maven must be able to authenticate to your DockerHub account so it can push Docker images
-
In
daytrader-web/pom.xml
change the ${user.name} to your DockerHub user name:<docker.image.prefix>${user.name}</docker.image.prefix>
-
In
daytrader-web/env/external/k8s/web-deployment.yaml
, change the image to your DockerHub usernameimage: YOUR_DOCKERHUB_USERNAME/daytrader-gateway:4.0.18
-
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>
-
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>
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.
You can run the application on Spring Boot or on the Kubernetes Cluser.
Notes
-
The application code and build scripts were 100% portable across the Kubernetes platforms we tested.
-
This means you can write the code once and run it on any platform. This is great news for developers!
In this section we will take a look at how we migrated the Web UI Spring Boot Application to Kubernetes.
Notes
-
The application deployment scripts and commands were 100% portable across the Kubernetes platforms we tested.
-
This means you can write the scripts once and deploy to any Kubernetes platform. This is great news for DevOps!