Wednesday, March 18, 2009
Wednesday, March 18, 2009
WTF?


Wednesday, March 18, 2009
Wednesday, March 18, 2009
Wednesday, March 18, 2009
Wednesday, March 18, 2009
‣     mkdir quotes




Wednesday, March 18, 2009
‣     mkdir quotes

     ‣     cd quotes




Wednesday, March 18, 2009
‣     mkdir quotes

     ‣     cd quotes

     ‣     git init




Wednesday, March 18, 2009
‣     mkdir quotes

     ‣     cd quotes

     ‣     git init

     ‣     mate app.rb




Wednesday, March 18, 2009
‣     mkdir quotes

     ‣     cd quotes

     ‣     git init

     ‣     mate app.rb

     ‣     echo quot;require 'app' ...
‣     mkdir quotes

     ‣     cd quotes

     ‣     git init

     ‣     mate app.rb

     ‣     echo quot;require 'app' ...
‣     mkdir quotes

     ‣     cd quotes

     ‣     git init

     ‣     mate app.rb

     ‣     echo quot;require 'app' ...
‣     mkdir quotes

     ‣     cd quotes

     ‣     git init

     ‣     mate app.rb

     ‣     echo quot;require 'app' ...
‣     mkdir quotes

     ‣     cd quotes

     ‣     git init

     ‣     mate app.rb

     ‣     echo quot;require 'app' ...
Wednesday, March 18, 2009
CONSTRAINTS
                               (good ones)




Wednesday, March 18, 2009
Wednesday, March 18, 2009
Rails (> 2.0.2) or a Rack-based app with a
    ★
                 config.ru




Wednesday, March 18, 2009
Rails (> 2.0.2) or a Rack-based app with a
    ★
                 config.ru

                 No shell access
    ★




Wed...
Rails (> 2.0.2) or a Rack-based app with a
    ★
                 config.ru

                 No shell access
    ★

      ...
Rails (> 2.0.2) or a Rack-based app with a
    ★
                 config.ru

                 No shell access
    ★

      ...
Rails (> 2.0.2) or a Rack-based app with a
    ★
                 config.ru

                 No shell access
    ★

      ...
Wednesday, March 18, 2009
Wednesday, March 18, 2009
get '/stylesheets/:sheet.css' do
                 content_type quot;text/cssquot;
                 file = root_path/'views...
Wednesday, March 18, 2009
get '/stylesheets/:sheet.css' do
                 content_type quot;text/cssquot;
                 file = root_path/'views...
get '/books/:book_slug/articles/*' do
       @book = Book.from_slug params[:book_slug]
       @article = @book.article_fro...
Wednesday, March 18, 2009
get '/books/:book_slug/articles/*' do
       @book = Book.from_slug params[:book_slug]
       @article = @book.article_fro...
gem install shotgun




Wednesday, March 18, 2009
# Have to require sinatra here and force the application name because polyglot
        # breaks the auto-detection logic.
...
Wednesday, March 18, 2009
KTHNXBAI




Wednesday, March 18, 2009
Upcoming SlideShare
Loading in …5
×

Heroku & Sinatra

3,372 views

Published on

Presented at RORO Sydney, March 19 2009.

Published in: Technology, Education
0 Comments
6 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
3,372
On SlideShare
0
From Embeds
0
Number of Embeds
43
Actions
Shares
0
Downloads
45
Comments
0
Likes
6
Embeds 0
No embeds

No notes for slide
  • Herko, who’s heard of it?
  • its this, actually I have no idea what this is
  • That thing is now a tool for learning rails. I haven’t used it and don’t really intend to.
  • So, the new heroku.











  • This makes porting existing apps tricker than you may imagine. For example plugins like paperclip require filesystem access (unless you’ve configured it to use S3). I recommend doing new stuff in Heroku.
  • This makes porting existing apps tricker than you may imagine. For example plugins like paperclip require filesystem access (unless you’ve configured it to use S3). I recommend doing new stuff in Heroku.
  • This makes porting existing apps tricker than you may imagine. For example plugins like paperclip require filesystem access (unless you’ve configured it to use S3). I recommend doing new stuff in Heroku.
  • This makes porting existing apps tricker than you may imagine. For example plugins like paperclip require filesystem access (unless you’ve configured it to use S3). I recommend doing new stuff in Heroku.
  • This makes porting existing apps tricker than you may imagine. For example plugins like paperclip require filesystem access (unless you’ve configured it to use S3). I recommend doing new stuff in Heroku.


  • The varnish reverse proxy that sits in front of heroku will cache this for you. It will also cache normal requests with the expires header.


  • reloader


  • Heroku & Sinatra

    1. 1. Wednesday, March 18, 2009
    2. 2. Wednesday, March 18, 2009
    3. 3. WTF? Wednesday, March 18, 2009
    4. 4. Wednesday, March 18, 2009
    5. 5. Wednesday, March 18, 2009
    6. 6. Wednesday, March 18, 2009
    7. 7. ‣ mkdir quotes Wednesday, March 18, 2009
    8. 8. ‣ mkdir quotes ‣ cd quotes Wednesday, March 18, 2009
    9. 9. ‣ mkdir quotes ‣ cd quotes ‣ git init Wednesday, March 18, 2009
    10. 10. ‣ mkdir quotes ‣ cd quotes ‣ git init ‣ mate app.rb Wednesday, March 18, 2009
    11. 11. ‣ mkdir quotes ‣ cd quotes ‣ git init ‣ mate app.rb ‣ echo quot;require 'app' ; run Sinatra::Applicationquot; > config.ru Wednesday, March 18, 2009
    12. 12. ‣ mkdir quotes ‣ cd quotes ‣ git init ‣ mate app.rb ‣ echo quot;require 'app' ; run Sinatra::Applicationquot; > config.ru ‣ git commit -a quot;version 1quot; Wednesday, March 18, 2009
    13. 13. ‣ mkdir quotes ‣ cd quotes ‣ git init ‣ mate app.rb ‣ echo quot;require 'app' ; run Sinatra::Applicationquot; > config.ru ‣ git commit -a quot;version 1quot; ‣ heroku create Wednesday, March 18, 2009
    14. 14. ‣ mkdir quotes ‣ cd quotes ‣ git init ‣ mate app.rb ‣ echo quot;require 'app' ; run Sinatra::Applicationquot; > config.ru ‣ git commit -a quot;version 1quot; ‣ heroku create ‣ git push heroku master Wednesday, March 18, 2009
    15. 15. ‣ mkdir quotes ‣ cd quotes ‣ git init ‣ mate app.rb ‣ echo quot;require 'app' ; run Sinatra::Applicationquot; > config.ru ‣ git commit -a quot;version 1quot; ‣ heroku create ‣ git push heroku master ‣ heroku open Wednesday, March 18, 2009
    16. 16. Wednesday, March 18, 2009
    17. 17. CONSTRAINTS (good ones) Wednesday, March 18, 2009
    18. 18. Wednesday, March 18, 2009
    19. 19. Rails (> 2.0.2) or a Rack-based app with a ★ config.ru Wednesday, March 18, 2009
    20. 20. Rails (> 2.0.2) or a Rack-based app with a ★ config.ru No shell access ★ Wednesday, March 18, 2009
    21. 21. Rails (> 2.0.2) or a Rack-based app with a ★ config.ru No shell access ★ Git only ★ Wednesday, March 18, 2009
    22. 22. Rails (> 2.0.2) or a Rack-based app with a ★ config.ru No shell access ★ Git only ★ Read only filesystem ★ Wednesday, March 18, 2009
    23. 23. Rails (> 2.0.2) or a Rack-based app with a ★ config.ru No shell access ★ Git only ★ Read only filesystem ★ PostgreSQL only ★ Wednesday, March 18, 2009
    24. 24. Wednesday, March 18, 2009
    25. 25. Wednesday, March 18, 2009
    26. 26. get '/stylesheets/:sheet.css' do content_type quot;text/cssquot; file = root_path/'views'/quot;#{params[:sheet]}.sassquot; last_modified file.mtime sass file.read, :sass => {:filename => file} end Wednesday, March 18, 2009
    27. 27. Wednesday, March 18, 2009
    28. 28. get '/stylesheets/:sheet.css' do content_type quot;text/cssquot; file = root_path/'views'/quot;#{params[:sheet]}.sassquot; last_modified file.mtime sass file.read, :sass => {:filename => file} end Wednesday, March 18, 2009
    29. 29. get '/books/:book_slug/articles/*' do @book = Book.from_slug params[:book_slug] @article = @book.article_from_slug params[:splat].to_s || not_found etag “#{@book.updated_at}-#{@article.updated_at}” haml :article end Wednesday, March 18, 2009
    30. 30. Wednesday, March 18, 2009
    31. 31. get '/books/:book_slug/articles/*' do @book = Book.from_slug params[:book_slug] @article = @book.article_from_slug params[:splat].to_s || not_found etag “#{@book.updated_at}-#{@article.updated_at}” haml :article end Wednesday, March 18, 2009
    32. 32. gem install shotgun Wednesday, March 18, 2009
    33. 33. # Have to require sinatra here and force the application name because polyglot # breaks the auto-detection logic. gem 'sinatra', '0.9.1' ; require 'sinatra' Sinatra::Application.app_file = File.join(File.dirname(__FILE__), *%w[.. .. app.rb]) # Teh App require Sinatra::Application.app_file # RSpec require 'spec/expectations' # Only including webrat for the tag matcher require 'hpricot' require 'sinatra/test' class TestSession include Sinatra::Test # parses whole file on each call def html Hpricot(body) end end Wednesday, March 18, 2009
    34. 34. Wednesday, March 18, 2009
    35. 35. KTHNXBAI Wednesday, March 18, 2009

    ×