Announcing Bootleg: Simple deployment and server automation for Elixir.

At ElixirConf 2017 we began getting the word out about Bootleg, a project we've been working on for most of this year in-between our normal Lab Zero client work. So what is Bootleg exactly?

From our README:

Bootleg is a simple set of commands that attempt to simplify building and deploying Elixir applications. The goal of the project is to provide an extensible framework that can support many different deploy scenarios with one common set of commands.

We've created something inspired by tools like Capistrano, Mix, and Rake in order to make automating a deployment pipeline a bit easier.

Basic deployment flow

In a basic deployment workflow there are three main areas of interest: build, deploy, and administration. We know that every project has different workflow scenarios, so we've also built in a system of hooks and triggers so that a Bootleg workflow can be customized and extended as much or as little as needed.

Bootleg's primary functions at a glance:

1) Build a Distillery release

Often our development architecture does not match our deploy target architecture. At Lab Zero we develop on macOS but run Linux clusters for some of our deploy targets. Bootleg does the work necessary to compile and build our releases on server architecture that matches the target deploy environments.

2) Deploy a Distillery release

Bootleg provides remote build and remote server automation for your existing Distillery releases. It currently assumes your project is part of a Git repository and some of the build steps use this assumption to handle code in parts of the build process.

3) Provide administration and service commands, like start and stop.

Once an application is deployed, Bootleg can be used to interact with the application services. Commands like start, stop, ping and a few others are available. Since your app is likely deployed across a cluster of hosts, this provides a way to manage your app by simultaneously running commands on multiple hosts.

4) Provide a framework for hooks and triggers

These hooks and triggers allow users to customize and add additional behaviors to the above functions. Take a look at the Bootleg documentation for more information.

Simple setup

For those that only need the out-of-the-box features of building and deploying an existing Distillery release, it's really a matter of adding a couple lines of configuration. First things first, configure the dependencies inside your project mix.exs.

# mix.exs
def deps do
  [{:distillery, "~> 1.5",
   {:bootleg, "~> 0.6"}]

Then run mix deps.get in order to pull the new dependencies down. We will assume you already have a Distillery release already configured for your project.

At this point you can run mix bootleg.init which will create a sample config/deploy.exs file for you to use as a starting point. Make sure to change the settings for both the :build and :app roles to match your needs and then you should be good to go.

# config/deploy.exs
use Bootleg.Config

role :build, "", user: "develop", workspace: "/tmp/build/myapp"
role :app, ["web1", "web2", "web3"], user: "admin", workspace: "/var/myapp"

Now you are ready to build and deploy your release.

$ mix
$ mix bootleg.deploy
$ mix bootleg.start

For a full list of role options and available Bootleg DSL commands, head over to the Bootleg documentation. For those looking to deploy Phoenix applications with Bootleg, you might be interested in our bootleg_phoenix package, which injects a few extra phoenix specific deploy steps into Bootleg. Let us know in the comments if you are using Bootleg or how you hope to use it, we'd love to hear your feedback.

Continue the conversation.

Lab Zero is a San Francisco-based product team helping startups and Fortune 100 companies build flexible, modern, and secure solutions.