{"id":9051,"date":"2019-05-29T10:26:43","date_gmt":"2019-05-29T13:26:43","guid":{"rendered":"http:\/\/blog.plataformatec.com.br\/?p=9051"},"modified":"2019-11-14T11:49:55","modified_gmt":"2019-11-14T13:49:55","slug":"updating-hex-pm-to-use-elixir-releases","status":"publish","type":"post","link":"http:\/\/blog.plataformatec.com.br\/2019\/05\/updating-hex-pm-to-use-elixir-releases\/","title":{"rendered":"Updating Hex.pm to use Elixir releases"},"content":{"rendered":"

Elixir v1.9 will ship with releases support<\/a> and in this blog post we want to show how we have used this exciting new feature on the Hex.pm project.<\/p>\n

Installing Elixir master<\/h2>\n

(Update: This section is no longer relevant since v1.9 is already out!)<\/p>\n

Since Elixir v1.9 is not out yet, we need to use the development version. Locally, my preferred approach is to use the Elixir plugin<\/a> for the asdf-vm<\/a> version manager.<\/p>\n

Here’s a couple of ways we may use asdf to install recent development versions:<\/p>\n

# install latest master\n$ asdf install elixir master\n$ asdf local elixir master\n\n# or, install particular revision:\n$ asdf install elixir ref:b8b7e5a\n$ asdf local elixir ref:b8b7e5a\n<\/code><\/pre>\n

Per “Deployment” section of mix release<\/code><\/a> documentation:<\/p>\n

A release is built on a host, a machine which contains Erlang, Elixir, and any other dependencies needed to compile your application. A release is then deployed to a target, potentially the same machine as the host, but usually separate, and often there are many targets (either multiple instances, or the release is deployed to heterogeneous environments).<\/p><\/blockquote>\n

We deploy Hex.pm using Docker containers and we needed to change our Dockerfile<\/a>. If you’re deploying using buildpacks (e.g. to Heroku or Gigalixir), it should be as simple as setting elixir_version=master<\/code> in your elixir_buildpack.config<\/code>.<\/p>\n

Setting up releases<\/h2>\n

Elixir 1.9 ships with two new Mix tasks to work with releases:<\/p>\n