deploying grails to morph appspace communityone 2009 lightning talk

Published:
Welcome to the dim corner of the library, where fools rush in and angels fear to tread!

This blog post is ancient. If it is technical, the information is likely inaccurate, or at least out of date. If it is non-technical, it’s entirely possible that the relevant facts and my own opinions have changed significantly since it was written.

It is only preserved as part of this site’s permanent historical archive.

I gave two lightning talks at CommunityOne today, the first of which described deploying Grails applications to Morph AppSpace.

For the uninitiated, Grails is a Ruby on Rails inspired full stack web development framework which brings “convention over configuration” and “DRY” into the Java web development arena. Unlike Rails, it is not an effort from scratch, but rather stands on the shoulders of proven giants in the Java world like the Spring framework and Hibernate. It does this using Groovy, the popular dynamic scripting language for the JVM, as a sort of “DSL for web development.” Find it at http://grails.org.

Morph AppSpace on the other hand is a fully-configured and managed environment for hosting web applications, and currently supports Java, Grails, Rails, and PHP applications. It is a “platform as a service” (PaaS) provider that abstracts away the details of Amazon EC2 and S3 technologies. Systems architecture, backups, monitoring, failover, scalability - all of this is handled by Morph. You simply develop and deploy your application - Morph does the rest. Find it at http://mor.ph/products_appspace.

So to get going, visit http://mor.ph and sign up for a free developer account. Create yourself a Java application subscription, and pick your choice of database (MySQL or PostgreSQL). Create the database, and then download two very important files into the root directory of your Grails project: deployment.properties, which contains the metadata describing your application to the Morph AppSpace platform, and morph_deployer.jar, which contains the client API to the platform.

Next you’ll need to install the Grails morph-deploy plugin. If you’re using Grails 1.1, you’ll need to checkout the trunk version from SVN, as the version in the plugin repository is not 1.1 ready. Install this plugin locally by running “grails install-plugin $PATH_TO_PLUGIN.” Next, you’ll need to edit DataSource.groovy to contain the following:

production {
        dataSource {
            driverClassName = 'com.mysql.jdbc.Driver'
            dbCreate = "update"
            jndiName = "java:comp/env/jdbc/morph-ds"
            dialect = 'org.hibernate.dialect.MySQLDialect'
        }
}

Finally, run “grails war” to build the war file, and “grails deploy” to upload your application to the platform. Once the upload is complete, visit the management interface and check the logs to see that you’ve successfully deployed. Once it’s finished, click on the link to your application. Happy Grails on the cloud!

Here’s the screencast from my talk. Enjoy!

[youtube=http://www.youtube.com/watch?v=JYPJ26-1YTM&hl;=en&fs;=1&border;=1]