Elixir & Erlang installation in production

I want to know is there any preference in installing elixir with precompiled packages or compiling it from source in production environment?
Also, as latest precompiled elixir (1.8.1) is compiled using OTP 20 so what is the recommended version of OTP that should be installed (OTP 20 or OTP 21) if using precompiled elixir?

For production I prefer to build releases using distillery with embedded ERTS.

Not installing anything elixir or erlang related on the production host.

Only thing that needs to be installed are libraries that your packages or their dependencies have a NIF linked against.

And with upcoming elixir 1.9s new release task which is similar to what distillery does today as far as I understood it, I think doing proper releases is the most prefered solution in the community.

4 Likes

I am using edeliver to build and deploy. I meant above question for build machine. Currently we have installed precompiled elixir 1.6.5 and OTP 20 on build machine. We are upgrading elixir to 1.8.1 so wanted to know what is the preferred way to do it.

also can you please explain (or redirect me to some resource which explains) “Only thing that needs to be installed are libraries that your packages or their dependencies have a NIF linked against.” I didn’t understand this line.

Use the versions that suite your business needs. Always try to have the elixir that was compiled with the OTP version you use, either compile manually or use precompiled versions from bob.

But sometimes you have no choice and you have to deal with whatever is available in the operating systems default repository, thats a restriction I have to deal with very often.

Well, if you have a NIF implemented on your own or somewhere burried in your dependencies, that uses something in a system library. Then of course you need to install that library on the target host.

To ensure calling compatibitly it is an often heard advice to have the compiling host to have the same operating system and update status than the target host.

To avoid many of this stuff, I usually build and run inside alpine docker images.

2 Likes

Got it. Thanks for the help.

NIF is basically a native code (compiled to a .dll on Windows or .so on Linux/macOS). People code them in C, C++, Rust etc. They are used for performance-sensitive tasks, like encryption or compression.

2 Likes