1. Buildpack Adventure 2

  2. This is one hacker’s quixotic journey through userland, where the open-source Heroku buildpacks roam.
  3. “The most dangerous thought you can have as a creative person is to think you know what you're doing.” - Bret Victor
  4. Herok-who?

  5. Heroku is a web hosting company that doesn't suck. We help developers focus on apps rather than infrastructure.
  6. All the Languages

  7. Heroku is a polyglot platform, designed to support many programming languages.
  8. Cedar is Heroku’s language-agnostic Ubuntu stack. New languages and frameworks are supported on Cedar through the use of buildpacks.
  9. What is a Buildpack?

  10. A buildpack is a collection of scripts that prepare your app for execution on the Heroku platform.
  11. Heroku maintains official buildpacks for languages and frameworks like Ruby, Node.js, Python, Scala, and a few others.
  12. When you push to Heroku, we detect your app's language and use the appropriate buildpack automatically.
  13. How Do Buildpacks Work?

  14. Buildpacks are typically written in bash, but can be written in higher-level lanuages like ruby, python, or javascript.
  15. In its simplest form, a buildpack consists of two scripts: detect and compile. Let's look at some pseudocode...
    #!/usr/bin/env bash
    # bin/detect build-dir
    if [ -f $1/package.json ]; then
      echo "Node.js" && exit 0
      echo "no" && exit 1
    #!/usr/bin/env bash
    # bin/compile build-dir cache-dir
    curl http://nodejs.org/dist/v0.10.15.tgz
    npm install --production
  18. Buildpacks are open source. Like the Node.js maintainers, we believe that a small core and a big userland are essential to a prosperous community.
  19. The Node.js Buildpack

  20. The Node.js buildpack has a ton of forks. What are all those hackers are up to?
  21. The roles of a product manager are many and varied, but the most important one is to figure out what customers need, then distill that information into something actionable by designers and engineers.
  22. Having a large community of open source contributors means we don't always have to ask what our customers want. They're already building what they want!
  23. So... maybe we can use GitHub to get a sense of what people are doing with all those forks.
  24. GitHub's Network Graph Viewer doesn't really tell us much. Fortunately, we're hackers...
  25. dotjs is a Google Chrome extension and local webrick webserver that serves up files in your ~/.js directory. When you view foo.com in your browser, ~/.js/foo.com.js is eval'd against the current page.
  26. dotjs is like Greasemonkey for introverts: great for prototyping, but devoid of a real distribution mechanism.
  27. If only there was a painless way to write browser extensions...
  28. Crossrider!

  29. Crossrider is a cloud-based development framework for creating browser extensions that work in Chrome, Firefox, IE and Safari. It even lets you develop locally.
  30. Forkie is a browser extension (written in Crossrider) that replaces GitHub's network page with something useful.
  31. Writing extensions is fun. Let's make another one for viewing npm dependencies of github repos!
  32. I digress...
  33. Forkie helps to surface buildpacks that are theoretically popular, but stargazer and fork counts are merely popularity proxies. Let's look at real usage data...
  34. Deep Divin’ in Deploy Data

  35. Every time an app is deployed on Heroku, its buildpack URL is stored in an hstore column of a postgres database.
  36. select attributes->'buildpack_url' as buildpack, count(*) as deploys from all_events where attributes ? 'buildpack_url' group by buildpack order by deploys desc;
  37. Buildpack Trends

  38. Build Tools

    grunt, bower, and hem.
  39. Headless Browsers

    PhantomJS and Casper.
  40. Meteor

    Meteor, Meteor, Meteor, Meteor, Meteor, and Meteor.
  41. Binary Dependencies

    Cairo, FFMpeg, Taglib, EXIFTool, and Vendor Binaries.
  42. Weird Stuff

    Dart and null-buildpack.
  43. Language Promiscuity

    ruby+node and python+node.
  44. Composability

    heroku-buildpack-multi, heroku-multi-buildpack, and heroku-buildpack-compose.
  45. The Future

  46. The future looks bright, and userland is rife with creativity. There are over 1500 third-party buildpacks in use on the platform today.
  47. The official Node.js buildpack is going on a diet.
  48. Composable buildpacks will soon become the default.
  49. Node.js is now a first-class citizen at Heroku, and a top company priority.
  50. Fin.

  51. I'm zeke on Twitter and zeke on GitHub. Hit me up if you want to paint bike sheds, drop science, design by committee, or wax philoshophical.
  52. github.com/zeke/ba2