Varieties of packaging a Vert.x application, and deploying it

Viewed 43

I recently started to try developing a Vert.x application. Its reactive manner is good and understandable for me, but I was not very sure about patterns of packaging a Vert.x application, and patterns of deploying it. ("Deploying" here means deploying the entire application, not deploying a verticle.)

I looked for some documents and articles, then I saw at least :

  • Run through mvn / gradle run(Mod) from a source code directory
  • Use a vertx command to "deploy" a verticle with .java source file(s)
  • Build a Fat JAR
  • (Extra: Embedding it in another Java application http://vert-x.github.io/embedding_manual.html)

It is interesting that those kinds of deployment are possible, but I was not very sure of any other packaging/deployment method, and how many variations of packaging/deployment styles are available for Vert.x.

Some of them did not look like, to be honest, good production-ready deployment methods to me especially in terms of the manner of immutable deployment.

Q1. Does Vert.x have a good summary / document for patterns of packaging and deploying an entire Vert.x application, especially in production?

Q2. What are advantages and disadvantages for each pattern?

Q3. Any commentary how a Vert.x application starts up internally? (I looked into some code under io/vertx/core/cli/, and I saw it is spawning another JVM process. It was not very to understand its bootstrapping architecture quickly...)

1 Answers

I avoid the vert.x launcher and use regular deployment patterns.

  1. Compile the code into a fat jar using maven or gradle
  2. Put the fat jar into a docker image
  3. Deploy the docker image

This way everything runs from your main function

Here is a starter app for vertx that you can clone and run the following commands on : https://github.com/asad-awadia/vertx-starter

mvn clean compile install package to create the fat jar

mvn compile jib:dockerBuild to build the docker image

mvn compile jib:buildTar to build the tar of the docker image

Related