rahulserver
rahulserver

Reputation: 11205

Automated deployment of Grails/Java web application to Tomcat7 from Git

I saw automated deployment of heroku as in this link. And it was amazing as it allowed me to deploy the grails web application directly from git repository to tomcat.

Now I was wondering that can I use a similar thing to deploy my grails web application directly from my VCS(Git) to tomcat 7 if I am using other hosting provider (or to my personal dedicated server).

In other words, I want to setup automated loop for my grails web application. And preferable is there a generic way for any other java web application built using web frameworks like spring/strutts etc.

Upvotes: 3

Views: 414

Answers (1)

ron
ron

Reputation: 183

Short answer: Yes you can. But you'll need to do it manually.

Heroku uses the concept of post-receive hooks and buildpacks which automatically deploy the application when code is pushed to the master branch of your version control. In case of GitHub, you can use their webhooks to configure post-receive hooks that can automatically create a WAR file and deploy automatically to your QA or production server, for example.

You can follow GitHub's guide to setting up your first webhook (https://developer.github.com/webhooks/creating/). Basically, whenever you push data to a GitHub repo, it will send the data to a URL of your choice (also known as a webhook). You can have a listener running on this address which will process the data and run a custom script which in your case will deploy your Java application. They are using a Ruby file but you can use any language you prefer, even a bash script.

You can also see a sample payload sent by GitHub https://gist.github.com/gjtorikian/5171861

The post-receive hook is a very common concept and is available in almost every version control system out there. For your own dedicated server or your own hosted version control, you'll need to implement this from the scratch.

Upvotes: 2

Related Questions