How to Build and Deploy Vert.x Fat or Thin Microservice Application to the Cloud

10

1722-1-vert-x-logoEclipse Vert.x started to promote microservices even before this buzzword appeared, and successfully continues to showcase the benefits of such an approach. This tool-kit is designed for building reactive applications using any language that runs on the JVM, including Java, Groovy, Ceylon, Ruby, JavaScript, Kotlin, and Scala.

Basically, Vert.x application is a plain JAR file so the application can be packaged in two different ways:

  • Fat, a self-contained single JAR file with all necessary dependencies inside, usually an archive of a big size as it contains everything including application server run-time;
  • Thin, a JAR file that doesn’t contain run-time and dependencies by default but automatically downloads them during the first launch. It is considered as the most widely used approach nowadays, as it was the only one well standardized for many years and provides a set of advantages, such as faster and more efficient process of building and packaging.

In this article, we will cover build and deploy processes for Vert.x Java applications using both approaches, Fat and Thin. The application will be packaged in the required format automatically with the help of Builder add-ons prepared by Jelastic. The topology will consist of Maven build node and JVM containers for running microservices.

1722-1-maven-node-and-jvm-containers-topology

Vert.x Fat Jar Builder Installation

To get started, log in to Jelastic dashboard, find the Vert.x Fat Jar Builder in the Marketplace and click Install.

1722-1-install-vert-x-fat-jar-builder

Or you can import Vert.x Fat manifest from GitHub by link:

https://github.com/jelastic-jps/vertx/blob/master/microservice-fat-jar/manifest.jps

To do that, press Import at the Dashboard then paste the link in the URL tab and confirm installation by clicking Import button in the opened window.

1722-1-import-vert-x-fat-manifest

If required, change installation settings such as environment name or Git repository link to a custom Vert.x Fat project. Then press Install.

1722-1-install-vert-x-fat-project

When the installation and building of the project are completed, a corresponding message appears. You still need to wait a few minutes for deploy to be finished (feel free to track the process in the Tasks panel). In the default implementation, it is done under the api/greeting context.

1722-1-open-vert-x-fat-jar

Afterward, you can make sure, that application is up and running by pressing Open in browser button.

1722-1-vert-x-fat-jar-jelastic-paas-url

Vert.x Thin Jar Builder Installation

Find the Vert.x Thin Jar Builder in the Marketplace and click Install.

1722-1-install-vert-x-thin-jar-builder

Or import Vert.x Thin manifest from GitHub:

https://github.com/jelastic-jps/vertx/blob/master/microservice-thin-jar/manifest.jps

1722-1-import-vert-x-thin-manifest

If required, change installation settings such as environment name or Git repository link to a custom Vert.x Thin project. Then press Install.

1722-1-install-vert-x-thin-project

When the installation and building of the project are completed, a corresponding message appears. You still need to wait a few minutes for deploy to be finished (feel free to track the process in the Tasks panel). In the default implementation, it is done under the api/greeting context.

1722-1-open-vert-x-thin-jar

Afterward, you can make sure, that application is up and running by pressing Open in browser button.

1722-1-vert-x-thin-jar-jelastic-paas-url

Running Multiple Microservices with Vert.x Projects

You can use just created Maven node for building extra projects and deploying them to different environments to get a set of distributed microservices.

1722-1-multiple-vert-x-projects

First of all, create a separate environment with Java Engine.

1722-1-java-engine-environment

Then click Add Project next to the Maven node in the initial environment.

1722-1-add-project-to-maven-node

Specify the name and link to the project, as well as choose the environment where it should be deployed. Additionally, you can activate automatic updates. Then confirm pressing Add + Deploy.

1722-1-build-and-deploy-java-application

More details on how to build and deploy Java applications can be found at the Maven node documentation.

In this way, you can easily build and deploy your Vert.x based applications. Register and try out the automated JAR packaging with Jelastic Builder add-on for your custom projects to feel the benefits of microservices running in the cloud.

SOURCEJelastic, Inc.