SlideShare une entreprise Scribd logo
1  sur  35
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' ; run Sinatra::Applicationquot; > config.ru




Wednesday, March 18, 2009
‣     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
‣     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
‣     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
‣     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
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
    ★




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

                 No shell access
    ★

                 Git only
    ★




Wednesday, March 18, 2009
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
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
Wednesday, March 18, 2009
Wednesday, March 18, 2009
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
Wednesday, March 18, 2009
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
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
Wednesday, March 18, 2009
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
gem install shotgun




Wednesday, March 18, 2009
# 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
Wednesday, March 18, 2009
KTHNXBAI




Wednesday, March 18, 2009

Contenu connexe

Similaire à Heroku & Sinatra

Getting Started with (Distributed) Version Control
Getting Started with (Distributed) Version ControlGetting Started with (Distributed) Version Control
Getting Started with (Distributed) Version Control
John Paulett
 
HOW TO BUILD GEMS #shibuyarb
HOW TO BUILD GEMS #shibuyarbHOW TO BUILD GEMS #shibuyarb
HOW TO BUILD GEMS #shibuyarb
SATOSHI TAGOMORI
 
Phpday - Automated acceptance testing with Behat and Mink
Phpday - Automated acceptance testing with Behat and MinkPhpday - Automated acceptance testing with Behat and Mink
Phpday - Automated acceptance testing with Behat and Mink
Richard Tuin
 
Sinatraonpassenger 090419090519 Phpapp01
Sinatraonpassenger 090419090519 Phpapp01Sinatraonpassenger 090419090519 Phpapp01
Sinatraonpassenger 090419090519 Phpapp01
guestcaceba
 

Similaire à Heroku & Sinatra (20)

Rack Middleware
Rack MiddlewareRack Middleware
Rack Middleware
 
Ruby off Rails (japanese)
Ruby off Rails (japanese)Ruby off Rails (japanese)
Ruby off Rails (japanese)
 
Part 4 of Git, Illuminated
Part 4 of Git, IlluminatedPart 4 of Git, Illuminated
Part 4 of Git, Illuminated
 
Aristotle and the Art of Software Development
Aristotle and the Art of Software DevelopmentAristotle and the Art of Software Development
Aristotle and the Art of Software Development
 
Ruby off Rails (english)
Ruby off Rails (english)Ruby off Rails (english)
Ruby off Rails (english)
 
Getting Started with (Distributed) Version Control
Getting Started with (Distributed) Version ControlGetting Started with (Distributed) Version Control
Getting Started with (Distributed) Version Control
 
Ganglia Overview-v2
Ganglia Overview-v2Ganglia Overview-v2
Ganglia Overview-v2
 
Aristotle and the Art of Software Development (Agile 2009)
Aristotle and the Art of Software Development (Agile 2009)Aristotle and the Art of Software Development (Agile 2009)
Aristotle and the Art of Software Development (Agile 2009)
 
Demystifying Maven
Demystifying MavenDemystifying Maven
Demystifying Maven
 
Scaling PHP to 40 Million Uniques
Scaling PHP to 40 Million UniquesScaling PHP to 40 Million Uniques
Scaling PHP to 40 Million Uniques
 
HOW TO BUILD GEMS #shibuyarb
HOW TO BUILD GEMS #shibuyarbHOW TO BUILD GEMS #shibuyarb
HOW TO BUILD GEMS #shibuyarb
 
Joomla Template Development
Joomla Template DevelopmentJoomla Template Development
Joomla Template Development
 
Phpday - Automated acceptance testing with Behat and Mink
Phpday - Automated acceptance testing with Behat and MinkPhpday - Automated acceptance testing with Behat and Mink
Phpday - Automated acceptance testing with Behat and Mink
 
Getting to Know Grunt by Writing Your Own Plugin
Getting to Know Grunt by Writing Your Own PluginGetting to Know Grunt by Writing Your Own Plugin
Getting to Know Grunt by Writing Your Own Plugin
 
Getting to Know Grunt By Writing Your Own Plugin
Getting to Know Grunt By Writing Your Own PluginGetting to Know Grunt By Writing Your Own Plugin
Getting to Know Grunt By Writing Your Own Plugin
 
Lightweight Webservices with Sinatra and RestClient
Lightweight Webservices with Sinatra and RestClientLightweight Webservices with Sinatra and RestClient
Lightweight Webservices with Sinatra and RestClient
 
Sinatra
SinatraSinatra
Sinatra
 
Bringing modern PHP development to IBM i (ZendCon 2016)
Bringing modern PHP development to IBM i (ZendCon 2016)Bringing modern PHP development to IBM i (ZendCon 2016)
Bringing modern PHP development to IBM i (ZendCon 2016)
 
Sinatraonpassenger 090419090519 Phpapp01
Sinatraonpassenger 090419090519 Phpapp01Sinatraonpassenger 090419090519 Phpapp01
Sinatraonpassenger 090419090519 Phpapp01
 
RDFa: The Semantic Web's Missing Link
RDFa: The Semantic Web's Missing LinkRDFa: The Semantic Web's Missing Link
RDFa: The Semantic Web's Missing Link
 

Dernier

Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 

Dernier (20)

Spring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUKSpring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Cyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdfCyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdf
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 

Heroku & Sinatra

  • 7. mkdir quotes Wednesday, March 18, 2009
  • 8. mkdir quotes ‣ cd quotes Wednesday, March 18, 2009
  • 9. mkdir quotes ‣ cd quotes ‣ git init Wednesday, March 18, 2009
  • 10. mkdir quotes ‣ cd quotes ‣ git init ‣ mate app.rb Wednesday, March 18, 2009
  • 11. mkdir quotes ‣ cd quotes ‣ git init ‣ mate app.rb ‣ echo quot;require 'app' ; run Sinatra::Applicationquot; > config.ru Wednesday, March 18, 2009
  • 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. 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. 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. 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
  • 17. CONSTRAINTS (good ones) Wednesday, March 18, 2009
  • 19. Rails (> 2.0.2) or a Rack-based app with a ★ config.ru Wednesday, March 18, 2009
  • 20. Rails (> 2.0.2) or a Rack-based app with a ★ config.ru No shell access ★ Wednesday, March 18, 2009
  • 21. Rails (> 2.0.2) or a Rack-based app with a ★ config.ru No shell access ★ Git only ★ Wednesday, March 18, 2009
  • 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. 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
  • 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
  • 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. 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
  • 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
  • 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

Notes de l'éditeur

  1. Herko, who’s heard of it?
  2. its this, actually I have no idea what this is
  3. That thing is now a tool for learning rails. I haven’t used it and don’t really intend to.
  4. So, the new heroku.
  5. 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.
  6. 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.
  7. 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.
  8. 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.
  9. 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.
  10. 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.
  11. reloader