Deploying Ratpack Application on Heroku

29 / May / 2015 by Sachin Verma 0 comments

Recently, I was working on a micro-service using Ratpack framework.  I wanted to deploy it to Heroku. I had tried to find good documentation for deploying on Heroku but couldn’t find as such. After much trial and error, I finally managed to get a working configuration for successful deployment. As Heroku has very good support for Gradle-based projects and just we need to give right configuration details and all would be done. So, Here are the steps for right configuration:

Artifacts: we would need to create some files at root of the project which would contain

  1.  It will let Heroku  know which version of java to be used


  2. settings.gradle: = 'project_name'

  3. Procfile: It would let Heroku know from where it needs to pick a big fat jar of the project and what command, it needs to execute to run project.

web: java -jar -Dport=$PORT build/libs/project_name-all.jar

Edit build.gradle: we would need to add a dependency  in buildscript for buildingfat jar

buildscript {
    repositories {
    dependencies {
        classpath "io.ratpack:ratpack-gradle:0.9.15"
        classpath "com.github.jengelman.gradle.plugins:shadow:1.2.1"

apply plugin: "io.ratpack.ratpack-groovy"
apply plugin: "com.github.johnrengelman.shadow"

and closure of Task stage :

task stage {
    dependsOn shadowJar

This above code will help in generating big fat jar of ratpack application with name project_name-all.jar when Heroku would run “gradle stage” task for building the code.


Just That’s it…
Now! We are ready to commit our code to Heroku and deployment done :)


Leave a comment -