---
title: 'Exodus: Create Portable Self–contained Erlang Elixir Release'
---

# DESCRIPTION

[Erlang](https://rebar3.readme.io/docs/releases) and
[Elixir](https://hexdocs.pm/mix/Mix.Tasks.Release.html) releases are
tarballs containing compiled code and any files from the erlang system
required to run the application.

Running a release can be as simple as:

```
# appname is the release application name
$ mkdir -p /path/to/appname
$ cd /path/to/appname
$ tar zxf /path/to/appname.tar.gz
$ bin/appname foreground
```

Except releases are not self-contained:

- releases must be assembled on the same platform as destination: both
  must be the same OS and architecture

- build artifacts (executables, libraries) are linked against system
  libraries, e.g., libc, OpenSSL

- the system libraries must exist on the destination platform

- the system libraries must be the same version on the destination
  platform

For example, with the same architecture, compiling an Elixir release on
Ubuntu 20.04 will run on another Ubuntu 20.04 (and probably later) system.

Running the release on an Ubuntu 16.04 system will fail due to library
version incompatibilities.

Probably the easiest fix is to compile the release on a system with the
same platform:

- create an [Ubuntu 16.04 container](/notes/ChromeOS-setup-crostini.html)

- [install Erlang and Elixir](/notes/asdf-setup-and-install-tools.html)

- generate the release

Another option is to include the system libraries in the release using
[Exodus](https://github.com/intoli/exodus).

# COMMANDS

- install Exodus

```
$ pip install --user exodus-bundler
```

- create the release

```
# erlang
$ rebar3 as prod release --relname=${RELNAME} --relvsn=${RELVSN}

# elixir
$ MIX_ENV=prod mix do deps.get, deps.compile, release
```

- generate a self-contained release

```
# appname is the release application name
$ exodus --add . --tarball bin/appname --output /tmp/appname.tgz
```

- copy and install the release on the destination

```
$ mkdir -p /usr/local/lib/appname
$ tar --strip 1 -C /usr/local/lib/appname -zxf /tmp/appname.tgz
```

- additional operations: setuid binaries

```
$ cd /usr/local/lib/appname
$ sudo chown root:root ./bundles/fe1305c76dd94418a58b068a75ffba0d7f32707808de4362767ee166eccbec83/tmp/appname/lib/epcap-1.1.0/priv/epcap
$ sudo chmod u+s ./bundles/fe1305c76dd94418a58b068a75ffba0d7f32707808de4362767ee166eccbec83/tmp/appname/lib/epcap-1.1.0/priv/epcap
```

---

([markdown](/notes/exodus-create-portable-self–contained-erlang-elixir-release.md))
