fireproofsocks

fireproofsocks

Deploying Elixir/Erlang with or without Docker? Why or why not?

I wanted to solicit the educated opinions of the forum-folk when it comes to the deployment of Elixir apps. Is using Docker in the deployment (and/or in the development) of Elixir apps idiomatic? When so many deployments for different technologies rely on containers of some sort, some SysAdmins/DevOps people push for a Dockerize-able application as the de facto standard for any deployment scenario. Most DevOps people I’ve interacted with are very much coming from the “Cattle” side in the “Pets vs. Cattle” analogy where containers are thought of as disposable entities. However, with Elixir, I haven’t had as much use for Docker as I have when working with other languages, and I am wondering if this is a fluke or indicative of the inherent nature of Elixir/Erlang? I have rarely had to snuff out a running Elixir app – the adage of “write once, run forever” really has held true from my experience, but this doesn’t seem to be something DevOps people expect or even want.

The pros for deploying with Docker is that it represents a “package format” that is more standard – the DevOps guys wouldn’t need to think much about what’s inside an image.

The cons would be the hits to performance. Elixir/Erlang is already running inside a VM, so it seems redundant and a hit to performance to containerize a container. (I know has been especially true for development).

What are others seeing out there? Are Dockerized Elixir deployments common and/or appropriate? And why, or why not?

Thanks for your thoughts.

Related post:

Most Liked

stefanchrobot

stefanchrobot

I use Docker for all of my personal projects and enjoy its usage at work. It provides a convenient layer of abstraction for packaging and running your application. If you use it and configure your app via ENV vars, then you can pretty much move between cloud providers in an instant (assuming there is no other vendor lock in).

I would advise for using Docker paired with mix release. I’d say that most of the time zero-downtime deployments are enough and you’d do hot-code upgrades when you really, really need it.

RudManusachi

RudManusachi

Probably on MacOS, as it requires virtualization (and may be Windows, not sure about WSL.. never tried), but on linux it should be just a tiny layer on top of the host system. So I would not rush prioritizing performance, as long as the server is running on linux, when comparing deployment options.

Running in a container with all its best practices while provides benefits, it discourages “hot code swapping”, at least, because if container gets restarted - it will run the previous version of the application.
For example, distillery provides with tools that help with hot upgrades and downgrades and could be used in combination with edeliver. It kinda reminded me of Capistrano for Ruby apps.

However, in elixir’s docs there is a separate section explaining why that functionality is not included with regular mix release

The reason we don’t provide hot code upgrades is because they are very complicated to perform in practice, as they require careful coding of your processes and applications as well as extensive testing. Given most teams can use other techniques that are language agnostic to upgrade their systems, such as Blue/Green deployments, Canary deployments, Rolling deployments, and others, hot upgrades are rarely a viable option. Let’s understand why.

(read more here)

All in all if we don’t want to do hot upgrades I would describe the deployment as, we gotta:

  1. somewhere somehow build the release
  2. somehow deliver that release to the production server
  3. run it there

Using docker/contrainers is probably the most popular option out there today.
Some PaaS, such as Heroku, Gigalixir, Fly.io etc. provide with tools that help to do that, though some of them probably still will run your app in container (fly.io does, for sure)

csadewa

csadewa

At job, we used docker for elixir deployment and running pull request test. No real performance issue coming from docker so far. And it really help to be able to standardize from a single dockerfile about testing/deployment so no issue like it passed on test but not on deployment.

Where Next?

Popular in Discussions Top

scouten
I’m looking for a host for the server part of a small (personal) side project that I’m working on. It’s currently written in Node.js and ...
New
Qqwy
I would like to spark a discussion about the static access operator: .. For whom does not know: it is used in Elixir to access fields of...
New
andre1sk
A big advantage to Elixir is all the distributed goodness but for many applications running on multiple nodes having integrated Etcd, Zoo...
New
pillaiindu
In django there is a cache framework backed by memcached. Rails also puts a lot of emphasis on caching, and even the idea of russian-doll...
New
pdgonzalez872
If this has been asked here before, please point me to where it was asked as I didn’t find it when I searched the forum. Maybe a mailing ...
New
nburkley
AWS re:Invent is on at the moment with some interesting announcements. One new feature in particular is the Lambda Runtime API for AWS La...
New
gausby
I asked this very same question on twitter and got some interesting feedback, but I thought it would be a good question to ask here as we...
1207 39297 209
New
Nvim
Anybody knows a comprehensive comparison of Django and Phoenix, thanks for the help. Where are they similar? Where do they differ the m...
New
marciol
Please, let me know if this kind of discussion already took place in another topic . Hi all, how do you consider if is better to build ...
New
matthias_toepp
I’d love to hear what people think about Wisp, the new Gleam web framework started by Gleam’s primary creator Louis Pilfold. Gleam, alon...
New

Other popular topics Top

vonH
When I run the Plug and I recompile I wind up having to use Ctrl C to quit iex and start again. Witht the help of rlwrap I can use the cu...
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
boundedvariable
I am going through the kafka architecture. All the features what the kafka is providing are already in Erlang. I would like hear your opi...
New
dogweather
I wrote this comment on r/haskell, and it’s not popular there. :wink: But I think I’m on to something… Haskell reminds me of Java, and e...
New
fireproofsocks
Forgive me if this is obvious, but how does one delete a database record WITHOUT selecting it first? Ecto.Repo — Ecto v3.14.0 has exampl...
New
komlanvi
Hi everyone, I was playing with phoenix liveView but I run into an issue. I have a form and want to validate each input text when the te...
New
Nvim
Anybody knows a comprehensive comparison of Django and Phoenix, thanks for the help. Where are they similar? Where do they differ the m...
New
stefanluptak
Hello everybody, usually, I use a 29" ultra-wide monitor for VSCode which can easily accomodate explorer (files panel) + file with code ...
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
fayddelight
I tried installing elixir 1.11.2 erlang 23.3.4 via asdf in my zsh shell. Enabled the versions locally and globally. When I list them ...
New

We're in Beta

About us Mission Statement