Friday, March 15, 2013

Deploying a gails app with the cloud-foundry plug-in

I recently discovered that CloudFoundry accounts are free (at least for now) and this offers a perfect opportunity to install a demo instance of grails applications. As with most things in grails, this is pretty straight-forward if you forget about the one or two issues you need to solve beforehand. I basically followed Burt Beckwith's excellent guide here: http://blog.springsource.org/2011/04/12/one-step-deployment-with-grails-and-cloud-foundry/ There were only two things giving me a headache. One issue was that the application did not get enough memory (PermGen of course). This was solved easily by reading the documentation of the plug-in:
//increase memory size to 1G (2G is max), don't start immediately since we need to change JAVA_OPTS
grails cf-push --memory=1G --no-start
grails cf-env-add JAVA_OPTS "-Xmx1024m -XX:MaxPermSize=512m -XX:+CMSClassUnloadingEnabled"
grails cf-start
The second issue became apparent from the exception: liquibase.exception.ServiceNotFoundException: Could not find implementation of liquibase.logging.Logger Thinking about this for a second I remembered that Liquibase was used by the database migration plug-in. I just removed it from the runtime in BuildConfig.groovy and tadah everything was running fine! I also raised a jira for this: http://jira.grails.org/browse/GPCLOUDFOUNDRY-52