jruby on google app engine

May 05, 2010

app engine logoJohn Woodell (@johnwoodell) gave an excellent talk at the App Engine Meetup this evening on using Ruby on Google’s AppEngine. After some highlights of App Engine and a tour of three real-world use cases, John gave a series of quick demos of what seem to be very well-documented resources for getting started. I built the simple “hello” Sinatra app during his talk which was pretty satisfying. I was distracted by my success with the first app, so I missed some of his Rails presentation, but it looks like the docs go through what he demo’d.

Overview

Key Features

Gotchas

Good things to know

Matthew Blain, the engineer for the main bulkloader tool, gave a short talk about it. Bulkloader lets you put data into the AppEngine data store. You can use it to import data or to move from one AppEngine app to another. It currently supports limited input: csv and simple xml. It also supports “simple text” for output. You can write any connector you want.

Some real world references to people using Ruby on App Engine:

Very nice getting started guide, which I followed to build a Sinatra app in about 5 minutes.

sudo gem install google-appengine
appcfg.rb generate_app hello
dev_appserver.rb hello

After this I had an app running locally at http://localhost:8080/ — I find it unsettling to hear that the dev app is running on whatever Ruby I have, but when I deploy it is JRuby. John reassures me that the only real glitch that I’ll run into is if I have a gem with native code, for which there aren’t also java extensions (or an alternate pure Ruby implementation).

Installation notes: hasn’t been tested with rvm, the env is there, so you don’t need it. gems are stored in a jar file, kept in .gems/bundler_gems in your app directory

Then to deploy my app on App Engine, I needed to use my Google account to register an app. I picked the name “hello-sarah” which I then added to my config.ru. I also added a little snippet of Ruby code to the Rack app to report the current time, so I could tell it was mine.

Then I typed some magic words into my local command line:

cd hello/
appcfg.rb update .

Then my app was live at: http://hello-sarah.appspot.com/

Since I tweeted it, I got a chance to see how the application dashboard works. Here’s what it looks like for this app which was first deployed a few hours ago:
dashboard