Creating OTP Releases

If you're going to be running an LFE application in production, you will very likely want to do so using the "release" functionality provided by OTP.

Create a release-based project with:

rebar3 new lfe-release prod-lfe
===> Writing prod-lfe/
===> Writing prod-lfe/LICENSE
===> Writing prod-lfe/rebar.config
===> Writing prod-lfe/.gitignore
===> Writing prod-lfe/apps/prod-lfe/src/prod-lfe.lfe
===> Writing prod-lfe/apps/prod-lfe/src/prod-lfe-app.lfe
===> Writing prod-lfe/apps/prod-lfe/src/prod-lfe-sup.lfe
===> Writing prod-lfe/apps/prod-lfe/src/
===> Writing prod-lfe/config/sys.config
===> Writing prod-lfe/config/vm.args

Start up the application:

rebar3 lfe run-release start

Check the status of the application:

rebar3 lfe run-release ping

Known Issue!

If your ping doesn't get a pong after starting the release, this is a known issue that is being investigated in the following ticket:


The current workaround for a relese that doesn't start is simply to run the following again:

rebar3 release
rebar3 lfe run-release start
rebar3 lfe run-release ping

In addition to using the LFE rebar3 commands to start the application, you can start up a release console and then switch to the LFE REPL.

Start the console:

./_build/default/rel/prod-lfe/bin/prod-lfe console
Eshell V11.0  (abort with ^G)
(prod-app@spacemac)1> lfe_shell:start().
(prod-app@spacemac)lfe> (erlang:whereis 'prod-lfe-sup)
(prod-app@spacemac)lfe> (prod-lfe:echo "testing from production!")
"testing from production!"