veimis

veimis

Programming Elixir 1.6 - Distillery-The Elixir Release Manager chapter commands for Elixir 1.9/Distillery 2.1

I hope this will prove useful for other readers of the book.

I was working through chapter 20 OTP: Applications and run to issues with the example for creating a release using Distillery.

The command mix release --env=prod failed with an error like

** (Mix) Could not invoke task “release”: 1 error found!
–env : Unknown option

Since Elixir 1.9 brings releases directly into Elixir, the mix release -command previously used with distillery now overlaps with the Elixir release command.
Distillery version 2.1 works with Elixir 1.9 and updates the distillery release command to mix distillery.release.

I made the following changes to be able to locally follow the distillery release example in the book.

Elixir and OTP versions used:

$ elixir --version
Erlang/OTP 23 [erts-11.0.2] [source] [64-bit] [smp:4:4] [ds:4:4:10] [async-threads:1] [hipe]

Elixir 1.10.4 (compiled with Erlang/OTP 22)

I don’t have relevant pages as my kindle only shows “locations”, but I have included the section topics.

Section “Your First Release”

1 Change dependency to distillery 2.1 in mix.exs
:x: {:distillery, “~> 1.5”, runtime: false}
:white_check_mark: {:distillery, “~> 2.1”, runtime: false}

2 Use the updated command for initializing the release
:x: mix release.init
:white_check_mark: mix distillery.init

3 Create the first release (0.0.1)
:x: mix release --env=prod
:white_check_mark: MIX_ENV=prod mix distillery.release --env=prod

This first failed for me (after following the book example) with

Release failed: could not load /path/config/config.exs

I got around it by adding a minimal config.exs file
mkdir config && echo “import Config” > config/config.exs

Side note:
In the book the deploy commands are run with ssh.
I tried, instead, to run the deploy commands directly from the _build -directory and found out that consecutive releases don’t work properly that way.

“I only just noticed that the original issue confirms that this issue was occurring because of running from _build.”
Successive hot upgrade releases produce error · Issue #160 · bitwalker/distillery · GitHub

This might be documented on the distillery documentation, but I haven’t made it there yet.

Section “A Second Release”

4 Create the first upgrade release (0.2.0)
:x: mix release --env=prod --upgrade
:white_check_mark: MIX_ENV=prod mix distillery.release --env=prod --upgrade

5 Upgrade running code
This might be because I didn’t use ssh, but instead just copied the archives to separate directory,
but the command deploy/bin/sequence upgrade 0.2.0 failed with

Node user@host is not running!

To successfully run the upgrade I changed the following:
Update node name, -name argument, in rel/vm.args with the right node name. You can check the node name in the iex console with Node.self command.
Not sure if relevant, but I updated the set cookie option (environment :prod) in rel/config.exs with the value in ~/.erlang.cookie

Section “Migrating Server State”
6. Create the second release
:x: mix release --env=prod --upgrade
:white_check_mark: MIX_ENV=prod mix distillery.release --env=prod --upgrade

That did it for me :relaxed:

Popular Prag Prog topics Top

Razor54672
The answer to 3rd Problem of Chapter 5 (Making Choices) of “Practical Programming, Third Edition” seems incorrect in the given answer ke...
New
simonpeter
When I try the command to create a pair of migration files I get an error. user=> (create-migration "guestbook") Execution error (Ill...
New
mikecargal
Title: Hands-on Rust: question about get_component (page 295) (feel free to respond. “You dug you’re own hole… good luck”) I have somet...
New
conradwt
First, the code resources: Page 237: rumbl_umbrella/apps/rumbl/mix.exs Note: That this file is missing. Page 238: rumbl_umbrella/app...
New
cro
I am working on the “Your Turn” for chapter one and building out the restart button talked about on page 27. It recommends looking into ...
New
leba0495
Hello! Thanks for the great book. I was attempting the Trie (chap 17) exercises and for number 4 the solution provided for the autocorre...
New
jskubick
I’m under the impression that when the reader gets to page 136 (“View Data with the Database Inspector”), the code SHOULD be able to buil...
New
creminology
Skimming ahead, much of the following is explained in Chapter 3, but new readers (like me!) will hit a roadblock in Chapter 2 with their ...
New
jwandekoken
Book: Programming Phoenix LiveView, page 142 (157/378), file lib/pento_web/live/product_live/form_component.ex, in the function below: d...
New
roadbike
From page 13: On Python 3.7, you can install the libraries with pip by running these commands inside a Python venv using Visual Studio ...
New

Other popular topics Top

ohm
Which, if any, games do you play? On what platform? I just bought (and completed) Minecraft Dungeons for my Nintendo Switch. Other than ...
New
DevotionGeo
I know that these benchmarks might not be the exact picture of real-world scenario, but still I expect a Rust web framework performing a ...
New
siddhant3030
I’m thinking of buying a monitor that I can rotate to use as a vertical monitor? Also, I want to know if someone is using it for program...
New
New
dimitarvp
Small essay with thoughts on macOS vs. Linux: I know @Exadra37 is just waiting around the corner to scream at me “I TOLD YOU SO!!!” but I...
New
AstonJ
Seems like a lot of people caught it - just wondered whether any of you did? As far as I know I didn’t, but it wouldn’t surprise me if I...
New
mafinar
Crystal recently reached version 1. I had been following it for awhile but never got to really learn it. Most languages I picked up out o...
New
gagan7995
API 4 Path: /user/following/ Method: GET Description: Returns the list of all names of people whom the user follows Response [ { ...
New
CommunityNews
A Brief Review of the Minisforum V3 AMD Tablet. Update: I have created an awesome-minisforum-v3 GitHub repository to list information fo...
New
AstonJ
If you’re getting errors like this: psql: error: connection to server on socket “/tmp/.s.PGSQL.5432” failed: No such file or directory ...
New

Latest in PragProg

View all threads ❯