• Create the application:
~ $ mkdir exemplar
~ $ cd exemplar
~/exemplar/apps/exemplar $ rebar create-app appid=exemplar
  • 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
    -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':
{sys, [{lib_dirs, []},
to
{sys, [{lib_dirs, ["../deps"]},
add line:
{app, hipe, [{incl_cond, exclude}]}
modify
{app, exemplar, [{mod_cond, app},{incl_cond, include},{lib_dir, ["../"]}]},
  • To produce a release:
~/exemplar/rel $ cd ..
  • Add the following to rebar.config (create rebar.config if missing)
{sub_dirs, ["rel"]}.
{lib_dirs, ["./"]}.
{erl_opts, [warnings_as_errors, debug_info, {i, "include"},{parse_transform, lager_transform}]}.
{deps_dir, ["deps"]}.
  • Now perform
~/exemplar $ rebar compile generate
==> exemplar (compile)
...
==> rel (generate)

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

~/exemplar $ cd rel
~/exemplar/rel $ ls -l 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