4
votes

Thanks to much help here, I'm well on my way toward building my first Erlang release. No real code yet, but I want to understand how it's done. I've consulted and followed several web tutorials as well Martin et. al., but still seem to be missing something.

When I try to start my release I get:

lloyd@Reliance:~/Programming/Erlang/learn$ sh rel/learn/bin/learn start
[: 129: Node '[email protected]' not responding to pings.: unexpected operator

Under the project directory "learn" I have:

apps  rebar  rebar.config  rel

In rebar.config, I have:

{cover_enabled, true}.
{sub_dirs, ["rel","apps/zzz", "apps/zzz_lib"]}.

In ...learn/apps, I have:

zzz  zzz_lib

zzz and zzz_lib have all the right stuff in them so far as I can tell. From lean, I can clean, compile, and create docs.

In .../rel,I have:

files  learn  reltool.config

See reltool.config below.

I'm missing magic sauce, but what?

Many thanks,

LRP

{sys, [
   {lib_dirs, []},
   {rel, "learn", "1",
    [
     kernel,
     stdlib,
     sasl
    ]},
   {rel, "start_clean", "",
    [
     kernel,
     stdlib
    ]},
   {boot_rel, "learn"},
   {profile, embedded},
   {excl_sys_filters, ["^bin/.*",
                       "^erts.*/bin/(dialyzer|typer)"]},
   {app, sasl, [{incl_cond, include}]}
  ]}.

{target_dir, "learn"}.

{overlay, [
       {mkdir, "log/sasl"},
       {copy, "files/erl", "{{erts_vsn}}/bin/erl"},
       {copy, "files/nodetool", "{{erts_vsn}}/bin/nodetool"},
       {copy, "files/learn", "bin/learn"},
       {copy, "files/app.config", "etc/app.config"},
       {copy, "files/vm.args", "etc/vm.args"}
       ]}.
1
You don't include your apps ("zzz", "zzz_lib") in the "learn" release. Also your lib_dirs is empty. Is that intended? If you followed a tutorial, you should show us all the steps that you've gone through. Also, I would suggest you to look at erlang.org/doc/design_principles/release_handling.html before diving into the deep magic waters of rebar. It will help you understand how Erlang releases work and what rebar does behind the scenes.Roberto Aloi
Also, the release chapter in Learn You Some Erlang is out: learnyousomeerlang.com/release-is-the-word -- reading it should give you some hints and ideas about how reltool operates.I GIVE CRAP ANSWERS

1 Answers

5
votes

Looks like your retool.config file is missing some entries for the application you have written.

The first part should look something like this.

{sys, [
   {lib_dirs, ["../apps"]},      <--- point to where your applications are
   {rel, "learn", "1",
    [
     <your application here>     <---- add your application(s) here 
     kernel,
     stdlib,
     sasl
    ]},
   {rel, "start_clean", "",
    [
     kernel,
     stdlib
    ]},
   {boot_rel, "learn"},
   {profile, embedded},
   {excl_sys_filters, ["^bin/.*",
                       "^erts.*/bin/(dialyzer|typer)"]},
   {app, <your application here>, [{incl_cond, include}]},      <-- and here 
   {app, sasl, [{incl_cond, include}]}
  ]}.

Here is a sample application from Erlang and OTP in Action that I packaged up using rebar. https://github.com/tmcgilchrist/simple_cache

The general layout I follow is

  simple_cache
          |-> apps  
          |    \-> simple_cache
          |             |-> src
          |             \-> ebin
          |
          |-> rebar.config
          |-> rel
               |-> files 
               |-> reltool.config
               \-> simple_cache

Also rather that doing

sh rel/learn/bin/learn start

use

sh rel/learn/bin/learn console

and enter

application:which_applications().

Which should list a bunch of things plus your application. eg

[{mysample_app,[],[]},
 {sasl,"SASL  CXC 138 11","2.1.10"},
 {stdlib,"ERTS  CXC 138 10","1.17.5"},
 {kernel,"ERTS  CXC 138 10","2.14.5"}]