kingdomcoder

kingdomcoder

Improvements to Elixir Deployments

Yes, Elixir is awesome.

But no, the Elixir/Phoenix deployment process is certainly not awesome :smirk: and I think it should be a cause for concern.

It might well be the lowest DevEx point in our entire process (although, you could class this as OpEx :wink:)

I’d like to know what general direction we’re heading with deployment as a community.

However, here are a few specific questions:

  1. Is it at all possible to achieve cross-platform mix releases in Elixir, akin to what’s possible with cross-platform compilation in Rust or Go? Will we always need to depend on Docker for this?

  2. Rustler precompiled has made distributing ready-to-use, cross-platform Rust NIFs a breeze. What gaps need to be filled to achieve something similar with Elixir releases?

  3. What will it take to achieve the promise of hot-code reloading – preserving in-memory state across deployments – in mix releases?
    I’m aware that hot-code reloading has some technical quirks. So, what options do we have that are practical and robust enough to be first-class components of the mix release process?

What I wish exists is some “standard” deployment process that looks like this:

  1. A GitHub release is created
  2. Mix release files are generated for all (necessary) platforms and attached to the GitHub release
  3. Running production node(s) fetch (as necessary) the mix releases and run them
  4. In-memory state is preserved when the new mix release is applied

So, is work going on anywhere in the community that I’m unaware of that can make any of these components closer to reality?

I acknowledge the contributions of Fly.io, Gigalixir and Heroku to our current deployment story. The Phoenix documentation also does and tries to provide guides for deployment on each of these providers.

However, I think we will benefit greatly from a robust, vendor-agnostic deployment story with mix releases and I wonder what’s happening with this.

Most Liked

josevalim

josevalim

Creator of Elixir

Hi @kingdomcoder!

I am trying to understand what are the benefits you are going after. I understand there are benefits of not having to rely on Docker and toolchains like Zig can bring us closer to cross-compilation but at the same time you seem to be asking for features that are not generally useful:

  1. I can’t think of why server companies would need to cross-compile to multiple platforms and, if I am deploying to prod, I would rather build and test on machines as close as possible to production

  2. I still think chasing hot-code upgrades is of little benefit to 99.9% of the companies and definitely should not be part of the “standard” deployment process (at least it should be opt-in)

There are benefits to cross-compilation, mostly for distributable Elixir apps such as CLI and for desktop, and projects like Burrito and Elixir Desktop are trying to provide answers here.

The point here is: deployment is a wide area and I think we should be specific which problems we are trying to solve and for which domain, especially because the solutions will change (and to avoid scope creep!)

However, I think we will benefit greatly from a robust, vendor-agnostic deployment story with mix releases and I wonder what’s happening with this.

Unfortunately, as much as I resisted to the idea, the answer to this is Docker, because outside of it there is no unified pipeline. We could tell people: hey, this is a script to build a release and this is a script to download and run it, but it doesn’t change the fact that getting those scripts to run on each different CI and each different provider is going to be different… unless you use Docker.

My understanding is that those deploying Go/Rust apps to servers are on a similar boat: Docker is coordinating the building and the running.

LostKobrakai

LostKobrakai

The images built by hex include OTP, elixir and OS version on their tags.

schneebyte

schneebyte

There was a discussion in the build and packaging wg a while ago.

Also an interesting blog post with a proof of concept (with docker/containers):

Where Next?

Popular in Questions Top

pmjoe
I have a relationship of love and hate with Elixir. Lots of things are just absolutely right, but there are some things that are kind of ...
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
ycv005
I have followed this StackOverflow post to install the specific version of Erlang. And When I am running mix ecto.setup then getting fol...
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
freewebwithme
Using vs code and installed ElixirLS: support and debugger. And I got an error popped up on start up says Failed to run ‘elixir’ comma...
New
makeitrein
Hey all, just started picking up Elixir last week and am writing a scraper as a learning project. Baby step #1 is extracting the number ...
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
johnnyicon
Hi all, I've just started learning Elixir and Phoenix Framework, so please pardon my n00bness at this stage. I'm trying to use Postg...
New
WestKeys
Currently suffering from paralysis by [HTTP client] analysis. This is rather unusual in Elixirland as there tends to be consensus on the ...
New
jc00ke
Expanding on this topic: https://forum.elixirforum.net/t/map-typespec-question/19217 Let’s say I have a map with required and optional k...
New

Other popular topics Top

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 30048 115
New
shahryarjb
Hello, I get Persian date from my client and convert it to normal calendar like this: def jalali_string_to_miladi_english_number(persi...
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
joaquinalcerro
Hi there, I am working with Ecto-Postgresql and I need to call all of the records from a specific table but the table has 40,000 record...
New
itssasanka
Hi all, Trying to get some more clarity over utc_datetime and naive_datetime for Ecto: https://hexdocs.pm/ecto/Ecto.Schema.html#module-...
New
vertexbuffer
Hello, can anybody help here..? I have a list of players and I what to delete an element, but every for loop the list is reverting to ori...
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
freewebwithme
Using vs code and installed ElixirLS: support and debugger. And I got an error popped up on start up says Failed to run ‘elixir’ comma...
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
AstonJ
by Lance Halvorsen Elixir and Phoenix are generating tremendous excitement as an unbeatable platform for building modern web application...
460 27162 124
New

We're in Beta

About us Mission Statement