Distillery Packager

Coverage StatusBuild Status

Elixir lib for creating Debian and RPM packages with Distillery.

Features

  1. [x] Able to build Debian packages
    1. [x] With control file
    2. [x] With customizable pre/post install/remove scripts
    3. [x] With capability to add custom files/scripts to the package
  2. [ ] Able to build RPM packages
  3. [x] Automatically builds init scripts, which are all customizable, for:
    1. [x] Systemd
    2. [x] Upstart
    3. [x] SysVinit

Required OS dependencies

Before using distillery_packager, you’ll need the following packages installed and in your path:

Installation

Add distillery_packager to your list of dependencies in mix.exs:

def deps do
  [{:distillery_packager, "~> 1.0"}]
end

General configuration

Distillery_packager relies on the following data in the mix.exs file being set:

defmodule Testapp.Mixfile do
   use Mix.Project

   def project do
      [app: :testapp,
      version: "0.0.1",
      elixir: "~> 1.7",
+     description: "Elixir lib for creating linux packages with Distillery",
      build_embedded: Mix.env == :prod,
      start_permanent: Mix.env == :prod,
-     deps: deps()]
+     deps: deps(),
+     deb_package: deb_package()]
   end

Debian package configuration

The deb_package function must be set as:

def deb_package do
   [
      vendor: "18Months S.r.l.",
      maintainers: ["18Months <info@18months.it>"],
      homepage: "https://www.18months.it",
      base_path: "/opt",
      external_dependencies: [],
      maintainer_scripts: [
         pre_install: "rel/distillery_packager/debian/install_scripts/pre_install.sh",
         post_install: "rel/distillery_packager/debian/install_scripts/post_install.sh",
         pre_uninstall: "rel/distillery_packager/debian/install_scripts/pre_uninstall.sh"
      ],
      config_files: ["/etc/init/.conf"],
      additional_files: [{"configs", "/etc/distillery_packager/configs"}],
      owner: [user: "root", group: "root"]
   ]
end

A list of configuration options you can add to deb_package/0:

Distillery configuration

You can build a deb by adding plugin DistilleryPackager.Plugin to your rel/config.exs file.

You can also specify target distribution and architecture with plugin DistilleryPackager.Plugin, %{distribution: "xenial", architecture: "amd64"}

The name and version is taken from the rel/config.exs file.

Usage

Base path

You can generate the base path for additional files to be added to the package with:

mix release.deb.prepare_base_path

Customising deb config files

You can customise the debs that are being built by copying the template files used and modifying them:

mix release.deb.generate_templates

Build

Packages are build with the mix distillery.release command built in Distillery. Built packages will be moved to rel/distillery_packager/debian/packages

[1]:https://www.debian.org/doc/manuals/maint-guide/dreq.en.html#control