Quick Glance @ Elixir 1.9 Releases feature

Blackode
Blackode
Jun 26 · 4 min read

New mix task for Elixir releases

Created Using Canva.com

This article is all about showing the live demo of Elixir Releases, a brand new mix task mix release .

Mix Task Commands

The above commands will generate a self-contained releases.

What is self-contained?

  1. No Source Code is required
  2. Not require Erlang or Elixir.
  3. Loads only required Elixir and Erlang Libraries instead all
  4. Includes Erlang VM(Virtual Machine)

Live Demo

Let’s create a new mix project hello for demonstration.

Basic Release Configuration

A release can be configured in our mix.exs file under the :releases key inside def project:

To keep it tidy, I created a new private function releases .

How to run a release?

You just need to specify the release name. Here demo is our new release name.

The above configuration is enough to release our hello application for demo purpose.

release screenshot

Do we need to always specify release name ?

Let’s give a try.

As we are having only one configuration for release.

What happens if there are more than one (1) configurations ?

❌ ❌

Let’s check it.

I just updated the releases function by adding another configuration demo2. Check the following screenshot

file: mix.exs

Now run the task without specifying the release name.

1.9.0 Release BUG 🐞

Specifying Default Release option :default_release

Though they mentioned to set :default_release option in our project root configuration, there is a bug in the recent release where the default setting was never read . Hope to get it fixed in the coming release.

Can we change the default release directory?

Just add

option to the release configuration like in the following screenshot

Now run the release MIX_ENV=prod mix release demo. All the releases will move to my_releases folder in the project.

You can see a lot of information logs to the console while you run the release. Though it is informative, sometimes it looks weird.

We can provide the

option to simply run the release with out any verbose.

Check out the following screenshot for adding the option.

I purposely added two configurations, with and with out quiet: true option like below

Now run both releases and see the difference.

The left side is with quiet: true and right side with out quiet option.

There are lot things to read about releases for better usage.

This is just a glance of releases in Elixir 1.9.0. For Better understanding and in depth reading check →Elixir mix release.

Hope you liked it.

Let’s others get benefited from this by clapping & sharing.

if worth_clapping, do: CLAP, else: nil

Thanks for reading.

Join Our Telegram Channel and support us.

Blackode

Written by

Blackode

Wrong CODE takes U to the right BUG 🐞 coding, thoughts & ideas