Reputation: 153
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.
Upvotes: 11
Views: 3628
Reputation: 31
I have deployed an app to Heroku sucessfully (https://smallgis.herokuapp.com/#/login), you should create an app in Heroku and install the mlab add on (mongodb in my case), you should always mantain the slug size less of 300 MB. Link your project to the heroku app that you had created.
heroku login
Create a new Git repository
Initialize a git repository in a new or existing directory
Deploy your app
Upvotes: 0
Reputation: 1064
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:
Upvotes: 5
Reputation: 3688
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.
Upvotes: 6
Reputation: 2160
The two problems that @CMikeB1 mentioned can be solved by using a custom buildpack. There is a fork that joins java and node: https://github.com/lordviktor/heroku-buildpack-java-node-yeoman-submodule. I have forked this to remove the .m2 directory and reduce de slug size https://github.com/jbaris/heroku-buildpack-java-node-yeoman-submodule.
Buuut, there are two new problems:
Error R14 (Memory quota exceeded): the free account has 512 MB of RAM: this causes dynos swapping and loss performance. Consider the default JHipster app requires about 800 MB of RAM.
Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch: if the app cant get up within 60 seconds of launch, its considered crashed.
Note that the first problem affects the second. My (current) conclusion: Heroku free account is not compatible with JHipster :S
I will try Amazon Elastic Beanstalk. Did you recommend another alternative?
Upvotes: 3