Ruby on Google App Engine: Upgrade to Google App "Turbo" Engine
1. Ruby on Google App Engine
Upgrade to Google App “Turbo” Engine
Joseph Ku (Chieh-Fang Ku)
chiehfang.ku@gmail.com
2. Outline
What’s Google App Be prepared
Engine?
What’s JRuby
Why Google App
Engine? Why Sinatra and why
not Rails?
Free quotas and
limits Hack! Hack! Hack!
Significant References
features
v1.2.0
Build 201105111230
3. Who am I?
Joseph Ku (Chieh-Fang Ku)(@josephku)
Male
Single, but not rich
A Linux user since 1996
Fed by embedded Linux and Android
Ruby lover and Guitar Hero rocker
4. Before we start...
Don’t take any notes. This slide will be
published with CC BY-NC-ND.
Don’t judge my look and shape. It’s cold, and
I need Calories.
Don’t play Angry Birds during my presentation
...including Angry Birds Seasons edition
5. Before we start...
You CAN interrupt me anytime.
You CAN take pictures anytime.
You CAN go to the toilet anytime.
6. What’s Google App Engine?
GAE (Google App Engine) lets you run your
web apps on Google's infrastructure.
Reliable PaaS (Platform as a Service)
Easy to use, maintain and scale
Almost free!
7. What’s Google App Engine?
GAE (Google App Engine) lets you run your
web apps on Google's infrastructure.
Typical PaaS (Platform as a Service)
Only supports Python and Java runtime
environments
Who did choose GAE?...
8. Why Google App Engine?
World-class infrastructure
Light-weight PaaS
Booming of Client-Side JavaScript
Obey its limitations
9. Free quotas and limits
Free Quotas (without 1 GB shared
enabling billing) Datastore/
Blobstore size
43,200,000
requests per day 6.5 CPU-hours per
day
45,200 requests
per minute 1 GB shared
bandwidth in/out
per day
11. Free quotas and limits
Limits
10 apps for 150 MB app code
developer account size
30 sec per request 1,000 deployments
10 MB HTTP 200 indexes
response size
12. Significant features
Schedule tasks Google account
integration
Schedule tasks -
Like Cron service URL fetch
Every minutes! Mail
Up to 20 tasks Memcache
Task queues - only Image manipulation
support Python
15. Create your own URL
shortener
I want this: http://mrku.co/j3Rs7k
Base 62 (0-9, a-z, A-Z)
Generated by O(1) algorithm
I want my service fast
I don’t wanna pay
I Ruby!
16. Why this happen?
You just said GAE could only support Python
and Java...
Mighty JVM
JRuby
DataMapper
appengine-jruby project (John Woodell)
17. Be Prepared
Java SE Development Kit (JDK)
Ruby
RubyGems
JRuby
(...Wh...Where is GAE?)
18. Be Prepared
Install all packages we need:
$ gem install google-appengine
(rack, jruby-rack, jruby-jars, appengine-rack, appengine-apis,
appengine-sdk, bundler08, rubyzip, appengine-tools, google-
appengine)
19. Be Prepared
Create a GAE app and test it:
$ appcfg.rb generate_app myapp
$ dev_appserver.rb myapp
Go and check http://localhost:8080/
22. Be prepared for the real
world
Java SE Development Kit (JDK) 6
Ruby 1.8.7-p330 or 1.8.7-p334
RubyGems 1.3.7
JRuby 1.5.6
23. Be prepared for the real
world
Suggestions:
Use “RVM” to deploy your Ruby
environment on Linux or Mac
Use “Pik” to deploy your Ruby environment
on Windows
24. Be prepared for the real
world
Install all packages we need:
$ gem install google-appengine
And do some tricks...
$ gem uninstall appengine-sdk
$ gem install appengine-sdk -v "1.4.0"
25. Be prepared for the real
world
Create a GAE app and test it:
$ appcfg.rb generate_app myapp
$ echo “gem 'jruby-rack', '< 1.0.6'” >> myapp/
Gemfile
$ dev_appserver.rb myapp
Go and check http://localhost:8080/
26. What’s JRuby
100% Java implementation of the Ruby
programming language
We could call Ruby MRI, “CRuby.”
Open source, Started in 2001
Always aiming for compatibility with current
Ruby version
Latest release: 1.6.1 (update to 2011.05.11)
27. Why Sinatra and why
not Rails
Sinatra is lighter than Rails
Sinatra’s CGI-friendly is more close to GAE
Tons of problems while trying to deploy a
Rails app to GAE
Big performance issues in Rails apps on GAE
Besides...
28. Why Sinatra and why
not Rails
There is Heroku!!
$ gem install heroku
$ heroku create myapp
$ git push heroku master
Go and check http://myapp.heroku.com
32. References
RVM: Ruby Version Manger
http://rvm.beginrescueend.com/
Pik: Ruby version manager for Windows
https://github.com/vertiginous/pik/
Sinatra
http://www.sinatrarb.com/