Vertx - Distribution Deployment

About

Distribution deployment is the deployment of a verticle that is based on the availability of a vertx distribution

Steps

Example with gradle and the java library distribution

plugins {
  id 'java'
  id 'java-library-distribution'
}
dependencies {

  // Vert.x
  compileOnly  "io.vertx:vertx-core:$vertxVersion"
  // Web
  compileOnly  "io.vertx:vertx-web:$vertxVersion"
  compileOnly  "io.vertx:vertx-web-client:$vertxVersion"
  // Database
  compileOnly  "io.vertx:vertx-jdbc-client:$vertxVersion"
  api "org.hsqldb:hsqldb:2.5.0"
  // Vertx service
  compileOnly  "io.vertx:vertx-service-proxy:$vertxVersion"
  compileOnly  "io.vertx:vertx-codegen:$vertxVersion"
  annotationProcessor "io.vertx:vertx-codegen:$vertxVersion:processor"
  // <3.8.4
  // annotationProcessor "io.vertx:vertx-service-proxy:$vertxVersion:processor"
  compileOnly "io.vertx:vertx-service-proxy:$vertxVersion"
  annotationProcessor "io.vertx:vertx-service-proxy:$vertxVersion"
  
}
  • By running the distZip tasks, You get the verticle and its runtime dependencies in a zip format. Example unzipped:

_

  • Copy the zip to your server
  • Unzip it into a directory (generally /verticles)

Example:

cd /verticles # the location of the verticle jar
vertx run com.company.vertxapp.MainVerticle
    -cp /verticles/MY_VERTICLE.jar;/verticles/lib/*
cd /verticles
docker run -i -t -p 8080:8080 \ 
    -v $PWD:/verticles \
    vertx/vertx3-exec \  
    run com.company.vertxapp.MainVerticle \ 
    -cp /verticles/MY_VERTICLE.jar;/verticles/lib/*

Powered by ComboStrap