Wednesday 15 July 2020

Compile Erlang using Kerl with crypto module

When working with erlang, we can use old version to run our erlang app which are not yet upgraded.

This multiple erlang version run like python env if you come from python.

So in erlang we using Kerl which can switch to multiple erlang version at runtime. So here we go.

We are using Debian 10.x buster. Some prerequisite before able to finish are install the dev tools.

# apt-get install build-essential autoconf libncurses5-dev openssl libssl-dev fop xsltproc unixodbc-dev libz-dev

Then get the openssl version supported on your erlang version. Here i use 17.5.x release which require openssl-1.0.xx to compile properly with crypto module.



1 $ git clone git@github.com:openssl/openssl.git --branch OpenSSL_1_0_2-stable
2 $ cd openssl
3 $ mkdir __result
4 $ ./config --prefix="${HOME}/openssl" shared zlib -fPIC
5 $ make depend
6 $ make
7 $ make install INSTALL_PREFIX="/home/me/openssl/__result"


Then we can start the kerl compilation.

Get the kerl 

1 $ curl -0 https://raw.githubusercontent.com/kerl/kerl/master/kerl
2 $ chmod a+x kerl

Make the ssl available for kerl compiler

1 $ export KERL_CONFIGURE_OPTIONS="--with-ssl=/home/me/openssl-OpenSSL_1_0_2-stable/__result/home/me/openssl-OpenSSL_1_0_2-stable/openssl/"

2 $ mkdir .kerl
3 $ kerl build 17.5.3 17.5.3

This should be show which indicate SSL included.







 



Then continue with installation:

$ kerl install 17.5.3 ~/.kerl/17.5.3

To test run erlang.

$ . ~/.kerl/17.5.3/activate
$ erl
> crypto:start().

Should no error if install successfully.

And make that fault tolerant app with 0 downtime.


0 comments:

Post a Comment

Twitter Delicious Facebook Digg Stumbleupon Favorites More