Skip to content
tuncer edited this page Aug 7, 2012 · 3 revisions

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:

host:~ $ mkdir exemplar

If you're using R15B01 or newer

host:~/exemplar$ rebar create-app appid=exemplar

else (R15B or older)

host:~/exemplar$ mkdir -p apps/exemplar
host:~/exemplar$ cd apps/exemplar
host:~/exemplar$ rebar create-app appid=exemplar
host:~/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:

host:~/exemplar$ mkdir rel
host:~/exemplar$ cd rel

create the node:

host:~/exemplar/rel$ rebar create-node nodeid=exemplar
    
host:~/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:

host:~/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:

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

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

host:~/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
Clone this wiki locally