Deploying Vaadin on Heroku
Deploying Vaadin on Heroku
Learn how you can quickly deploy your Vaadin app for demo purposes by using Heroku Cloud with a free account in this tutorial.
Join the DZone community and get the full member experience.Join For Free
Read why times series is the fastest growing database category.
A big part of my time, I get busy creating Vaadin tutorials, and I always wish I could deploy them somewhere publicly for demo purposes. But that has not always been easy since I need a backend server ready for the Vaadin Framework. I also need to occasionally update the server whenever I make changes in my app.
If you are facing similar problems, that is you want to quickly deploy your Vaadin app for a showcase, proof of concept, or maintain a demo of your GitHub-hosted app; then I have some good news for you. There is a very easy solution offered by Heroku cloud, and after trying it now, I’m impressed how dead simple it is. Probably the most tedious task is to sign up for a free account, but then after that, all the steps are easy and straightforward. Here is what I’ve done:
Prepare the Project
Your project needs to be prepared for Heroku. Since we are talking about a demo and not a production app, we also will need some sort of application server runner to initiate the application server. I’ve used jetty-runner and placed some dependencies in the pom.xml file.
We will also need the so-called
Procfile to tell Heroku the nature of the app, and how to run it on its servers.
Create a Heroku App
You have a Heroku account, you have a Vaadin project ready, let’s mix them together. After logging into Heroku, click on “New,” then choose “Create new app” and give it a name:
Once the app has been created, you get redirected to the deploy section. Scroll a bit down and select the location of your source code. It would be ideal if it’s a Git repository for smooth continuous deployment. Here I’m using GitHub; search for the repo:
Then connect it:
And now automatic deployment comes handy. Every time you push something into the specified branch, it will get re-deployed on Heroku so your app will always be up to date:
If you can’t wait, and you want to test it out right away, or if you want manual deployment, then all you have to do is to scroll a bit more down and select the Git branch, then click on “Deploy Branch.”
That’s it! Once deployment is successful, you can open the app right away using the given subdomain under herokuapp.com.
JavaEE based applications won’t be that easy to deploy since jetty-runner is not enough. A container might be needed in this case.
Opinions expressed by DZone contributors are their own.