Composable buildpacks
#5 Compare This branch is 13 commits ahead, 23 commits behind ddollar:master.
Latest commit 4e187b9 Sep 22, 2016 @schneems schneems committed on GitHub Update
Failed to load latest commit information.
bin We're actually exiting the build, not skipping Apr 24, 2015 Update Sep 22, 2016

Heroku buildpack: multi

This is a Heroku buildpack that allows one to multiple other buildpacks in a single deploy process. This helps support:

  1. Running multiple language buildpacks such as JS for assets and Ruby for your application
  2. Running a daemon process such as pgbouncer with your application
  3. Pulling in system dependencies.


To use this buildpack you'll first need to set it as your custom buildpack:

$ heroku buildpacks:set

From here you will need to create a .buildpacks file which contains (in order) the buildpacks you wish to run when you deploy:

$ cat .buildpacks

Writing a Multi Buildpack Compliant Buildpack

Most buildpacks install one or more system components. When using multi-buildpack it is possible to chain buildpacks together, in the previous example Node was installed and then Ruby. For this to work Ruby must have access to any environment variables needed to boot up node. For example the Node buildpack puts a node binary on the system then adds that location to the PATH so the system knows where to find it. If Ruby does not execute with this new PATH , it won't be able to find the installed version of Node. To support this the Node buildpack writes out an export file that contains the necessarry exports for any other buildpack to execute Node. If you are authoring a buildpack, you should consider how other buildpacks may want to access the components you've installed and write out your own export file.

You do this by writing a to $buildpack_dir/export where $buildpack_dir is the directory the buildpack is executing in (i.e. the directory above bin/compile) and export is a text file containg bash, for example:

export "$PATH:\$PATH"