18

Click here to load reader

Heroku

  • Upload
    yinhm-

  • View
    3.321

  • Download
    2

Embed Size (px)

Citation preview

Page 1: Heroku

.

.

.

Ruby Cloud PlatformService: Heroku

@yinhm

June 7, 2010

..@yinhm Ruby PaaS: Heroku 1/18

Page 2: Heroku

.

.

.

Ruby Platform as a Service

• Heroku• EngineYard• Google App Engine (via JRuby)

..@yinhm Ruby PaaS: Heroku 2/18

Page 3: Heroku

.

.

.

..@yinhm Ruby PaaS: Heroku 3/18

Page 4: Heroku

.

.

.

App

You App Runs on Heroku

..@yinhm Ruby PaaS: Heroku 4/18

Page 5: Heroku

.

.

.

Deploy

put git workflow, just git push

..@yinhm Ruby PaaS: Heroku 5/18

Page 6: Heroku

.

.

.

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

Page 7: Heroku

.

.

.

Architecture

..@yinhm Ruby PaaS: Heroku 7/18

Page 8: Heroku

.

.

.

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

Page 9: Heroku

.

.

.

Addons

• Custom domain• Gem management• DB import/export• Cron• Background job• Backup: Bundles• MySQL: Amazon RDS• SSL• more...

..@yinhm Ruby PaaS: Heroku 9/18

Page 10: Heroku

.

.

.

Cutting edge tech

• MongoDB• Node, private beta

..@yinhm Ruby PaaS: Heroku 10/18

Page 11: Heroku

.

.

.

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

Page 12: Heroku

.

.

.

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

Page 13: Heroku

.

.

.

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

Page 14: Heroku

.

.

.

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

Page 15: Heroku

.

.

.

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

Page 16: Heroku

.

.

.

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

Page 17: Heroku

.

.

.

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

Page 18: Heroku

.

.

.

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