Want to write a Google App Engine app using Sinatra and JRuby? There are a few good places to go for how to do it:
- Running Sinatra apps on Google App Engine (Java)
- Writing Sinatra apps for Google App Engine, the productive way
- App Engine Java Overview
... and I'm sure there will be more. I've read the links above and have basically created a base app you can use to start your own. I'm not planning on maintaining this beyond what's here. If you like it use it and fork it, otherwise, move on.
For this to work, you'll need the the Google App Engine SDK for Java and also JRuby 1.3.0+. Once you have JRuby installed, you'll also need to install the warbler gem:
jruby -S gem install warbler
After you've downloaded those, clone this repository on your local:
git clone [email protected]:manalang/sinatra-on-gae-template.git
Create your Sinatra app in app/WEB-INF/app.rb. When you're ready, package it up using warbler:
jruby -S warble
This will update the tmp/war directory in your app. After that's done, you can test it by running:
appengine-java-sdk-XXX/bin/dev_appserver.sh app
This will run the local GAE server. This is probably not the most convenient way to test. You might want to test under MRI instead. When you're ready to deploy, you'll first need to update your app/WEB-XML/appengine-web.xml by replacing YOUR-APPLICATION-ID and also change the :environment in config.ru, then deploy by running:
appengine-java-sdk-XXX/bin/appcfg.sh update app
Make sure you've signed up for a Google App Engine account before you do this.