.




.




             Ruby Cloud Platform
               Service: 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 q u i r e ' http '
             r e q u i r e ' reverse_proxy '

             use Rack : : ReverseProxy do
               # Forward the path /* to h t t p s : / / a p i . t w i t t e r . com/*
               r e v e r s e _ p r o x y '/ s e a r c h ' , ' h t t p : / / s e a r c h . t w i t t e r . com/ s e a r c h '
               r e v e r s e _ p r o x y ' / ' , ' h t t p s : / / a p i . t w i t t e r . com/ '
             end

             app = proc do | env |
               [ 200 , { ' Content−Type ' = ' t e x t / p l a i n ' } , "b" ]
                                           >
             end

             run app
             .
             Just released twiap as open source!


    .                                                                             .
    @yinhm                                                        Ruby PaaS: Heroku                                            13/18
.




             Example: deploy
.




             $ g i t c l o n e h t t p : / / g i t h u b . com/yinhm/ twiap

             $cd twiap

             $heroku c r e a t e
             C r e a t i n g glowing−water − 3 4 . . . done
             Created h t t p : / / glowing−water −34. heroku . com/ | g i t @ h e r o k u . com : glowing−water −34. g i t
             G i t 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 A E using the beamer class, TeX Live and Emacs.
                                L X
                                 T


                     Published under the Creative Commons Attribution 3.0 License
                           http://creativecommons.org/licenses/by/3.0/

                                             by @yinhm
                                     http://yinhm.appspot.com


                                   Document version June 7, 2010




    .                                            .
    @yinhm                       Ruby PaaS: Heroku                                  18/18

Heroku

  • 1.
    . . Ruby Cloud Platform Service: Heroku @yinhm June 7, 2010 . . @yinhm Ruby PaaS: Heroku 1/18
  • 2.
    . Ruby Platform as a Service . • Heroku • EngineYard • Google App Engine (via JRuby) . . @yinhm Ruby PaaS: Heroku 2/18
  • 3.
    . . . . @yinhm Ruby PaaS: Heroku 3/18
  • 4.
    . App . You App Runs on Heroku . . @yinhm Ruby PaaS: Heroku 4/18
  • 5.
    . Deploy . put git workflow, just git push . . @yinhm Ruby PaaS: Heroku 5/18
  • 6.
    . 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
  • 7.
    . Architecture . . . @yinhm Ruby PaaS: Heroku 7/18
  • 8.
    . 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
  • 9.
    . Addons . • Custom domain • Gem management • DB import/export • Cron • Background job • Backup: Bundles • MySQL: Amazon RDS • SSL • more... . . @yinhm Ruby PaaS: Heroku 9/18
  • 10.
    . Cutting edge tech . • MongoDB • Node, private beta . . @yinhm Ruby PaaS: Heroku 10/18
  • 11.
    . 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
  • 12.
    . 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
  • 13.
    . Example App . . Twitter API Proxy .. r e q u i r e ' http ' r e q u i r e ' reverse_proxy ' use Rack : : ReverseProxy do # Forward the path /* to h t t p s : / / a p i . t w i t t e r . com/* r e v e r s e _ p r o x y '/ s e a r c h ' , ' h t t p : / / s e a r c h . t w i t t e r . com/ s e a r c h ' r e v e r s e _ p r o x y ' / ' , ' h t t p s : / / a p i . t w i t t e r . com/ ' end app = proc do | env | [ 200 , { ' Content−Type ' = ' t e x t / p l a i n ' } , "b" ] > end run app . Just released twiap as open source! . . @yinhm Ruby PaaS: Heroku 13/18
  • 14.
    . Example: deploy . $ g i t c l o n e h t t p : / / g i t h u b . com/yinhm/ twiap $cd twiap $heroku c r e a t e C r e a t i n g glowing−water − 3 4 . . . done Created h t t p : / / glowing−water −34. heroku . com/ | g i t @ h e r o k u . com : glowing−water −34. g i t G i t remote heroku added $ g i t push heroku master $heroku open . . @yinhm Ruby PaaS: Heroku 14/18
  • 15.
    . 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
  • 16.
    . 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
  • 17.
    . 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
  • 18.
    . About . Created in A E using the beamer class, TeX Live and Emacs. L X T Published under the Creative Commons Attribution 3.0 License http://creativecommons.org/licenses/by/3.0/ by @yinhm http://yinhm.appspot.com Document version June 7, 2010 . . @yinhm Ruby PaaS: Heroku 18/18