Home > Uncategorized > Continuous deployment Grails Apps with Cloudbees Jenkins GitHub

Continuous deployment Grails Apps with Cloudbees Jenkins GitHub

After deploying Grails Apps to Amazon Beanstalk, it’s now time to look at CloudBees. At the moment CloudBees offers the only Platform as a Service (PaaS) that spans the complete develop-to-deploy lifecycle of Java web applications in the cloud; without any servers, any virtual machines or any IT staff. See the Cloudbees website for more info. For a random Grails App named ‘KnowledgeMatch’ we follow some simple steps:

  • Sign up to CloudBees (RUN@Cloud is free and there is a free plan for DEV@Cloud) (this step is not described in this post)
  • Install and configure Jenkins plugins (DEV@Cloud)
  • Configure a new Jenkins job (DEV@Cloud)
  • We make a change to our source code repo in GitHub and see if it all works
From the Jenkins Dashboard go to Manage Jenkins > Manage Plugins and install the ‘Cloudbees Deployer Plugin’ and the ‘Hudson Grails plugin’ and restart Jenkins. Check if the plugins are installed.

Go to Manage Jenkins > Configure System. At the CloudBees area fill in your API- and Secret Key. Just click the question mark and copy and paste those fields.

Now its time to configure a new Jenkins job. Choose a JDK version. In the source code management area choose for the ‘Git’option.  Copy the Publickey and goto to you Github  > Account settings and make a new SSH Public Key and call it for example ‘CloudBees’.

At the build triggers area. Choose for ‘Poll SCM’ and fill in ‘* * * * * ‘ which mean every minute. You can change this to every poll schedule you need. See question mark for examples.

In the build area press the button ‘Add build step’ and choose ‘Build With Grails‘. Now fill in the grails version (in our case 1.3.6) and type in the target field your grails command: clean “war target/knowledgematch.war“. Also I checked the field ‘force upgrade’

And finnaly in the post-build action area. We fill in:

Archive the artifacts : target/knowledgematch.war

Email notification: malderhout@gmail.com

Cloudbees Deployment

  • Cloudbees Site : maikel
  • Application ID: maikel/knowledgematch
  • Filename Pattern: target/knowledgematch.war

In GitHub we change the domain class kandidaat.groovy. This domain class has a default controller wit scaffolding implemented.

class Kandidaat
 String Name
 String Adres
 Date BirthDate

 static constraints = {}

Now lets look at the DEV@Cloud / Jenkins Dashboard if the job is starting.

Yes, the job is start the building proces.

Now we look at RUN@Cloud if the WAR file is deployed.

Yes the WAR file is deployed. Lets look at http://knowledgematch.maikel.cloudbees.net/kandidaat/create if the Grails App is available.

Yess!!!

Conclusion

CloudBees use the underlying Amazon platform. Tomcat is used as Java container and MySQL is used as database. There is direct access with local MySQL tools to restore data.

CloudBees RUN@Cloud is a serious alternative to Amazon Elastic Beanstalk and RDS. Cloudbees is cheaper and is easier to use. The combination DEV@Cloud and RUN@Cloud is a really good platform to automate the (Agile) software development proces.

About these ads
  1. December 2, 2011 at 18:04

    First of all, thanks a lot for this tutorial, it’s exactly what I needed. Now I configured my job, I committed a small change to github and a new build was triggered but it seems to be stuck on :

    Started by an SCM change
    Building remotely on s-0f93eaff
    Checkout:cotrying / /scratch/hudson/workspace/cotrying – hudson.remoting.Channel@7c8e3f75:s-0f93eaff
    Using strategy: Default
    Checkout:cotrying / /scratch/hudson/workspace/cotrying – hudson.remoting.LocalChannel@166e555
    Cloning the remote Git repository
    Cloning repository origin

    Is it normal that it is so slow the first time? Should I wait more or is there a possible problem?

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

%d bloggers like this: