{"id":16119642,"url":"https://github.com/stephenott/js-vertx-fatjar","last_synced_at":"2026-04-11T13:07:51.248Z","repository":{"id":148176185,"uuid":"124701348","full_name":"StephenOTT/js-vertx-fatjar","owner":"StephenOTT","description":"A boilerplate project for Vert.x using Javascript and gradle to generate fatjars.  Also provides Ruby Example","archived":false,"fork":false,"pushed_at":"2018-03-13T12:47:10.000Z","size":84,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-02-12T15:55:05.472Z","etag":null,"topics":["docker","fatjar","gradle","javascript","jruby","nashorn","ruby","vertx","vertx-lang-js","vertx-lang-ruby"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/StephenOTT.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-03-10T21:50:55.000Z","updated_at":"2020-04-30T17:57:49.000Z","dependencies_parsed_at":"2023-05-19T09:00:22.378Z","dependency_job_id":null,"html_url":"https://github.com/StephenOTT/js-vertx-fatjar","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/StephenOTT%2Fjs-vertx-fatjar","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/StephenOTT%2Fjs-vertx-fatjar/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/StephenOTT%2Fjs-vertx-fatjar/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/StephenOTT%2Fjs-vertx-fatjar/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/StephenOTT","download_url":"https://codeload.github.com/StephenOTT/js-vertx-fatjar/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247468103,"owners_count":20943719,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["docker","fatjar","gradle","javascript","jruby","nashorn","ruby","vertx","vertx-lang-js","vertx-lang-ruby"],"created_at":"2024-10-09T20:54:40.815Z","updated_at":"2025-12-30T23:06:27.160Z","avatar_url":"https://github.com/StephenOTT.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# js-vertx-fatjar\nA boilerplate project for Vert.x using Javascript and gradle to generate fatjars\n\n## What does this thing do?!\n\nThis is a Vertx.io boilerplate project that uses Gradle as a build system to run Vertx instances for development, and create FatJar executables for production use.  The repo includes a Dockerfile showing how to deploy the FatJar in a Docker environment.\n\nWhy does this matter?  Well, because it is a Javascript Vertx verticles deployment.  Meaning that you dont have to write Java. You can use your JavaScript knowledge and take full advanage of Vertx and the \"extras\" and Java provides.  It also includes a Ruby verticle for showing how to leverage the Vertx Polyglot capabilities.\n\nAnything else?  Yes... Because we are using the [gradle](https://gradle.org) build system we also the get to leverage NPM, Yarn, Gulp, and Bower for JS dependencies.  Currently NPM is setup and you can control the dependencies with the package.json file, just like a regular Node project.  The Ruby dependencies are downloaded with the Bundler gem and RubyGems.  You can update the Gemfile file with the dependencies for Ruby verticles.\n\nThis gives us a really powerful build system, multi-language dependency mamagement system, and deployment system, wrapped in a relatively simple setup.  We get JS/NPM + Ruby/RubyGems + Java/Maven all wrapped in a nice to use package, and we can package our build into a single FatJar.\n\nCheck out the `app` folder and the `app/MyJavaScriptVerticle.js` entry verticle, and... Get Started Right Now!!\n\n### Vertx CLI Docker alternative\n\nSee: \nhttps://github.com/DigitalState/camunda-worker-vertx/tree/master/worker for an example of a Docker based Vertx CLI example of the same poject.  This does not use Gradle and is more pure Vetx + Vertx Stack Manager + Docker.  \nSee:\nhttps://github.com/DigitalState/camunda-worker-vertx/tree/feature-ruby-rubygems-stackmanager/worker for a Ruby variation that downloads the Gems through the Dockerfile from RubyGems.\n\n\n# Quickstart\n\n1. Add NPM Dependencies: `./gradle npmInstall` (reads from [package.json](./package.json))\n\n1. Add RubyGem Dependencies: `./gradle bundleInstall` (reads from [Gemfile](./Gemfile))\n\n1. Run the app: `./gradlew run`.  Once you are done working within gradle, you can build the FatJar.  The Run task uses the [vertx-config.json](./vertx-config.json) as the entry verticle's (MyJavaScriptVerticle.js) config file.\n\n1. Build FatJar: `./gradlew shadowJar` which will build the fatJar in `./build/libs/js-vertx-fatjar-0.1.0-fat.jar`\n\n1. You can run the FatJar in a Java 8+ environment by running: `java -jar /path/to/js-vertx-fatjar-0.1.0-fat.jar -conf path/to/vertx-config.json`.\n\n    Note that a config.json value is required.  If the file is a empty object (such as `{}`) or is omitted, the Vertx instance will be stopped.\n\n## Sample Console Output\n\n```console\nWatched paths: [/Users/MyUser/Documents/GitHub/js-vertx-fatjar/./app]\nStarting the vert.x application in redeploy mode\nStarting vert.x application...\nfa10a5e9-6baa-4a3c-b8bb-e6381621dce2-redeploy\nconfig.json contents:\n{\"mykey\":\"myvalue\"}\nruby_gems absolute path: /Users/MyUser/Documents/GitHub/js-vertx-fatjar/build/resources/main/ruby_gems\nStarting primary verticle\nSucceeded in deploying verticle\nStarting 3 Verticle\ntrue \u003c-- Outputted from verticles/MyJavaScriptVerticle2.js to show that lodash was loaded\nStarting 2 Verticle\n2018-03-13 16:24:41 -0400 \u003c-- Outputted from Ruby\n2018-03-13 11:00:00 -0400 \u003c-- Outputted from Ruby\n2018-03-13 09:15:00 -0400 \u003c-- Outputted from Ruby\n```\n\nYou might also see warnings with messages such as:\n\n```console\nThread Thread[vert.x-eventloop-thread-1,5,main] has been blocked for 3529 ms, time limit is 2000\nThread Thread[vert.x-eventloop-thread-1,5,main] has been blocked for 4533 ms, time limit is 2000\nThread Thread[vert.x-eventloop-thread-1,5,main] has been blocked for 5536 ms, time limit is 2000\nio.vertx.core.VertxException: Thread blocked\n```\n\nThese tend to occur when Vertx instance is first starting up, and the machine is slow.\n\n\n# Goals\n\n1. Create a project structure that is as close to a docker vertx cli structure as possible.  Example: not using `src/main/resources`.\n\n# Install NPM Dependencies:\n\nSee the package.json file in project root.\n\nUses: https://github.com/srs/gradle-node-plugin.\nSee the Github repo for additional plugin support for Yarn, Grunt, and Gulp. \n\nTo download dependencies run: `./gradle npmInstall`\nA `node_modules` folder will be added to the project root.  This folder is in the `.gitignore` file.  When you run the build the following will run:\n\n```groovy\nprocessResources {\n  from 'app'\n  from ('node_modules') {into 'node_modules'}\n}\n```\n\nThe above will create a `node_modules` folder in the build's root (inside of the `app` folder).\n\n@TODO:\n- [ ] Add npmInstall and Update tasks into Run and Build tasks\n\n\n# Dockerfile usage\n\nInlcuded in this project is a dockerfile that can be used to build an image with the FatJar.\n\nThe dockerfile depends on the `./build/lib/js-vertx-fatjar-0.1.0-fat.jar` and `./vertx-config.json` files.\n\nOnce you have the FatJar generated, you can run the following from the root of the project:\n\n1. `docker build -t fatjar/js-vertx .`\n    which will result in the following:\n    ```console\n    Sending build context to Docker daemon  64.01MB\n    Step 1/12 : FROM java:8-jre\n    ---\u003e e44d62cf8862\n    Step 2/12 : ENV VERTICLE_FILE js-vertx-fatjar-0.1.0-fat.jar\n    ---\u003e Using cache\n    ---\u003e 9a290df84557\n    Step 3/12 : ENV CONFIG_JSON_FILE vertx-config.json\n    ---\u003e Using cache\n    ---\u003e 713eefc4a516\n    Step 4/12 : ENV VERTICLE_HOME /usr/verticles\n    ---\u003e Using cache\n    ---\u003e 559a89eb1858\n    Step 5/12 : EXPOSE 8080\n    ---\u003e Using cache\n    ---\u003e d5f72273653d\n    Step 6/12 : EXPOSE 8081\n    ---\u003e Running in 38a8cbe565e1\n    Removing intermediate container 38a8cbe565e1\n    ---\u003e e3767329bfb6\n    Step 7/12 : EXPOSE 8086\n    ---\u003e Running in 23bdc14cf854\n    Removing intermediate container 23bdc14cf854\n    ---\u003e 386c166d44c6\n    Step 8/12 : COPY build/libs/$VERTICLE_FILE $VERTICLE_HOME/\n    ---\u003e 2b6e1847dd65\n    Step 9/12 : COPY $CONFIG_JSON_FILE $VERTICLE_HOME/\n    ---\u003e 515b29356808\n    Step 10/12 : WORKDIR $VERTICLE_HOME\n    Removing intermediate container 8c216df18942\n    ---\u003e 5cf7ff914391\n    Step 11/12 : ENTRYPOINT [\"sh\", \"-c\"]\n    ---\u003e Running in 042e70e58e06\n    Removing intermediate container 042e70e58e06\n    ---\u003e ed865eba45b8\n    Step 12/12 : CMD [\"exec java -jar $VERTICLE_FILE -conf $CONFIG_JSON_FILE\"]\n    ---\u003e Running in 7a227e7bcb5e\n    Removing intermediate container 7a227e7bcb5e\n    ---\u003e 9d476cdb9ddf\n    Successfully built 9d476cdb9ddf\n    Successfully tagged fatjar/js-vertx:latest\n    ``` \n2. `docker run fatjar/js-vertx`\n    which will result in the following:\n    ```console\n    config.json contents:\n    {\"mykey\":\"myvalue\"}\n    ruby_gems absolute path: file:/usr/verticles/js-vertx-fatjar-0.1.0-fat.jar!/ruby_gems\n    Starting primary verticle\n    Succeeded in deploying verticle\n    true\n    Starting 2 Verticle\n    Starting 3 Verticle\n    2018-03-13 17:04:58 -0400\n    2018-03-13 11:00:00 -0400\n    2018-03-13 09:15:00 -0400\n    ```\n\nYou can also go to:\n\n1. `localhost:8080` (being served by `./MyJavaScriptVerticle.js`)\n1. `localhost:8081` (being served by `./app/verticles/vert2/MyJavaScriptVerticle2.js`)\n1. `localhost:8086` (being served by `./app/verticles/vert3/MyJavaScriptVerticle3.js`)\n\n# Notes:\n\n1. Logging Levels for JUL: https://docs.oracle.com/javase/8/docs/api/java/util/logging/Level.html\n\n1. Add gradle dep for jRuby Bundler and then use task to run a Bundler install command.\n\n1. Getting the current ClassLoader: https://github.com/vert-x3/vertx-lang-js/commit/d4323889e71b21e35a873a73fb939eba53c2d0de#diff-a5533d7f2941dd2c95a4d7a28f1106afR294\nhttps://docs.oracle.com/javase/7/docs/api/java/lang/ClassLoader.html#getResource(java.lang.String)\n\n1. Active issue for simplify the GEM_PATH lookup: https://github.com/vert-x3/vertx-lang-js/issues/73\n\n1. Does the use of the GEM_PATH using the absolute path classloader feature make the usage of static cached files not relevant? Do NPM files get cached?  What are the pros and cons?  see: http://vertx.io/docs/vertx-web/java/#_disabling_file_caching_on_disk for additional chaching docs about vertx.\n\n1. Nashorn classloader docs: https://github.com/DaniHaag/snippets/wiki/Nashorn\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstephenott%2Fjs-vertx-fatjar","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstephenott%2Fjs-vertx-fatjar","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstephenott%2Fjs-vertx-fatjar/lists"}