Dropwizard Automatic Build and Deploy to Cloud-Native Microservices

15

2574-1-dropwizard-logoToday we keep covering the topic of building Java microservices, so decided to pay heed to a popular framework, called Dropwizard. Comparing to alternatives, this framework is pretty lightweight and rapid in getting web-services up and running. This makes it a perfect choice for microservice architectures.

In this article, we will go through the steps of building a Dropwizard based Java application as a JAR file and deploying it as a scalable microservice to the cloud. The process will be automated with a help of Dropwizard Fat Jar Builder that creates Maven build node with a set of JVM servers and initiates the application deployment.

2574-1-dropwizard-microservice-structure

Dropwizard Fat Jar Builder Installation

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

2574-1-install-dropwizard-fat-jar-builder

Or you can import Dropwizard Fat manifest from GitHub with the link:

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

To do that, press Import within a dashboard, paste the link in the URL tab and confirm installation by clicking Import button in the opened window.

2574-1-import-fat-jar-microservice

Change the installation settings if you need to (for example, you can use the link to the custom project in the Git Repo field). Then press Install.

2574-1-install-dropwizard-package

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 Tasks panel). In the default implementation, it is done under api/greeting context.

2574-1-open-dropwizard-fat-jar-builder-in-browser

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

2574-1-dropwizard-fat-jar-url

Running Multiple Microservices with Dropwizard 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.

2574-1-dropwizard-environments

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

2574-1-create-java-environment

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

2574-1-add-project-to-the-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.

2574-1-deploy-dropwizard-project

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 Dropwizard 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.