Skip to content

A Vert.x/Java Implementation Of The Elizabethan Insult Microservices Demo

Notifications You must be signed in to change notification settings

rhoar-shootout/rhoar-vertx

Repository files navigation

Vert.x Microservices & Kubernetes

Vert.x

Eclipse Vert.x is a tool-kit for building reactive applications on the JVM

What does that mean?

  • Messaging
  • Non-Blocking APIs
  • Clustering
  • Simplified Concurrency

Why would I want to use Vert.x?

  • Fast
  • Lightweight
    • Core Vert.x requires less memory than NodeJS/Express
  • Multithreaded
    • Unlike some other non-blocking platforms, Vert.x can take advantage of all processor cores
  • Polyglot
    • Vert.x applications can be written in a number of languages, and can even mix and match several languages in a single project
  • Scalable
    • Clustering is available with little or no effort for Developers/Operations
  • Unopinionated
    • It's JUST a library, you can use it in ANY Java application

Vert.x Resources

Microservices Overview

This application consists of 3 microservices and a VueJS frontend.

  • Adjective Service - Provides era-appopriate derrogative adjectives
  • Noun Service - Provides era-appropriate derrogative nouns
  • Insult Service - Pulls adjective and nouns from the other services to build a complete insult
    • Also implements circuit-breakers to prevent broken services from seriously impacting the application
  • VueJS Reactive UI

The diagram below shows the logical architecture of the system:

Logical Architecture

And the start-up flow for the Adjective and Noun services is diagrammed as well:

Start Up Flow

Running This Project Locally

Prerequisites

Launching The Application In "Development" Mode

The Maven Vert.x Plugin allows you to run the application in a mode where any changes to the code will cause a recompile and redeploy automatically. This allows you to do quick near-realtime development work

git clone https://github.com/rhoar-shootout/rhoar-vertx.git
cd rhoar-vertx
mvn -T 4 compile vertx:run -pl noun,adjective,insult,ui

This will actually cause 4 instances of Maven to run in separate processes. Each Maven process will monitor it's own sub-module for changes. When changes are detected, the sub-module will rebuild and redeploy.

Launching The Application Using In Containers

  • On Linux(bash)/MacOS(bash)/Windows(PowerShell) With Minishift
minishift start --vm-driver=virtualbox
oc login -u developer -p developer https://$(minishift ip):8443/
mvn clean package install
  • Using docker-compose
mvn clean package
docker-compose up --build 

Deploying And Managing On OpenShift

The OpenShift deployment includes a complete CI/CD pipeline implementation using:

  • Jenkins
  • SonarQube
  • Sonatype Nexus
  • OWASP Zed Attack Proxy
  • OWASP Dependency Check
git clone https://github.com/rhoar-shootout/rhoar-vertx.git
cd rhoar-vertx
git checkout ci-cd
oc login <Your OpenShift Cluster Master>
./run.sh

You COULD potentially deploy the full CI/CD pipeline on MiniShift if you have a sufficiently powerful computer, but realize that this deployment usually takes up enough resources for a server-class system