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

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
mikl
I wanted to capitalize a string, and tried using String.capitalize(). That generally works well, until you try to capitalize a word like...
New
sashaafm
I’m trying to evaluate the best combo/stack for a BEAM Web app. Right now I’m exploring Yaws a bit, after having dealt with Phoenix for a...
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
ejpcmac
I have discovered Nix last month and I am currently on my way to migrating to it—both on macOS at home and the full NixOS distrubution at...
New
Ankhers
Just a little information upfront. Generally speaking, if I feel like I need to either break a pipe chain or use an anonymous function in...
New
crabonature
I’m still quite new to Elixir. As I understand we got in Elixir “multi guards” as convention to simplify one large guard with or’s?: de...
New
tmbb
This is a post to discuss the new Phoenix LiveView functionality. From Chris’s talk, it appears that they generate all HTML on the serve...
342 18146 126
New
fireproofsocks
I’ve been working on an Elixir project that has required a lot of scripting. I usually reach for Elixir because I like it more (and in th...
New
hazardfn
I suppose this question is effectively hackney vs. ibrowse but we are at a point in our project where we have to make a choice between th...
New

Other popular topics Top

9mm
I am constructing a JSON object (map) and I need to conditionally set a field. I’m trying to write proper elixir-way code… and I’m at a l...
New
Patoshizzle
After calling mix ecto.create I get this error: 17:00:32.162 [error] GenServer #PID<0.412.0> terminating ** (Postgrex.Error) FATAL...
New
ovidiubadita
Hey all, I discovered Elixir and I love it. I always wanted to learn a functional programming and I intended to go for Haskell, but afte...
New
jononomo
I am trying to figure out how Mix knows whether the environment is test, dev, or prod – where is this set? Thanks.
New
chrismccord
This release brings a number of exciting features, including integration with the new Phoenix LiveDashboard and Phoenix LiveView. There h...
New
RisingFromAshes
I’ve read in another post that it may be possible with a router helper - but I couldn’t find an appropriate one, and tbh, I’m still just ...
New
nsuchy
Hi. I’ve noticed that Windows Powershell has it’s own IEX command and you cannot access Elixir’s IEX due to the conflict. This isn’t a cr...
New
klo
Got a question about when to concat vs. prepending items to list then reversing to achieve appending. So i know lists boil down to [1 | ...
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
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

We're in Beta

About us Mission Statement