I’m learning Elixir at the moment, and I have a project where some of the Erlang/Elixir strengths would be very useful, specifically the robustness and fault-tolerance. But this project also has some requirements that I fear hit some weaker points of Elixir, the deployment.
What I’d need is to be able to deploy the Elixir project on Linux and Windows, with the additional challenge that older versions of both need to be supported. At least Windows XP and CentOS 5 would have to work. I know that those are either out of support yet, or shortly will be, but this requirement is unavoidable in this case.
I’ve looked at Distillery and exrm, and the former does not support Windows at all as far as I can tell, and my impression is that for exrm it still is less well supported than Linux. So I’m wondering if there are actually many people using Elixir/Erlang on Windows, and how well it works?
The second issue for me is that the deployment needs to be self-contained and easy to execute in the end. So ideally I’d create a self-contained directory that just has to be copied onto the target computer and a small script that adds it to the OS-specific service configuration. Someone that doesn’t know about Elixir should be able to install the final product. From what I learned about exrm, this should be possible.
My impression is that everything I ask for is generally possible, but not very common. So I’m asking for some advice on whether I’m trying to do something foolish and this might not be the best use case for Elixir, or reassurance that it actually is possible and should work well.
Windows support is available on the win32 branch of the Distillery repository - I’m going to be releasing it in the next minor version, sometime in the next 2 weeks, but if you want to play with it in the meantime, that’s where you can find it.
Both distillery/exrm work as self-contained releases, you just need to make sure you build the release on the same OS/architecture, using Vagrant or Docker is recommended for that.
The build systems should match the target as closely as possible - while you may be able to get a release to work across different distros on x64, I would recommend just making sure you have a build machine which matches your prod environment.
There is no OS independence per-se: you can rely on a system ERTS being installed, you can also include a cross-compiled ERTS, but if the release was compiled with a different major version of Erlang, it will fail to boot; if you have any NIFs, or dependencies which use NIFs, those are not portable across architectures, and the release will fail to boot.
The most pain-free setup is to run your builds in Docker/Vagrant as I suggested previously, matching your prod environment as best you can. This can be automated easily, as can deploys of those builds, and works great in my experience.