Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Millions of Apps Deployed

Millions of Apps Deployed

Heroku has deployed over a million applications in most web languages and frameworks, see what we've learned in the process!

Richard Schneeman

November 12, 2012

Transcript

124 slides
  1. Twelve Factor • Can apply to any language • Speeds

    up deployment, makes scaling easier & keeps apps clean • Developed over direct exposure to the deployment of hundreds of thousands of apps
  2. 12factor.net • Codebase • One codebase tracked in revision control,

    many deploys • Dependencies • Explicitly declare and isolate dependencies • Config • Store config in the environment • Backing Services • Treat backing services as attached resources
  3. 12factor.net • Build, Release, Run • Strictly separate build and

    run stages • Process • Execute the app as one or more stateless processes • Port Binding • Export services via port binding • Concurrency • Scale out via the process model
  4. 12factor.net • Disposability • Maximize robustness with fast startup and

    graceful shutdown • Dev/Prod Parity • Keep development, staging, and production as similar as possible • Logs • Treat logs as event streams • Admin Process • Run admin/management tasks as one-off processes
  5. VPS • Use Foreman/Dotenv • Add to bashrc • Add

    values directly to command $ SECRET_TOKEN=asd123 rails console ruby-1.9.3> puts ENV[‘SECRET_TOKEN’] ruby-1.9.3> “asd123”
  6. Config • What varies between deploys • resource strings to

    databases • credentials to S3, twitter, facebook, etc. • canonical values, hostname • security tokens
  7. Development • As close to production as possible • Same

    data-stores (postgres, memcache) • Same language versions (Ruby 1.9) • Real/consistent data
  8. README.md • Living document • Standardize dev environment • Instructions

    for external dependencies • Instructions for starting processes • Problem with dev environment? • Put the fix in the readme $ brew install memcache $ foreman start
  9. Error Notification • Record Logs & Errors • New Relic

    (rpm) • Airbrake (hoptoad) • HoneyBadger
  10. Error Pages • Admins get error + Backtrace Couldn't find

    Course with ID=chunkybacon Details Params: {"action"=>"show", "controller"=>"courses", "id"=>"chunkybacon"} Backtrace: lib/active_record/relation/finder_methods.rb:304:in `find_one'
  11. Admin Error Pages + Backtrace Couldn't find Course with ID=chunkybacon

    Details Params: {"action"=>"show", "controller"=>"courses", "id"=>"chunkybacon"} Backtrace: lib/active_record/relation/finder_methods.rb:304:in `find_one'

More Decks by Richard Schneeman

Other Decks in Programming