|||

Video Transcript

X

Celadon Cedar

Super psyched to announce a major new version of Heroku, the Celadon Cedar stack, going into public beta today (previous stacks were Argent Aspen in 2009, and Badious Bamboo in 2010).

Cedar has many new features and updates, but most importantly introduces a new way of thinking about web application architecture and scaling apps on Heroku: the process model. Check it out:

New stack Celadon Cedar moves into public beta today:

$ heroku create --stack cedar Creating blazing-galaxy-997... done, stack is cedar http://blazing-galaxy-997.herokuapp.com/ | git@heroku.com:blazing-galaxy-997.git
Cedar Docs

Define your process types with Procfile:

$ cd myapp/ $ cat Procfile web: bundle exec rails server mongrel -p $PORT worker: bundle exec rake resque:work QUEUE=* urgentworker: bundle exec rake resque:work QUEUE=urgent tweetscan: bundle exec ruby tweetscan.rb cron: bundle exec clockwork clock.rb
Procfile Process Model

Then scale up dynos independently for each process type:

$ heroku scale web=4 worker=2 urgentworker=2 tweetscan=1 cron=1 Scaling processes... done
Scaling

Inspect the state of all your app's dynos across the platform:

$ heroku ps Process State Command ------------- --------------- ------------------------------------ web.1 up for 6s bundle exec rails server mongrel ... web.2 up for 5s bundle exec rails server mongrel ... web.3 up for 4s bundle exec rails server mongrel ... web.4 up for 5s bundle exec rails server mongrel ... worker.1 up for 5s QUEUE=* bundle exec rake resque:work worker.2 up for 4s QUEUE=* bundle exec rake resque:work urgentworker.1 up for 5s QUEUE=urgent bundle exec rake re ... tweetscan.1 up for 5s bundle exec ruby tweetscan.rb cron.1 up for 4s bundle exec clockwork clock.rb
ps Command

View detailed, consolidated, real-time logs:

$ heroku logs --tail 2011-05-31 04:04:40 heroku[api] Deploy fee72fc by james@example.com 2011-05-31 04:04:40 heroku[api] Release v5 created by james@example.com 2011-05-31 04:04:41 heroku[slugc] Slug compilation finished 2011-05-31 04:04:41 heroku[web.1] State changed from created to starting 2011-05-31 04:04:42 heroku[web.1] Running process with command: `bundle exec rails server mongrel -p 31878` 2011-05-31 04:04:43 app[web.1] >> Listening on 0.0.0.0:50600, CTRL+C to stop 2011-05-31 04:04:44 heroku[web.1] State changed from starting to up 2011-05-31 04:04:44 heroku[worker.1] State changed from created to starting 2011-05-31 04:04:45 heroku[worker.1] Running process with command: `QUEUE=* bundle exec rake resque:work` 2011-05-31 04:04:45 heroku[worker.1] State changed from starting to up 2011-05-31 04:04:45 heroku[web.2] Running process with command: `bundle exec rails server mongrel -p 31878` 2011-05-31 04:04:46 heroku[worker.2] Running process with command: `QUEUE=* bundle exec rake resque:work` 2011-05-31 04:04:46 heroku[worker.2] State changed from created to starting 2011-05-31 04:04:47 heroku[web.2] Running process with command: `bundle exec rails server mongrel -p 31878` 2011-05-31 04:04:47 heroku[worker.2] Running process with command: `QUEUE=* bundle exec rake resque:work` 2011-05-31 04:04:48 heroku[router] GET sushi.heroku.com/ dyno=web.1 queue=0 wait=0ms service=8ms bytes=179 2011-05-31 04:04:48 app[web.1] 66.75.123.123 - - [15/May/2011 04:05:03] "GET / HTTP/1.1" 200 1 0.0009 2011-05-31 04:04:49 app[worker.1] (in /app) ...
Logging Visibility

Run one-off interactive processes in the cloud:

$ heroku run rake db:migrate Running `rake db:migrate` attached to terminal... up, ps.1 (in /app) Migrating to CreateWidgets (20110204210157) == CreateWidgets: migrating ================================================== -- create_table(:widgets) -> 0.0120s == CreateWidgets: migrated (0.0121s) ========================================= $ heroku run ruby scripts/fix_bad_records.rb Running `ruby scripts/fix_bad_records.rb` attached to terminal... up, ps.2 $ heroku run console Running `console` attached to terminal... up, ps.3 Loading production environment (Rails 3.0.3) irb(main):001:0>
One-off Processes

Official support for Node.js:

$ cd my-node-app/ $ ls package.json Procfile web.js
$ cat Procfile web: node web.js
$ git push heroku master -----> Heroku receiving push -----> Node.js app detected -----> Vendoring node 0.4.7 -----> Installing dependencies with npm 1.0.6 mime@1.2.2 ./node_modules/express/node_modules/mime connect@1.4.1 ./node_modules/express/node_modules/connect qs@0.1.0 ./node_modules/express/node_modules/qs express@2.1.0 ./node_modules/express Dependencies installed -----> Discovering process types Procfile declares types -> web -----> Compiled slug size is 3.1MB -----> Launching... done, v4 http://radiant-river-296.herokuapp.com deployed to Heroku
$ heroku ps Process State Command ------------ ------------------ -------------------------------------------- web.1 up for 10s node web.js
$ heroku logs 2011-03-10T10:22:30-08:00 heroku[web.1]: State changed from created to starting 2011-03-10T10:22:32-08:00 heroku[web.1]: Running process with command: `node web.js` 2011-03-10T10:22:33-08:00 heroku[web.1]: Listening on 18320 2011-03-10T10:22:34-08:00 heroku[web.1]: State changed from starting to up
$ heroku run node Running `node` attached to terminal... up, ps.1 >
Node.js on Cedar

Notes:

  • Cedar uses an entirely new HTTP stack which fully supports HTTP 1.1, long polling, chunked responses, async multi-connection webservers, and more.
  • Cedar features an unprecedented level of isolation and erosion-resistance, keeping dynos running and healthy, even through patches, updates, deploys, failures, and all kinds of app activity.
  • To make more sense with the new process model, we are switching billing units from dynos to dyno-hours, effective June 1, Pacific time. Free plans will be unaffected, just converting units from first dyno free to first 750 dyno-hours free, per app. With few exceptions, the cost of Heroku will be unchanged or less expensive for all users.

We're really excited about the foundation all of this lays for the great stuff we'll be releasing over the coming months. For a list of Cedar features, check out the official press release. We will be following up this post with a detailed look at each of the major new areas over the next couple of weeks.

Enjoy. (And please send us your feedback at cedar@heroku.com.)

Originally published: May 31, 2011

Browse the archives for news or all blogs Subscribe to the RSS feed for news or all blogs.