liveBook · Manning

Release

As explained in Elixir in Action, Third Edition

A release is a self-contained deployment artifact containing an application, its dependencies, compiled code, and the runtime needed to execute it.

A release is a self-contained deployment artifact for running an Elixir system in production. It compiles the main OTP application and its dependencies, includes the Erlang runtime, and provides scripts for operating the resulting system. section 13.2.1 section 13.2.2

Build a release with Mix, then operate it through its generated command script:

  • Run `mix release`; use `MIX_ENV=prod mix release` or configure the `release` task to prefer the production environment. section 13.2.1
  • Copy `_build/prod/rel/todo` to a compatible machine without installing Elixir or Erlang separately. section 13.2.2
  • Use the generated script to start the system, run it as a daemon, attach a remote shell, or stop it. section 13.2.2
  • Set `RELEASE_NODE` when naming the running node; use `RELEASE_DISTRIBUTION=name` for long node names. section 13.2.2

A standalone release contains compiled OTP applications, runtime arguments, a boot script, application configuration, an operation script, and Erlang runtime binaries. Required direct and indirect dependencies, core OTP applications, Elixir, and IEx reside under the release’s `lib` directory. Project files can be bundled through a root `priv` folder. section 13.2.3

Starting and inspecting a production release

Run `RELEASE_NODE="todo@localhost" _build/prod/rel/todo/bin/todo start_iex` to start the to-do system with an IEx shell. From that shell, `:code.get_path()` shows paths resolving inside the release directory rather than the host installation. section 13.2.2 section 13.2.3

$ mix release

* assembling todo-0.1.0 on MIX_ENV=dev
* using config/runtime.exs to configure the release at runtime

Release created at _build/dev/rel/todo

...

Shows the release command assembling an artifact and reporting its output directory. section 13.2.1

How Elixir in Action, Third Edition covers it

How deep it goes
Explains creation, environment selection, artifact contents, runtime independence, node configuration, and operational commands.
Examples
Uses a to-do release, Mix commands, generated shell commands, remote IEx sessions, and release load-path inspection.
What it assumes
Assumes an OTP application and its direct and indirect dependencies are available for compilation.
What you can do after
Operate/configure a standalone release, select its build environment, run lifecycle commands, and attach to its production node.
How it connects
Connects OTP applications, dependencies, Mix environments, Erlang runtime binaries, node distribution, and remote shells.

Also explained in

Compare how 4 books explain release →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Elixir in Action, Third Edition. The section links point to the parts of the book it draws on.