Getting Started with Heroku

  • Published on

  • View

  • Download

Embed Size (px)


Learn what Heroku is about, where it can be a good fit, and how much it costs compared to using Amazon EC2.


<ul><li>1.Getting Started with Heroku</li></ul> <p>2. Platform-as-a-ServiceProvision App Environments, Not Servers 3. Common Use Cases Launching and scaling apps without IT/server scripting Deploying MVPs Situational/Internal Apps Mobile API/Backend 4. How It Works1. Provision Application w/ Heroku2. Heroku creates a hosted Git Repository3. Provision Services and Options (Add-ons)4. Configure your application using ENV vars5. Push to your applications Git repository to Heroku 5. Dynos Dyno == 1 Process (one free Dyno per app per month) Support Ruby, Java/JVM, Node.js, Python, others Additional Dynos: $0.05/hour == $36/month Each process can run up to ~15 threads Thin with threadsafe Rails: 1 process/15 threads Unicorn: 3 processes/45 threads Limited by soft memory cap of 512MB per process 6. Database PostgreSQL 9.1 Shared 5GB (free) or 20GB ($15/month) Production - $50 to $6400/month based on storage/CPU/Cache 1 TB max 7. Add-ons Heroku Add-ons (CNAME, SSL, pg backup, etc) Third-party (New Relic, MongoHQ, Memcached, etc) Config and Customization often free or low cost Some third party are free, most have tiered pricing$ heroku addons:add ssl:endpoint 8. The Procfile$APP_ROOT/Procfile:web: bundle exec rails server -p $PORTworker: bundle exec rake resque:work QUEUE=*urgentworker: bundle exec rake resque:work QUEUE=urgent 9. Scaling Processes$ heroku scale worker=1scaling processes... done 10. Viewing Processes$ heroku psProcess State Command----------- ----------- -----------------------------web.1 up for 6s bundle exec rails serverworker.1 up for 5s bundle exec rake resque:work 11. Viewing Logs$ heroku logs --tail2012-07-09 19:04:48 heroku[router] GET / dyno=web.12012-07-09 19:04:48 app[web.1] - - 12. Cost Analysis: Production Rails App Rails 3.2 Background workers PostgreSQL Relational DB MongoDB Document-Oriented DB 13. Rails App 3 processes (1 free dyno + 2 dynos) 2 worker processes (+2 dynos) Total cost for dynos: 4 * $36 = $144/month 14. App Add-ons Custom Domain (now default) - FREE New Relic Standard FREE PostgreSQL Backups FREE PostgreSQL w/ 400MB Cache - $50/month SSL Endpoint - $20/month Memcache 100MB - $20/month MongoHQ Small - $15/month Total cost w/ dynos: $249/month First year cost: $2988 15. AWS ComparisonOn Demand Pricing (us-west): EC2 Small x 2 (Rails/Memcache) = $0.18/hour = $130/month EC2 Small x 2 (Mongo+PostgreSQL) = $0.18/hour =$130/month EC2 + ELB Bandwidth = ~$20.00/month Total cost: $280/month + server scripting/setup cost First year cost: $3660 16. AWS Comparison (cont)Reserved Pricing (us-west) 1 year term: EC2 Small x 2 (Rails/Memcache) = $0.05/hour = $36/month One-time setup $195 x 2 EC2 Small x 2 (Mongo+PostgreSQL) = $0.05/hour = $36/month One-time setup $195 x 2 EC2 + ELB Bandwidth = ~$20.00/month Total cost: $780 setup + $92/month + server scripting/setup cost First year cost: $1884 17. AWS Comparison (cont)Reserved Pricing (us-west) 1 year term + 3rd party DB mgmt: EC2 Small x 2 (Rails/Memcache) = $0.05/hour = $36/month One-time setup $195 x 2 MongoHQ = $49/month Heroku PostgreSQL = $50/month EC2 + ELB Bandwidth = ~$20.00/month Total cost: $780 setup + $155/month + server scripting/setupcost First year cost: $2640 18. Thank you James </p>