Skip to content
This repository

Release Handling

Introducing reltool.config

Rebar produces the reltool.config configuration file in response to performing the create-node command. The reltool.config contains configuration information consumed by rebar, and Reltool (the release management tool introduced in the Erlang R13B distribution).

Create the application:

~ $ mkdir exemplar

If you're using R15B01 or newer

~/exemplar $ rebar create-app appid=exemplar

else (R15B or older)

~/exemplar $ mkdir -p apps/exemplar
~/exemplar $ cd apps/exemplar
~/exemplar $ rebar create-app appid=exemplar
~/exemplar $ cd ../..

Notice: The commands 'create-app' and 'create-node' can be seen in rebar_templater.erl. Also, the variables that may be supplied to these commands can be seen in the respective templates, simpleapp.template and simplenode.template.

And to create the node:

Manually create the rel directory:

~/exemplar $ mkdir rel
~/exemplar $ cd rel

create the node:

~/exemplar/rel$ rebar create-node nodeid=exemplar

~/exemplar/rel$ ls -lR
total 8
drwxr-xr-x  5 iw  iw  170 13 Jan 13:33 files
-rw-r--r--  1 iw  iw  612 13 Jan 13:33 reltool.config

./files:
-rw-r--r--  1 iw  iw   334 Jun 22 16:05 app.config
-rwxr--r--  1 iw  iw  1120 Jun 22 16:05 erl
-rwxr--r--  1 iw  iw  4370 Jun 22 16:05 exemplar
-rwxr--r--  1 iw  iw  4819 Jun 22 16:05 nodetool
-rw-r--r--  1 iw  iw   423 Jun 22 16:05 vm.args

Next edit reltool.config to tell reltool where it can find the app 'exemplar':

If you're using R15B01 or newer change

{app, {exemplar, [{mod_cond, app}, {incl_cond, include}]}

to

{app, exemplar, [{mod_cond, app}, {incl_cond, include}, {lib_dir, ".."}]}

or else (R15B or older) change

{sys, [
   {lib_dirs, []},

to

{sys, [
   {lib_dirs, ["../apps"]},

To produce a release:

~/exemplar $ cd ..

Add the following to rebar.config (create rebar.config if missing):

If you're using R15B01 or newer

{sub_dirs, ["rel"]}.

or else (R15B or older)

{sub_dirs, ["apps/exemplar", "rel"]}.

and perform:

~/exemplar $ rebar compile generate
==> exemplar (compile)
...
==> rel (generate)

This will produce the target system exemplar within the rel directory:

~/exemplar $ ls -l rel/exemplar/
total 0
drwxr-xr-x   3 iw  iw   102 13 Jan 13:52 bin
drwxr-xr-x   8 iw  iw   272 13 Jan 13:52 erts-5.7.4
drwxr-xr-x   3 iw  iw   102 13 Jan 13:52 erts-vsn
drwxr-xr-x   4 iw  iw   136 13 Jan 13:52 etc
drwxr-xr-x  33 iw  iw  1122 13 Jan 13:52 lib
drwxr-xr-x   3 iw  iw   102 13 Jan 13:52 log
drwxr-xr-x   4 iw  iw   136 13 Jan 13:52 releases

Execute the following commands to start and stop the application:

~/exemplar/rel$ ./exemplar/bin/exemplar start
~/exemplar/rel$ ./exemplar/bin/exemplar attach
Attaching to /tmp//home/*/exemplar/rel/exemplar/erlang.pipe.1 (^D to exit)


(exemplar@127.0.0.1)1> application:which_applications().
[{exemplar,[],"1"},
 {sasl,"SASL  CXC 138 11","2.2.1"},
 {stdlib,"ERTS  CXC 138 10","1.18.1"},
 {kernel,"ERTS  CXC 138 10","2.15.1"}]
(exemplar@127.0.0.1)2> **^D**[Quit]
~/exemplar/rel$ ./exemplar/bin/exemplar stop
ok
Something went wrong with that request. Please try again.