rogach

rogach

What is the current approach to doing hot code reloading?

I’m trying to use hot code reloading in my app. The app in question is deployed using mix releases.

As I understand it, there was once a project called Distillery, but it is now dead - most of functionality was merged into mix release. Howerver, the hot code reloading support didn’t survive the migration - according to the docs Distillery was capable of generating appup files, but now I failed to find any tools that could do anything like that. Seems that the only remaining route is to write the appups myself.

Are there any known tools that simplify the task of writing appup files? Or does everyone write the appup files by hand?

P.S. By the way, I’ve read about and am aware of many issues and pitfalls that await unlucky souls that are going down the hot code reload path. But in my particular case, the application is maintaining a significant number of stateful connections, and it will be very nice if these connections can be preserved, if possible. And the upgrades aren’t expected to be very difficult - most of the processes are using GenServers, state is kept in maps, etc.
I understand that many suggest using blue/green deployments and docker and whatever, but I think that there’s some middle ground to be had - I can always go the blue/green road if some particular upgrade is difficult to do with hot reloading, but in most of simpler cases I can save lots of pain by simply loading the updated modules.
As someone said, “there’s a distinction between relying on hot deploys and simply enjoying them”.

Most Liked

rogach

rogach

Here’s what I ended up with: How to: Tweak mix release to work with hot code reloading

Don’t hesitate to ask questions if I forgot to detail something :slight_smile:

ausimian

ausimian

There is castle previously announced here. It does integrate with mix releases, but does not do appup generation.

rogach

rogach

In the end I decided to skip the castle - just inserted an additional step intomix release and used :release_handler directly.

However, castle code was very useful for understanding what tweaks were needed - thanks for releasing it!

shankardevy

shankardevy

@rogach can you please share your config ? I might need it as well for one of my projects and would like to see your implementation. Thanks

Where Next?

Popular in Questions Top

gshaw
What is the idiomatic way of matching for not nil in Elixir? E.g., First way: defp halt_if_not_signed_in(conn, signed_in_account) when...
New
yawaramin
In the Dialyzer docs ( http://erlang.org/doc/man/dialyzer.html#requesting-or-suppressing-warnings-in-source-files ), there is a way to tu...
New
albydarned
Hello all! I am typing this post from my new MacBook Pro with the M1 chip. I’m loving it so far, and will probably use it as my daily dr...
New
openscript
Hello! Sorry for this astonishing simple question, but I’m really stuck. I try to set up the intellij-elixir plugin, but I don’t know ho...
New
vac
Hi, I'm quite new in Elixir and I'm trying to format a string to a PEM format. I have the certificate value like MIIDBTCCAe2...... and ...
New
shahryarjb
Hello, I have map which I want to convert it to string like this: the map: %{last_name: "tavakkoli", name: "shahryar"} the string I ne...
New
chrisalley
ExUnit now has describe blocks which is a welcome addition coming from RSpec. In the docs, it states that nested hierarchies of describe ...
New
hpopp
To simplify some tasks at work, I wrote and published this package yesterday. It’s a simple macro that enables Access behaviour on struct...
New
belgoros
I’m not a pro in using Regex and can’t figure out why the following behaviour happens, especially if we take into account the difference ...
New
sabri
Can someone explain the settings of pool_size of Ecto in config file? and what is the recommend size? Thanks
New

Other popular topics Top

bsollish-terakeet
Credo is smart enough to check for (something like) this: assert length(the_list) == 0 with this response: Checking if an enum is empt...
New
albydarned
Hello all! I am typing this post from my new MacBook Pro with the M1 chip. I’m loving it so far, and will probably use it as my daily dr...
New
polypush135
As many of you may have realized by now (sorry for all the posts here) I’ve been working on a db problem where I’m trying to aggregate a ...
New
stefanchrobot
What’s the safe way to decode a JSON string into a struct? I want to avoid calling String.to_atom. Jason.decode can give me a map with st...
New
aadeshere1
I have a another noob question about loop. Since elixir is immutable, while loop is not directly possible. total = 10 while total != 0 ...
New
chensan
I have a User schema with a :from_id field set to type :string: defmodule TweetBot.Repo.Migrations.CreateUsers do use Ecto.Migration ...
New
qwerescape
Is there a way to get the call stack or stack trace at any point in the code? Not from exceptions, but an expression that returns how the...
New
josevalim
Hi everyone, One of the features added to Elixir early on to help integration with Erlang code was the idea of overridable function defi...
New
vrod
I am using the Starship cross-shell prompt – it seems pretty nice, but I get some errors: [WARN] - (starship::utils): Executing command ...
New
lanycrost
Hi everyone! I need implement if…else if…else condition from my elixir code, and anymore of this control flow structures not work proper...
New

We're in Beta

About us Mission Statement