Click here to load reader
Upload
yinhm-
View
3.321
Download
2
Embed Size (px)
Citation preview
.
.
.
Ruby Cloud PlatformService: Heroku
@yinhm
June 7, 2010
..@yinhm Ruby PaaS: Heroku 1/18
.
.
.
Ruby Platform as a Service
• Heroku• EngineYard• Google App Engine (via JRuby)
..@yinhm Ruby PaaS: Heroku 2/18
.
.
.
..@yinhm Ruby PaaS: Heroku 3/18
.
.
.
App
You App Runs on Heroku
..@yinhm Ruby PaaS: Heroku 4/18
.
.
.
Deploy
put git workflow, just git push
..@yinhm Ruby PaaS: Heroku 5/18
.
.
.
All through API
$sudo gem install heroku$heroku create sushi # create
$git push heroku master # deploy
$heroku domains:add sushi.com$heroku rake db:migrate$heroku db:push$heroku addons:add memcached
..@yinhm Ruby PaaS: Heroku 6/18
.
.
.
Architecture
..@yinhm Ruby PaaS: Heroku 7/18
.
.
.
Architecture
• HTTP: nginx• Http Cache: Varnish• Routing Mash: (custom written, Erlang)• Dyno Grid: code compiled to Slug then deploy cross
services, 1dyno = 1Mongrel• DB: PostgreSQL• Memcached
..@yinhm Ruby PaaS: Heroku 8/18
.
.
.
Addons
• Custom domain• Gem management• DB import/export• Cron• Background job• Backup: Bundles• MySQL: Amazon RDS• SSL• more...
..@yinhm Ruby PaaS: Heroku 9/18
.
.
.
Cutting edge tech
• MongoDB• Node, private beta
..@yinhm Ruby PaaS: Heroku 10/18
.
.
.
Supported Frameworks
• Rails 2.3.x, Rails 3• supports Rack• Rack-based: Sinatra, Merb, Ramaze, and Camping• ActiveRecord, DataMapper or Sequel
..@yinhm Ruby PaaS: Heroku 11/18
.
.
.
Create App on Heroku
before create, you need:• git• sign up on heroku website• public key placed in /.ssh/
..@yinhm Ruby PaaS: Heroku 12/18
.
.
.
Example App.Twitter API Proxy..
.
r e qu i r e ' http 'r e qu i r e ' reverse_proxy '
use Rack : : ReverseProxy do# Forward the path /* to https :// ap i . tw i t t e r . com/*reverse_proxy '/ search ' , ' http :// search . tw i t t e r . com/search 'reverse_proxy '/ ' , ' ht tps :// ap i . tw i t t e r . com/ '
end
app = proc do | env |[ 200 , { ' Content−Type ' => ' tex t / p la in ' } , "b" ]
end
run app
Just released twiap as open source!
..@yinhm Ruby PaaS: Heroku 13/18
.
.
.
Example: deploy
$g i t c lone http :// github . com/yinhm/twiap
$cd twiap
$heroku c rea teCreat ing glowing−water −34. . . doneCreated http :// glowing−water−34.heroku . com/ | git@heroku . com: glowing−water−34. g i tGit remote heroku added
$g i t push heroku master$heroku open
..@yinhm Ruby PaaS: Heroku 14/18
.
.
.
Pros
• No lock in, Heroku based on open-source mostly• Dead simple deployment• Easy scaling• 1 dynos for free!• Custom domain for free
..@yinhm Ruby PaaS: Heroku 15/18
.
.
.
Crons
• 5M DB space limit• Need credit card to enable some free features• No public IP(could get blocked in china, you know the
risk)
..@yinhm Ruby PaaS: Heroku 16/18
.
.
.
References
• http://heroku.com, Heroku• http://engineyard.com, EngineYard• http://code.google.com/appengine/, Google App
Engine• http://code.google.com/p/appengine-jruby/,
JRuby• http://github.com/yinhm/twiap, Twiap
..@yinhm Ruby PaaS: Heroku 17/18
.
.
.
About
Created in LATEX using the beamer class, TeX Live and Emacs.
Published under the Creative Commons Attribution 3.0 Licensehttp://creativecommons.org/licenses/by/3.0/
by @yinhmhttp://yinhm.appspot.com
Document version June 7, 2010
..@yinhm Ruby PaaS: Heroku 18/18