Elixir on Centos 7
I'm at the point with a Elixir/Phoneix side project that I'm thinking about deployment.
The first big stumbling block was that development environment (Ubuntu 16.04) wasn't the same as my deployment environment (Centos 7). For Ubuntu, I could pull the latest Elixir packages from Erlang Solutions, but they don't host Centos Elixir packages, and the version of Elixir on EPEL is over 4 years old - old enough that 'mix deps' on my project was erroring out.
I found the posts below about installing Elixir on Centos 7 but, they involve cloning the Elixir repo and building it from source, but I don't want development tools like git and gcc on my production machines.
- https://gist.github.com/binarytemple-clients/52bec05fc9bdba80d737
- http://www.jeramysingleton.com/install-erlang-and-elixir-on-centos-7-minimal/
- https://www.unixmen.com/install-erlang-elixir-centos-7/
I also found https://www.vultr.com/docs/how-to-install-the-phoenix-framework-on-centos-7 but it involves downloading a precompiled mystery meat bundle off GitHub. The https://github.com/elixir-lang/elixir site doesn't mention that these precompiled bundles are available or explain how to rebuild the bundles. The elixir-lang.org install page mentioned the precompiled bundle, but still, that's too mysterious for me.
Maybe one of those links works for you, but what I want is a way to build a more recent version of the Elixir rpm than what was available in EPEL. That way I can recompile and package Elixir on a development machine, and then only copy the rpm up to my production machine.
It looks like Elixir in EPEL is waiting for the Erlang 18 release to get promoted in EPEL, so maybe I can take the existing Elixir packaging source and build it against the latest Erlang packages from Erlang Solutions.
I found the packaging source at https://src.fedoraproject.org/rpms/elixir and after poking around a bit I came up with Vagrantfile below. It seems to be working OK so far. :
<script src="https://gist.github.com/jude/1ed06603135cb47c4bb59e52e8c96af0.js"></script>
Lessons learned
- spectool is my new favorite utility.
- Make sure your Elixir development environment is as close as possible to your deployment environment.
Next steps
- Convert the Vagrantfile into a Dockerfile or start using vagrant-lxc