Deploying a Grails Application Using AppFog

Once your application is all tested and ready to go, you need to package it up and deploy it on a JVM application server. Hosting applications in the cloud is becoming more popular with platform services such as those offered by Amazon, Google, and others. One such free service that supports Grails is AppFog. AppFog’s free tier gives you 2 GB of RAM, and up to 8 provisioned services, such as MySQL. A basic Grails application takes about 500 MB of RAM, so if you are looking for a place to host some demos or your developer portfolio, AppFog is a great way to go. In this Grails Example screencast, you will learn how to package and deploy your application.

To deploy your application, you first need to package it into a Web Application Archive file, also called a WAR file. You do this with the Grails command:

grails war

This will use the production settings in your DataSource.groovy file. The easiest way to work with AppFog is through your terminal and the AppFog Ruby-based commands. If you are using OS X or Linux, your terminal already has Ruby set up. In Windows, you can download a Ruby command environment from On all three platforms, install the AppFog commands by running:

gem install af

Sign up for a free account on the AppFog website. Then from the yourapp/target directory where your .war file resides:

af login
af push

AppFog will ask you several questions about your app, upload it, and start it. They will provide a unique URL from which you can access your application from anywhere. Follow along with the screencast to see how to deploy your application in the cloud and show it off.

What is Groovy?

Why does Grails use Groovy for its core programming language? Why not just use Java? In this episode of Grails Example, we present a brief slide show that talks about the shortcomings of Java and why Grails needed a groovier language for building web applications.

Basic Security

In this Grails Example, we complete the ProjectTracker application by implementing basic security. Although this is not a comprehensive discussion on web application security, you learn how to create a login page that authenticates your users against the EndUser model, as well as how to add an interceptor method to your controllers that authorizes your end users before executing any additional methods in the controller. For a complete discussion on security, please see the information on the Spring Security Core Plugin.

Additional credit for content on this video comes from Scott Davis’ article: Mastering Grails: Authentication and Authorization.