Virtualization for Phoenix

As for me, the Docker and containers aren’t really needed that much in Erlang/Elixir deployments. You can achieve simpler and easier to manage deployment via UNIX VMs (Linux/BDS, doesn’t really matter) with proper usage of init system (runit, OpenRC, systemd, SysV, launchd, whatever). Just build release using mix release and then run it on target machine using proper init file. If you want to have auto scaling or automatic healing, then use AWS ASG or similar solution from your cloud provider, and it will be much easier, with less indirection and (mostly needless) abstraction. Especially with systemd you can achieve almost all of that with proper set of options.

Whenever I see this kind of feedback (“You won’t need docker for Elixir - use release”) - then I’d say it shouldn’t matter.

Elixir release is a way to run an instance of your application. It’s built-in and easy to use, I agree, but it’s orthogonal how to actually deploy the application. Whether it runs right on bare-metal, VMs, or inside container… it’s just at the different level.

I believe the “container-native” gives a set of pretty good challenges even not within container world - such as removing root user permissions and privileged ports, avoiding using extra process (epmd…), etc. (I’m not saying the current container way is the right solution)

Honestly, if there is at least one app not in Elixir, different questions should be asked: why should I run a release directly on vm? Do I really need it? :slight_smile:

My team is using Elixir in k8s, and some apps using libcluster to make erlang clusters between containers in k8s.


For original author @mauric

You don’t need to use Docker for local dev. Start with asdf.

You don’t need to use Docker for deployment. If you want, then as @wmnnd said, get familiar with release first and then dockerize it.

  1. Learn how to build and run the app, from fresh code checkout at local dev (Elixir specific)
  2. Learn how to use mix release at local dev (Elixir specific)
  3. Learn how to reproduce the steps in Docker (Docker specific)

Note that even you don’t use docker, you should use mix release anyway (the first two steps)

2 Likes