[erlang-questions] Deploying forked Erlang releases?

Roger Lipscombe roger@REDACTED
Thu Sep 10 11:14:03 CEST 2015


On 9 September 2015 at 15:10, Tristan Sloughter <t@REDACTED> wrote:
> relx (which rebar3 uses and can be used standalone) generates a useful start
> script (set {extended_start_script, true} in the config of your project)
> with options for starting, stopping, getting a remote console, upgrading the
> release, and more.

We're already using relx, so I just added the {include_erts, true} option.

Next, to get the correct OTP build onto the build host, I added the
following to the top of our Jenkins script:

OTP_VERSION=$(cat .otp-version)
KERL=./kerl

# Is that installed somewhere?
OTP_INSTALLATION=$($KERL list installations | grep "^$OTP_VERSION " |
cut -d' ' -f2)
if [ ! -s "$OTP_INSTALLATION/activate" ] ; then
    echo "Error: No OTP $OTP_VERSION installation; installing it using kerl..."

    if ! ( $KERL list builds | grep -q "^git,${OTP_VERSION}\$" ) ; then
        echo "Error: No OTP $OTP_VERSION build; building it using kerl..."

        # $OTP_VERSION is the tag in git and is used as the name of the build:
        $KERL build git https://github.com/electricimp/otp.git
$OTP_VERSION $OTP_VERSION
    fi

    $KERL install $OTP_VERSION $HOME/erlang/$OTP_VERSION
    OTP_INSTALLATION=$HOME/erlang/$OTP_VERSION
fi

. $OTP_INSTALLATION/activate

It slows down the build the first time that it's built on a new
Jenkins slave, but you can short-cut that by having chef pre-install
the relevant Erlang/OTP version beforehand if you want.

We also use direnv for individual developer machines; the .envrc looks
like this:

OTP_VERSION=$(cat .otp-version)

if has kerl; then
    OTP_INSTALLATION=$(kerl list installations | grep "^$OTP_VERSION "
| cut -d' ' -f2)
    if [ -s "$OTP_INSTALLATION/activate" ] ; then
        echo "Using Erlang/OTP $OTP_VERSION (in $OTP_INSTALLATION) via kerl."
        . $OTP_INSTALLATION/activate

        export OTP_ROOT=$OTP_INSTALLATION
        export OTP_VERSION
    else
        echo "Erlang/OTP $OTP_VERSION not available via kerl; using default."
    fi
else
    echo "kerl not available; using default Erlang."
fi

...and we expect that developers have the correct Erlang/OTP installed
using kerl, in an appropriate place.



More information about the erlang-questions mailing list