View on GitHub

pkgr

Package your Rails app into deb packages

Download this project as a .zip file Download this project as a tar.gz file

pkgr

Goal

Make debian packages out of any Ruby or NodeJS app that can run on Heroku. Hosted service available at https://pkgr.io/.

More languages and target distributions will be added after thorough testing, though nothing prevents you from specifying a specific buildpack (see Usage).

Supported distributions (64bits only)

Examples

See https://pkgr.io/showcase for examples of apps packaged with pkgr (Gitlab, Redmine, Discourse, Ghost, etc.).

Installation

Install pkgr on a debian based build machine:

sudo apt-get install ruby1.9.1-full
sudo gem install pkgr

Usage

To package your app, you can either execute pkgr locally if your app repository is on the same machine:

pkgr package path/to/app/repo

Or, assuming your build machine is accessible via SSH by doing ssh pkgr-build-machine (set this in your ~/.ssh/config file), you can do as follows:

pkgr package path/to/app/repo --host pkgr-build-machine

The resulting .deb package will be in your current working directory.

Full command line options are given below:

$ pkgr help package
Usage:
  pkgr package TARBALL

Options:
  [--target=TARGET]                        # Target package to build (only 'deb' supported for now)
                                           # Default: deb
  [--changelog=CHANGELOG]                  # Changelog
  [--architecture=ARCHITECTURE]            # Target architecture for the package
                                           # Default: x86_64
  [--homepage=HOMEPAGE]                    # Project homepage
  [--description=DESCRIPTION]              # Project description
  [--version=VERSION]                      # Package version (if git directory given, it will use the latest git tag available)
  [--iteration=ITERATION]                  # Package iteration (you should keep the default here)
                                           # Default: 20131016164652
  [--user=USER]                            # User to run the app under (defaults to your app name)
  [--group=GROUP]                          # Group to run the app under (defaults to your app name)
  [--compile-cache-dir=COMPILE_CACHE_DIR]  # Where to store the files cached between packaging runs
  [--dependencies=one two three]           # Specific system dependencies that you want to install with the package
  [--build-dependencies=one two three]     # Specific system dependencies that must be present before building
  [--before-precompile=BEFORE_PRECOMPILE]  # Provide a script to run just before the buildpack compilation
  [--host=HOST]                            # Remote host to build on (default: local machine)
  [--auto]                                 # Automatically attempt to install missing dependencies
  [--clean]                                # Automatically clean up temporary dirs
                                           # Default: true
  [--buildpack=BUILDPACK]                  # Custom buildpack to use
  [--edge]                                 # Always use the latest version of the buildpack if already installed
                                           # Default: true
  [--verbose]                              # Run verbosely
  [--debug]                                # Run very verbosely
  [--name=NAME]                            # Application name (if directory given, it will default to the directory name)
  [--env="RACK_ENV=staging" ]              # Specify environment variables for buildpack

Why?

Tools such as Capistrano are great for deploying applications, but the deployment recipe can quickly become a mess, and scaling the deployment to more than a few servers can prove to be difficult. Plus, if you’re already using automation tools such as Puppet to configure your servers, you have to run two different processes to configure your infrastructure.

pkgr builds on top of the Heroku tools to provide you with an easy way to package you app as a debian package. The great advantage is that once you’ve built it and you tested that it works once, you can deploy on any number of servers at any time and you’re sure that it will just work. Then, you can upgrade/downgrade or uninstall the whole application in one command.

Finally, it’s a great way to share your open source software with your users and clients. Much easier than asking them to install all the dependencies manually! I’m in the process of making sure pkgr is feature complete by trying to package as many successful open-source projects as I can. Don’t hesitate to test it on your app and report your findings!

What this does

Requirements

Authors

See LICENSE (MIT)