Over a million developers have joined DZone.

Moving an existing Grails Application to Google Appengine

DZone 's Guide to

Moving an existing Grails Application to Google Appengine

· Java Zone ·
Free Resource

Recently I wanted to move a simple Grails application to Google App Engine(GAE). It was quite an effort to do that. This effort varies from application to application.  For a simple website which is more or less static its a breeze, there are grails plugins (http://grails.org/plugin/app-engine) available which helps us to migrate to google app engine. The main problem is the moving the underlying database schema to google app engine. This writeup discusses the kind of Grails applications that are suitable to be migrated to google app engine and there by discussing the problems/challenges that one may encounter.

What kind of Grails Applications are  easily migratable / Possible  constraints for existing applications ?

The apps in which the database schema is simple and where there is not much of data migration is required.

When migrating Grails app to GAE, We most often end up choosing JPA.

The migraion of existing relational data  to GAE Appstore is also not trivial. In my application there was a grails domain object which has 31,100 odd records in database. I tried to extract the data from mySql to a csv file and tried to read each record and save to datastore. This is a tame idea though. There was an CancellationException which was caused due to the request was taking more than 30 seconds. GAE also doesnot allow creation of threads by. I figured that there is a bulkloader tool provided by app engine which is in python. This can do the trick. But its not that straight forward. GAE can improve on this and can simplify tooling for bulk loading for all laguages that it supports.

Existing job framework could be rework

If your Grails app used Quartz plugin to  execute some Jobs then during migration to GAE it should be replaced by the GAE job engine. This is a rework as GAE doesnt allow creation of threads by the app. We ought to use the GAE job only.

Conclusion :

A simple grails application can be easily be migrated to app engine with lesss efort. If database schema is complex there will be problems refactoring the existing controller code.



Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}