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!

Where Next?

Popular in Questions Top

JeremM34
Hello, how can I check the Phoenix version ? Thanks !
New
minhajuddin
I have seen a lot of code which picks the first element from a list using Enum.at(0) instead of List.first. Is there a reason why people ...
New
hariharasudhan94
Lets say I have map like this fetching from my database %{"_id" => #BSON.ObjectId<58eb1a7a9ad169198c3dXXXX>, "email" => ...
New
hariharasudhan94
lets say i have a sample like a = 20; b = 10; if (a > b) do {:ok, "a"} end if (a < b) do {:ok, b} end if (a == b) do {:ok, "equa...
New
jononomo
For some reason my phoenix channels are working for me in my local dev environment, but as soon as I deploy via Docker, I get a 403 error...
New
alice
Hey, Just curious what are the main benefits of Elixir compared to Clojure? When is Elixir more useful than Clojure and vice versa? Th...
New
marius95
Hello everyone, I try to use an Javascript Event Handler in my root.html.leex file. Therefore I created a function in the app.js file: ...
New

Other popular topics Top

New
JakeBecker
TL;DR: I’ve just released an implementation of Microsoft’s IDE-independent Language Server Protocol for Elixir. It adds language support ...
1144 54921 245
New
chrismccord
Phoenix 1.4.0 released Phoenix 1.4 is out! This release ships with exciting new features, most notably with HTTP2 support, improved deve...
688 31494 112
New
AngeloChecked
What learn first? Rust or Elixir Hi Elixir community! I’m here because i want learn a new language. I’m a junior developer and mainly i ...
New
Harrisonl
We have an ECS cluster with 4 services, where each task joins a single cluster, via discovery ECS discovery service. Currently when I de...
New
jason.o
In the code below, if the create action is not set to accept “extra_key” as an input, it errors out with a message shown above. Is there ...
New

We're in Beta

About us Mission Statement