Lloyd R. Prentice
Lloyd R. Prentice

Reputation: 4867

Erlang releases with Rebar: What am I missing?

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"}
       ]}.

Upvotes: 4

Views: 4029

Answers (1)

lambda_foo
lambda_foo

Reputation: 182

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"}]

Upvotes: 5

Related Questions