John 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.
- No need to install or maintain your own stack
- “We do the scaling for you” -> Google services via standard APIs
- Charge only for actual usage – Always free to get started
- Built-in application management console (pretty sweet)
- no native code
- no sockets or thread
- no writing to the files system
- 30 seconds to do your work, then the request times out (issues with initialization in Rails, but they’ve developed a “deferred dispatch” workaround)
- takes several seconds to “spin up” a new JRuby instance when your app first starts or your load spikes
Good things to know
- AppEngine datastore has no schema.
- Reads are always the same speed no matter how big your data store, writes are slower
- You use DataMapper rather than ActiveRecord.
- memcache API is available
- URL Fetch API is a drop-in replacement for Net::HTTP
- as of today, there will be a release where openssl “just works” for the first time
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:
- real world app using JRuby, Rails and App Engine (azazeal)
- iPhone / iPad app with JSON interface: blog post and gist by John Wang
[update from John Woodell’s comment]
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: