Thursday, May 10, 2012

Specifying memory constraints for grails application on cloudfoundry

If you have tried to use the Cloudfoundry plugin to deploy a grails application to Cloudfoundry.com you would use the following command:

grails prod cf-push

After answering yes to all the questions you might see a deployment error due to memory constraints. And a request to delete the application

Should I delete the Application?

You should answer no, leaving the application that failed to start still on cloudfoundry. Then specify environment variables to stipulate memory constraints like so:

grails cf-env-add JAVA_OPTS "-XX:MaxPermSize=256m -XX:+CMSClassUnloadingEnabled"

Cloudfoundry will automatically attempt to restart the application after the addition of the environmental variable. That should be it! Your grails app should be live on Cloudfoundry!

If you want to see what variables are registered for your application just run

grails cf-env

Note: you can also update the allocated memory of your application. Just use the following vmc command:

vmc mem $appName

No comments:

Post a Comment