Skip to content
This repository has been archived by the owner on Jun 18, 2018. It is now read-only.

Allows automated installation of software packages in a Heroku dyno

Notifications You must be signed in to change notification settings

armarti/Heroku-Package-Builder-Buildpack

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Moved to gitlab

Heroku Package Builder Buildpack

Install extra packages in your Heroku dyno without root

This buildpack mostly uses Linuxbrew.

Use this by finding the package you want here and placing them in package-extras.yaml in the root of your git repo like so:

packages:
  - postgresql
  - man__db
  - openssh
uninstall:
  - gnutls
reinstall:
  - xz
formulas:
  man-db: https://raw.githubusercontent.com/Linuxbrew/homebrew-extra/master/Formula/man-db.rb
options:
  openssh: 
    - with-ldns
    - with-libressl
config:
  postgresql:
    - setup_djangodb.sh

YAML Setup

IMPORTANT
If your package name contains dashes "-" replace them with double-underscores "__" e.g. man-db -> man__db

install
  • just the package name
  • installed in the order entered
  • runs first

reinstall

  • reinstall something
  • runs second

uninstall

  • OPTIONAL
  • uninstall something
  • runs third
formulas
  • OPTIONAL
  • a custom linuxbrew formula to apply to a package
  • if your build fails, try:
    • Remove this package from package-extras.yaml
    • Get a successful build
    • Run heroku run brew search <packagename> -a <appname>
    • If it has a special path like .linuxbrew/dupes/<packagename> then add this to your formulas section for this package
    • the key must correspond to an install/uninstall/reinstall package
  • Some Linux-specific formulas can be found here
options
  • OPTIONAL
  • Command line flags to use when building the package
  • e.g. the above example builds openssh with ldns support and LibreSSL and translates to brew install homebrew/dupes/openssh --with-ldns --with-libressl on the command line
config
  • OPTIONAL
  • Runs the named scripts from your $HOME directory after installing the package
    • make sure the script has a shebang line
  • The script will be passed the same arguments as the compile script
    • See bin/compile in the Heroku Buildpack API documentation

CONFIG VARS

PACKAGE_BUILDER_BUILDFAIL (1 or 0)
Fail the whole build if a single package fails to install

PACKAGE_BUILDER_HOMEBREW_VERBOSE (1 or 0)
If =1, print all make output to build log

PACKAGE_BUILDER_INSTALL_QUIET (1 or 0)
Remove excessive install output

PACKAGE_BUILDER_REINSTALL_LINUXBREW (1 or 0)
Removes all packages installed before and starts anew

PACKAGE_BUILDER_MAX_BUILDTIME (time in minutes)
Max time to take building (not exact)

BUILD_DEBUG (1 or 0)
Print extra stuff when building

PACKAGE_BUILDER_NOINSTALL_GAWK (1 or 0)
PACKAGE_BUILDER_NOINSTALL_GCC (1 or 0)
PACKAGE_BUILDER_NOINSTALL_RUBY (1 or 0)
PACKAGE_BUILDER_NOINSTALL_PERL (1 or 0)
PACKAGE_BUILDER_NOINSTALL_PYTHON (1 or 0)
PACKAGE_BUILDER_NOINSTALL_DEFAULTS (1 or 0)
Some core tools are automatically installed on first install. Setting this to 1 disables this. PACKAGE_BUILDER_NOINSTALL_DEFAULTS=1 disables all automatic installs.

USE_DPKG_BUILDFLAGS (1 or 0)
Use the default buildflags as dpkg (on by default)

OVERVIEW

This buildpack allows you to install any software. At the moment it uses Linuxbrew exclusively, so if you want to install a non-Linuxbrew package you'll need to write a formula (read more here).

Aside from simply running brew install <package> this buildpack aims to deal witht he unique constraints of Heroku, including the ~15 minute timeout and the max slug size limit (thsi part's in development).

If a package doesn't install, check the build log. Important messages will print to the log regardless, but diagnosis may require you setting BUILD_DEBUG=1. Note that you could enable xtrace to the result of absolutely every command run by setting BUILDPACK_XTRACE=1, but it would print so much that something might break. So it's not recommended.

Lastly, if you think I messed something up or you think that everything is just perfect then please let me know by opening an issue.

NOTES

  1. If the build process times out before all packages are installed, reduce the number of packages in package-extras.yaml until you have a successful build. Then on the next build replace the successful packages with the removed packages. The successfully installed packages should still be available.
  2. If you can't even get one package to build, have a look in the build log and see what its dependencies are. Try installing those individually before the main package, following the pattern in (1).
  3. This package mostly depends on Linuxbrew, which is a fork of Homebrew, which collects some anonymized info about your usage. To disable this set the config var HOMEBREW_NO_ANALYTICS to 1.

TODO

  • test having formulas in the project root
  • check on the slug size before installing more packages
  • install multiple packages simultaneously
  • make better yaml parser
  • make json parser

About

Allows automated installation of software packages in a Heroku dyno

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages