Skip to content

Instantly share code, notes, and snippets.

@mars
Created August 9, 2016 05:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mars/c3410b82945ce238e9d9b884250a6081 to your computer and use it in GitHub Desktop.
Save mars/c3410b82945ce238e9d9b884250a6081 to your computer and use it in GitHub Desktop.
Tips for authoring Heroku buildpacks

There's a lot of knowledge to be had about buildpacks. Start with reading the main docs:

Set your scripts to fail quickly & loudly

bash inherently swallows errors thrown by commands. Use the following at the top of your compile script:

#!/usr/bin/env bash

# Fail immediately on non-zero exit code.
set -e
# Fail immediately on non-zero exit code within a pipeline.
set -o pipefail
# Fail on undeclared variables.
set -u
# Debug, echo every command, uncomment for a lot of output
#set -x

DDD, deploy driven development

You'll need to commit and push to an app that uses a buildpack in order to see it run.

Use empty commits to keep pushing a repo without real changes:

git commit --allow-empty -m "🚢"
git push heroku master

Keep a separate terminal open tailing the app's logs:

heroku logs -t -a my-ddd-app
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment