Thursday, August 6, 2009

Google App Engine

An Early Look at Java™ Language Support
App Engine recently unveiled its second language: Java. This release includes an early look at our Java runtime, integration with Google Web Toolkit, and a Google Plugin for Eclipse, giving you an end-to-end Java solution for AJAX web applications. Our support for the Java language is still under development and we're eager to get your help and input. The Java runtime is now available for anyone to use, so please give it a try and send us your feedback. Getting started
Here’s how to get rolling:
  1. Install the gems
    $ sudo gem install google-appengine
  2. Assign an app identifier

    Simply create an application at appspot.com,
    we'll refer to that as my-app in this document.

  3. Generate your rails app
    $ rails my-app; cd my-app;
  4. Generate a rackup file

    In the same folder, save this as config.ru.

    require 'appengine-rack'
    AppEngine::Rack.configure_app(
    :application => 'my-app',
    :version => 1 )

    ENV['RAILS_ENV'] = AppEngine::Rack.environment
    require 'config/environment'
    run ActionController::Dispatcher.new
  5. Check gem sources for datamapper
    $ gem sources

    Only when missing, add it like this...
    $ sudo gem source -a http://gems.datamapper.org

  6. Install gems into your app
    $ appcfg.rb gem install rails dm-appengine
  7. Modify the Rails Initializer

    Add the following to your config/environment.rb.

    # Set DataMapper to use dm-appengine adapter
    require 'dm-core'
    DataMapper.setup(:default, "appengine://auto")

    # Set Logger from appengine-apis, all environments
    require 'appengine-apis/logger'
    config.logger = AppEngine::Logger.new

    # Skip frameworks you're not going to use.
    config.frameworks -= [ :active_record ]
  8. Run your app locally
    $ dev_appserver.rb .
  9. Open up the console
    $ appcfg.rb run -S irb
    > require 'config/environment'
  10. Deploy to App Engine
    $ appcfg.rb update .
http://code.google.com/appengine/
http://rails-primer.appspot.com/

No comments: