grails (11) vaadin (11) meteor (6) java (4) elasticsearch (3) apple (2) centos (1) cloudbees (1) google analytics (1) gradle (1) heroku (1) javafx (1) javascript (1) jdbc (1) jug (1) logback (1) logging (1) mac os (1) management (1) mongodb (1) mongolab (1) mysql (1) twitter (1) ubuntu (1)

Tuesday, July 24, 2012

Hints for Grails app running on Cloudbees

Here are my most used commands I use during development and deployment of Grails application which is running on Cloudbees.

Dependencies when changing BuildConfig 

  1. It happens quite usually - you add a new dependency to BuildConfig and it is not visible in your code. This helps to load it. I am also using --include-source option to get jars (because I might be wondering what code is behind).
    grails refresh-dependencies --include-source

Testing during development

  1. I am not using integration tests. The are two reasons why. First, it is possible to mock everything. Second, integration tests requires context and it is time consuming when starting it up. 
    dev test-app unit:
  2. I usually run only one specific unit test when developing a feature.
    dev test-app unit: UserServiceTests
  3. From time to time I need to have more applications running at the same time (e.g. when doing an integration between client application, admin application and some web services). 
    dev run-app -Dserver.port=8080

Validation before deploying war into the production

  1. At first, run all the tests. E.g. my web services written in Grails have 95% line coverage, applications about 80%. So I am quite confident when deploying it to production. 
  2. Simulate running the war on local machine. Running application by run-war might uncover some issues which could occur during deployment of war on cloud. It can happen that application is running well when it is started by run-app but it fails during deployment (which causes your production app is not available). 
  3. After the steps above are without problems then I make a production war file.
    prod war
  4. It is necessary to install CloudBees SDK so the applications can be deployed from command line. 
    bees app:deploy myapp.war -a myaccount/myapplication
  5. This is how to restart application from command line... it is quite handy. bees app:restart myaccount/myapplication