Monday, April 27, 2009

Getting started with Grails 1.1.1-SNAPSHOT on Google App Engine/J

Official Grails support for Google App Engine/J is coming with Grails 1.1.1 that is set to be released this week according to a recent Twitter post from Grails project lead Graeme Rocher.

I'm really looking forward to this release - the combination of Grails (high productivity) and GAE/J (high scalability) is a very nice match.

If you're eager to get going before the official Grails 1.1.1 release - follow this small guide to build Grails 1.1.1-SNAPSHOT from source and deploy your first Grails GAE/J application.

# Step 1: Fetch and build Grails 1.1.1-SNAPSHOT
cd
mkdir grails-1.1.1-build
cd grails-1.1.1-build
git clone git://github.com/grails/grails.git
cd grails/grails
export ANT_OPTS="-Xmx512m"
ant jar
export GRAILS_HOME="$(pwd)"
export PATH="${GRAILS_HOME}/bin:${PATH}"
grails
# Version string should show "Grails 1.1.1-SNAPSHOT"

# Step 2: Create Grails-GAE/J application
grails create-app gaetest
cd gaetest
grails uninstall-plugin hibernate
emacs grails-app/conf/BuildConfig.groovy
# Add: google.appengine.sdk="/path/to/appengine-java-sdk-1.2.0"
grails install-plugin app-engine
# Fix a bug in the app-engine plugin.
emacs ~/.grails/1.1.1-SNAPSHOT/projects/gaetest/plugins/app-engine-0.5/scripts/_Events.groovy
# Add <sessions-enabled>true</sessions-enabled> after <version>${appVersion}</version>
grails install-templates
emacs src/templates/war/web.xml
# Remove the <welcome-file-list> definition
grails app-engine run
# Now browse to http://localhost:8080/

# Step 3: Deploy Grails-GAE/J application
grails set-version 1
emacs grails-app/conf/Config.groovy
# Add: google.appengine.application="app-id"
grails app-engine deploy
# The app should now be deployed at http://app-id.appspot.com/

0 comments:

Post a Comment