Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Deploying a JHipster Application to Heroku

Has anyone had luck deploying a JHipster application to Heroku? I think a custom buildpack is required, but I'm not 100% sure, as I'm new to Heroku.

like image 805
Jeremiah Atwood Avatar asked Mar 26 '14 05:03

Jeremiah Atwood


People also ask

How do I deploy an existing app to Heroku?

To deploy your app to Heroku, use the git push command to push the code from your local repository's main branch to your heroku remote. For example: $ git push heroku main Initializing repository, done.

Can I host a Java application on Heroku?

You can deploy any Java application on Heroku. It is not limited to JEE or other frameworks. You can deploy Java web applications packaged as WAR files using WAR deployment or you can deploy Maven based Java projects of any kind using the git versioning system.

How do I deploy Microservices to Heroku?

You create a Heroku app for each project (each Git repo). You then push your code from each Git repo to their respective Heroku app. Heroku assigns you a public URL for each app you have. If each of your services is now running on Heroku, they can send API requests to each other over public HTTPs.


2 Answers

I have started an Heroku sub-generator for JHipster, using your comments:

https://github.com/jhipster/generator-jhipster/tree/master/heroku

I already have it working, I just need some tuning before it becomes official.

Concerning memory and boot timeout issues, I got both working OK.

like image 52
Julien Dubois Avatar answered Oct 23 '22 10:10

Julien Dubois


I ran into two problems when trying to deploy to Heroku.

First problem, Heroku detects my application as Node.js since the package.json file is located in the root. Okay, easy fix as you just create a .slugignore file and ignore the package.json. Now it recognized the pom.xml and builds.

Second problem, the slug size of the default jhipster is about 340mb. The 'slug' is basically the size of all dependencies pulled in as your application builds. Max slug size allowed by Heroku is 300MB. Rather then try to sort through dependencies and strip away functionality I switched to using Amazon Elastic Beanstalk. Rather then building on Amazon's servers you deploy the compressed .war file to a Tomcat env and this works fine.

I'd be interested to know if anybody has more luck than me with Heroku, but though I'd share what I found.

Update

I successfully deployed the stock jhipster app to a t1.micro (smallest) instance on Elastic Beanstalk while connecting to a Amazon RDS PostgreSQL data source. This instance qualifies for the free tier (1 year) and gives you 1GB memory. The only config change I had to make was pump up the JVM Heap + PermGen space to 512MB and 128MB respectively. It was as easy as running "mvn package -Pprod" and then taking the app_name.war.original (the one without tomcat embedded) and deploying that to the instance Tomcat server.

Here are the JVM stats from the UI when running at pretty much no load: enter image description here

like image 27
cmikeb1 Avatar answered Oct 23 '22 09:10

cmikeb1