{"id":19834,"date":"2015-05-29T13:26:36","date_gmt":"2015-05-29T07:56:36","guid":{"rendered":"http:\/\/www.tothenew.com\/blog\/?p=19834"},"modified":"2017-04-25T09:59:21","modified_gmt":"2017-04-25T04:29:21","slug":"deploying-ratpack-application-on-heroku","status":"publish","type":"post","link":"https:\/\/www.tothenew.com\/blog\/deploying-ratpack-application-on-heroku\/","title":{"rendered":"Deploying Ratpack Application on Heroku"},"content":{"rendered":"<p>Recently, I was working on a micro-service using Ratpack framework. \u00a0I wanted to deploy it to Heroku. I had tried to find good documentation for deploying on Heroku but couldn&#8217;t find as such.\u00a0After 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:<\/p>\n<p><strong style=\"font-size: 20px;\">Artifacts:\u00a0<\/strong>we would need to create some files at root of the project which would contain<\/p>\n<p><em>\u00a0 1. <span style=\"color: #333300;\">system.properties<\/span><\/em>: \u00a0It will let\u00a0Heroku \u00a0know which version of java to be used<\/p>\n<pre>java.runtime.version=1.8<\/pre>\n<p><em>\u00a0 2.<span style=\"color: #333300;\"> settings.gradle<\/span><\/em>:<\/p>\n<pre>rootProject.name = 'project_name'<\/pre>\n<p><em>\u00a0 3. <span style=\"color: #333300;\">Procfile<\/span><\/em>: It would\u00a0let\u00a0Heroku know from where it needs to pick a big fat jar of the project and what command, it needs to execute to run project.<\/p>\n<pre>web: java -jar -Dport=$PORT build\/libs\/project_name-all.jar<\/pre>\n<p><strong style=\"font-size: 20px;\">Edit build.gradle:\u00a0<\/strong>we would need to add a dependency \u00a0in buildscript for buildingfat jar<\/p>\n<pre>buildscript {\r\n    repositories {\r\n        jcenter()\r\n    }\r\n    dependencies {\r\n        classpath \"io.ratpack:ratpack-gradle:0.9.15\"\r\n        classpath \"com.github.jengelman.gradle.plugins:shadow:1.2.1\"\r\n    }\r\n}\r\n\r\n<\/pre>\n<pre>apply plugin: \"io.ratpack.ratpack-groovy\"\r\napply plugin: \"com.github.johnrengelman.shadow\"<\/pre>\n<p>and closure of Task <em>stage<\/em>\u00a0:<\/p>\n<pre>task stage {\r\n    dependsOn shadowJar\r\n}<\/pre>\n<p>This above code will help in generating big fat jar of ratpack application with name project_name-all.jar when Heroku would run &#8220;gradle stage&#8221; task for building the code.<\/p>\n<p>&nbsp;<\/p>\n<p>Just That&#8217;s it&#8230;<br \/>\nNow! We are ready to commit our code to Heroku and deployment done \ud83d\ude42<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Recently, I was working on a micro-service using Ratpack framework. \u00a0I wanted to deploy it to Heroku. I had tried to find good documentation for deploying on Heroku but couldn&#8217;t find as such.\u00a0After much trial and error, I finally managed to get a working configuration for successful deployment. As Heroku has very good support for [&hellip;]<\/p>\n","protected":false},"author":40,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"iawp_total_views":1},"categories":[1],"tags":[1511,1224,1512],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts\/19834"}],"collection":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/users\/40"}],"replies":[{"embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/comments?post=19834"}],"version-history":[{"count":0,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts\/19834\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/media?parent=19834"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/categories?post=19834"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/tags?post=19834"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}