Distillery

From Elixir Wiki
Jump to navigation Jump to search

Distillery[edit]

File:DistilleryLogo.png
Distillery logo

Distillery is a powerful release management tool for Elixir applications. It provides a streamlined approach to building, deploying, and managing Elixir releases. With Distillery, developers can easily package their Elixir applications and run them seamlessly on various platforms and environments.

Features[edit]

  • Simplified release creation process
  • Built-in support for hot code swapping
  • Flexible configuration options
  • Support for multiple deployment strategies
  • Comprehensive release management and versioning
  • Cross-platform compatibility

Installation[edit]

To use Distillery, you need to include it as a dependency in your Elixir project. Add the following line to your `mix.exs` file:

```elixir defp deps do

 [
   {:distillery, "~> 2.1", runtime: false}
 ]

end ```

After updating the project dependencies, you can fetch and compile the new dependency by running:

``` mix deps.get mix deps.compile ```

Usage[edit]

Distillery simplifies the release creation process by providing a set of mix tasks. These tasks enable developers to generate standalone releases of their applications with all the necessary dependencies included. Here are some key tasks offered by Distillery:

  • `mix release.init`: Initializes a new release configuration file.
  • `mix release`: Builds a release of the application.
  • `mix release.clean`: Deletes all generated release artifacts.
  • `mix release.start`: Starts a release using the generated scripts.
  • `mix release.remote`: Deploys a release to a remote server.

Configuration[edit]

Distillery allows developers to configure various aspects of their release. The configuration file `rel/config.exs` provides a flexible way to customize the release process. Some commonly used configuration options include:

  • `project`: The name and version of the project.
  • `release_name`: The name of the release artifact.
  • `include_erts`: Whether to include an Erlang Run-Time System in the release.
  • `vm_args`: Additional Erlang VM arguments.
  • `pre_start`: Actions to be taken before starting the application.
  • `extended_start_script`: Enables extended mode, allowing custom scripts to be executed.

Deployment Strategies[edit]

Distillery supports multiple deployment strategies, giving developers the flexibility to deploy their releases in various ways. Some deployment strategies include:

  • **Copy**: Simply copy the release to the target machine and run it.
  • **Upgrade**: Upgrades an existing release on the target machine.
  • **Remote**: Deploys the release to a remote server using SSH.
  • **Docker**: Builds a Docker container with the release and dependencies.

Case Studies[edit]

See Also[edit]

  • Elixir - A dynamic, functional programming language built on top of the Erlang VM.
  • Phoenix - A web framework for Elixir that enables building robust, scalable applications.
  • Mix - A build tool that ships with Elixir and provides tasks for creating, compiling, and testing Elixir projects.

External Links[edit]