Checkpoint
[pwan.org.git] / content / hints / elixir-on-centos7.rst
1 Elixir on Centos 7
2 ##################
3
4 :date: 2017-10-08
5 :tags: hints, elixir, centos
6 :category: hints
7 :author: Jude N
8
9 I'm at the point with a Elixir/Phoneix side project that I'm thinking about deployment.
10
11 The first big stumbling block was that development envioronment (Ubuntu 16.04) wasn't the same as my deployment environment (Centos 7).
12 For Ubuntu, I could pull the latest Elixir packages from `Erlang Solutions`_, but they don't host Centos Elixir packages,
13 and the version of Elixir on EPEL is `over 4 years old`_ - old enough that 'mix deps' on my project was erroring out.
14
15 I found the posts below about installing Elixir on Centos 7 but, they involve cloning the Elixir repo and building it from source,
16 but I don't want development tools like git and gcc on my production machines.
17
18 - https://gist.github.com/binarytemple-clients/52bec05fc9bdba80d737
19 - http://www.jeramysingleton.com/install-erlang-and-elixir-on-centos-7-minimal/
20 - https://www.unixmen.com/install-erlang-elixir-centos-7/
21
22 I also found https://www.vultr.com/docs/how-to-install-the-phoenix-framework-on-centos-7 but it involves downloading a
23 precompiled `mystery meat`_ bundle off Github. However https://github.com/elixir-lang/elixir doesn't mention that these precompiled
24 bundles are available or how the bundles were built. The precompiled bundle is mentioned on `the elixir-lang.org install page`_, but still, that's too mysterious for me.
25
26 Maybe one of those links will work 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 dev machine, and then only copy the rpm up to my production machine.
27
28 It looks like Elixir is stuck in EPEL 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...
29
30 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.
31 :
32
33 .. raw:: html
34
35 <script src="https://gist.github.com/jude/1ed06603135cb47c4bb59e52e8c96af0.js"></script>
36
37 Lessons Learned
38 ---------------
39 - `spectool`_ is my new favorite utility.
40 - Make sure your Elixir development environment is as close as possible to your deployment environment.
41
42 Next Steps
43 ----------
44 - Convert the Vagrantfile into a Dockerfile or start using vagrant-lxc
45
46 .. _Erlang Solutions: https://www.erlang-solutions.com/resources/download.html
47 .. _over 4 years old: https://koji.fedoraproject.org/koji/buildinfo?buildID=552725
48 .. _the elixir-lang.org install page: https://elixir-lang.org/install.html#precompiled-package
49 .. _mystery meat: http://www.torontosun.com/2017/07/19/mystery-meat-crashes-onto-florida-familys-roof
50 .. _spectool: http://pkgbuild.sourceforge.net/spectool.html
51 .. _what I want: https://www.youtube.com/watch?v=gJLIiF15wjQ
52
53