Rebar3 release/upgrade problems: ERROR: release_handler:install_release failed: {enoent

I’m trying to work out how the upgrade process works in Erlang so that we can decide when/how we should be doing live updates on some of our deployments, but I run into problems using the generated release tarballs for upgrades.

I’m working from a simple repo just to demonstrate and document how this works https://github.com/BiggestLab/live_update/tree/main/elixir. I can use rebar3 as prod tar to create the v1 tarball, and it runs fine using ./bin/luex foreground (luex is Live Update EXample).

I create the v2 just fine and copying it into the releases directory works as it unpacks, but I always get this error:

$ ./bin/luex upgrade 2.0.0
Release 2.0.0 not found, attempting to unpack releases/luex-2.0.0.tar.gz
Unpacked successfully: "2.0.0"
ERROR: release_handler:install_release failed: {enoent,
                                                "/tmp/luex/releases/1.0.0/relup"}

From what I understand of the process it doesn’t make sense to me that it’s looking for a relup file for 1.0.0 (and the console says it can’t find the optional relup file for 2.0.0). How can we get a relup file for the 1.0.0 release when we don’t know what will be in the next version?

Presumably I’m doing something daft, but having read through a ton of documentation and tried a ton of things I can’t get anything except this error.

Edit to add: Full details of the process I would expect to work are listed in the repo together with the code

1 Like

I have no time to look into your example right now, but FWIW, I’ve published an example project with upgrade docs a while ago. Maybe you can figure out a missing piece from there?

2 Likes

You might want to check out GitHub - thiagoesteves/jellyfish: This library facilitates the creation and management of appup files and releases for Elixir applications, enabling seamless hot upgrades. for hot code upgrades.

Since you mentioned deployments, you may also be interested in GitHub - thiagoesteves/deployex: The ideal project to supervise your Elixir/Erlang/Gleam application

I’ve raised the question about the generation of relup specifications as a Day 1 or Day 2 operation in this thread:

As part of the solution to the Day 1 approach I submitted pull request #8973 which includes all available appup specifications in a release package.

1 Like

Thanks. With that rebar3 plugin you use and the extra commands I’ve gotten a working live upgrade. I’ve documented it all here: live_update/erlang at main · BiggestLab/live_update · GitHub which hopefully should be a nice easy to follow minimal example.

Next would be a v3 that upgrades the gen server in such a way that it requires a state migration. I’ve seen some hints at a gen server call back that’s meant to do this, but it might be a few weeks before I get a chance to look at it and manage to get something that works.

Thanks I am interested in Elixir, but we’re primarily using that for Phoenix/LiveView stuff right now, and we can tell from the dev environments that live updates there are likely to break live view pages that are currently in use so we may stick to something more traditional.

@vances I think it’s a bit sad that the rebar3 release stuff doesn’t actually work, and that the documentation for how to use it tells you to read the source of a rebar3 plugin that also doesn’t seem to work.