How to run erlang (rebar build) application

Have a look at your dummys.app.src file. The meaning of all the directives is explained in the 'app' manpage, but the one I suspect is missing here is mod, which indicates the name of your application callback module. So make sure that this line is present:

{mod, {dummys_app, []}}

The empty list in there will be passed as the StartArgs argument to dummys_app:start/2.


To make a new module start along with your application, add it to the supervision tree in dummys_sup:init. This function should look something like:
init(_) ->
    {ok, {{one_for_one, 10, 10},
         [{dummys_cool, {dummys_cool, start_link, []},
           permanent, brutal_kill, worker, [dummys_cool]}]}.

This is described in the 'supervisor' manpage, but basically this means that on startup, this supervisor will start one child process. dummys_cool:start_link() will be called, and that function is expected to spawn a new process, link to it, and return its process id. If you need more processes, just add more child specifications to the list.


For quick development, if you just want to ensure your appliction can start, start a shell, then start the application:

erl -pa ebin
1> dummys_app:start().

That will give you a clean indication of what is wrong and right without the shell bombing out after.

Since you're making an application to run, rather than just a library to share, you'll want to make a release. Rebar can get you most of the way there:

mkdir rel
cd rel
rebar create-node nodeid=dummysnode

After you've compiled your application, you can create a release:

rebar generate

This will build a portable release which includes all the required libraries and even the erlang runtime system. This is put by default in the rel/ directory; in your case rel/dummys.

Within that directory there will be a control script that you can use to start, stop, and attach to the application:

rel/dummys/bin/dummys start
rel/dummys/bin/dummys stop
rel/dummys/bin/dummys start
rel/dummys/bin/dummys attach

Tags:

Erlang

Rebar