You will need to create a node before you can generate a release.<br><br>create 'rel' directory and cd into it<br>rebar -v create-node nodeid=<nodename><br>Modify the generated reltool.config file<br>rebar -v generate<br>
<br>Subsequent generate calls will need to have "force=1" added to overwrite the previously generated node.<br><br>After you have a node generated, ex: nodeid=moxnode, then you can launch with boot scripts...<br>
rel/<nodeid>/bin/<nodeid> start<br><br>Look in Alan's link for ... "To create a release we have to create a new directory in the root of our project called <strong>rel</strong> and create a node in it. A node is kind of a standalone Erlang VM for our application to run on."<br>
That looks like what you're missing.<br><br>Another perspective...<br><a href="https://bitbucket.org/basho/rebar/wiki/ReleaseHandling">https://bitbucket.org/basho/rebar/wiki/ReleaseHandling</a><br><br><br>-mox<br><br>
<br><br><div class="gmail_quote">On Sun, Apr 24, 2011 at 9:01 PM, Todd <span dir="ltr"><<a href="mailto:t.greenwoodgeer@gmail.com">t.greenwoodgeer@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
Short version:<br>
When I create a release with rebar, the app dies with 'bad_return'.<br>
<br>
Longer version:<br>
(rebar version: 2 date: 20110420_043817 vcs: git bd1475d)<br>
<br>
1. I've tried following these two rebar tutorials:<br>
<br>
<a href="http://skeptomai.com/?p=56#respond" target="_blank">http://skeptomai.com/?p=56#respond</a><br>
<a href="http://alancastro.org/2010/05/01/erlang-application-management-with-rebar.html" target="_blank">http://alancastro.org/2010/05/01/erlang-application-management-with-rebar.html</a><br>
<br>
2. Following either set of instructions, I can generate a single app and subsequently compile and launch it in the erl shell:<br>
<br>
rebar create-app<br>
rebar compile<br>
erl -pa ebin<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
application:start(myapp).<br>
application:stop(myapp).<br>
</blockquote>
<br>
3. So far, so good. However, things seem to fall apart in the 'rebar -v generate' command...but then, I'm not sure what I should be seeing here:<br>
<br>
user@erlang32:~/projects/testing-rebar-03/mysample$ rebar -v generate<br>
DEBUG: Rebar location: "/usr/local/bin/rebar"<br>
DEBUG: Entering /home/user/projects/testing-rebar-03/mysample<br>
DEBUG: Available deps: []<br>
DEBUG: Missing deps  : []<br>
DEBUG: Predirs: ["/home/user/projects/testing-rebar-03/mysample/rel"]<br>
DEBUG: Entering /home/user/projects/testing-rebar-03/mysample/rel<br>
DEBUG: Available deps: []<br>
DEBUG: Missing deps  : []<br>
DEBUG: Predirs: []<br>
==> rel (generate)<br>
DEBUG: Created dir /home/user/projects/testing-rebar-03/mysample/rel/mysample/log/sasl<br>
INFO:  sh info:<br>
        cwd: "/home/user/projects/testing-rebar-03/mysample/rel"<br>
        cmd: cp -R /home/user/projects/testing-rebar-03/mysample/rel/files/erl /home/user/projects/testing-rebar-03/mysample/rel/mysample/erts-5.7.5/bin/erl<br>
        opts: [{use_stdout,false},return_on_error]<br>
INFO:  sh info:<br>
        cwd: "/home/user/projects/testing-rebar-03/mysample/rel"<br>
        cmd: cp -R /home/user/projects/testing-rebar-03/mysample/rel/files/nodetool /home/user/projects/testing-rebar-03/mysample/rel/mysample/erts-5.7.5/bin/nodetool<br>
        opts: [{use_stdout,false},return_on_error]<br>
INFO:  sh info:<br>
        cwd: "/home/user/projects/testing-rebar-03/mysample/rel"<br>
        cmd: cp -R /home/user/projects/testing-rebar-03/mysample/rel/files/mysample /home/user/projects/testing-rebar-03/mysample/rel/mysample/bin/mysample<br>
        opts: [{use_stdout,false},return_on_error]<br>
INFO:  sh info:<br>
        cwd: "/home/user/projects/testing-rebar-03/mysample/rel"<br>
        cmd: cp -R /home/user/projects/testing-rebar-03/mysample/rel/files/app.config /home/user/projects/testing-rebar-03/mysample/rel/mysample/etc/app.config<br>
        opts: [{use_stdout,false},return_on_error]<br>
INFO:  sh info:<br>
        cwd: "/home/user/projects/testing-rebar-03/mysample/rel"<br>
        cmd: cp -R /home/user/projects/testing-rebar-03/mysample/rel/files/vm.args /home/user/projects/testing-rebar-03/mysample/rel/mysample/etc/vm.args<br>
        opts: [{use_stdout,false},return_on_error]<br>
DEBUG: Postdirs: []<br>
WARN:  'generate' command does not apply to directory /home/user/projects/testing-rebar-03/mysample<br>
DEBUG: Postdirs: []<br>
<br>
4. However, the true error shows when I try to start the rebar created app:<br>
<br>
user@erlang32:~/projects/testing-rebar-01$ sh rel/mynode/bin/mynode console<br>
Exec: /home/user/projects/testing-rebar-01/rel/mynode/erts-5.7.5/bin/erlexec -boot /home/user/projects/testing-rebar-01/rel/mynode/releases/1/mynode -embedded -config /home/user/projects/testing-rebar-01/rel/mynode/etc/app.config -args_file /home/user/projects/testing-rebar-01/rel/mynode/etc/vm.args -- console<br>

Root: /home/user/projects/testing-rebar-01/rel/mynode<br>
Erlang R13B04 (erts-5.7.5) [source] [rq:1] [async-threads:5] [kernel-poll:true]<br>
<br>
<br>
=INFO REPORT==== 19-Apr-2011::22:51:20 ===<br>
    application: myapp<br>
    exited: {bad_return,<br>
                {{myapp_app,start,[normal,[]]},<br>
                 {'EXIT',<br>
                     {undef,<br>
                         [{myapp_app,start,[normal,[]]},<br>
                          {application_master,start_it_old,4}]}}}}<br>
    type: permanent<br>
{"Kernel pid terminated",application_controller,"{application_start_failure,myapp,{bad_return,{{myapp_app,start,[normal,[]]},{'EXIT',{undef,[{myapp_app,start,[normal,[]]},{application_master,start_it_old,4}]}}}}}"}<br>

<br>
Crash dump was written to: erl_crash.dump<br>
Kernel pid terminated (application_controller) ({application_start_failure,myapp,{bad_return,{{myapp_app,start,[normal,[]]},{'EXIT',{undef,[{myapp_app,start,[normal,[]]},{application_master,start_it<br>
<br>
<br>
5. I have tried creating and releasing apps via rebar using both sets of instructions, on both mac os x, and linux, multiple times... and in all cases, I've run into the 'bad_return' when attempting to start the app.<br>

<br>
6. I see that this question has been raised before:<br>
<br>
<a href="https://groups.google.com/group/erlang-programming/browse_thread/thread/47961ad971086582" target="_blank">https://groups.google.com/group/erlang-programming/browse_thread/thread/47961ad971086582</a><br>
<br>
5. And the idea was that the app wasn't being compiled (or the compiled files couldn't be found). Well, I can see the app being compiled here:<br>
<br>
user@erlang32:~/projects/testing-rebar-01$ rebar compile<br>
==> myapp (compile)<br>
==> rel (compile)<br>
==> testing-rebar-01 (compile)<br>
<br>
6. And when I generate the release, it's all new:<br>
<br>
user@erlang32:~/projects/testing-rebar-01$ rm -rf rel/mynode/ && rebar generate && sh rel/mynode/bin/mynode console<br>
<br>
7. However, the generated release looks suspicious... for one thing, my app files are not in the release dir:<br>
<br>
user@erlang32:~/projects/testing-rebar-01$ find . | grep myapp<br>
./apps/myapp<br>
./apps/myapp/src<br>
./apps/myapp/src/myapp_app.erl<br>
./apps/myapp/src/myapp.app.src<br>
./apps/myapp/src/myapp_sup.erl<br>
./apps/myapp/ebin<br>
./apps/myapp/ebin/myapp_app.beam<br>
./apps/myapp/ebin/myapp_sup.beam<br>
./apps/myapp/ebin/myapp.app<br>
<br>
<br>
8. For another thing, my app beam files are not in the release dir, either:<br>
<br>
user@erlang32:~/projects/testing-rebar-01$ find . | grep beam<br>
./apps/myapp/ebin/myapp_app.beam<br>
./apps/myapp/ebin/myapp_sup.beam<br>
./rel/mynode/erts-5.7.5/bin/beam.smp<br>
./rel/mynode/erts-5.7.5/bin/beam<br>
<br>
9. Could someone show me what's supposed to be generated from the rebar generate command? Specifically, what files do I need to look at to verify that my application files have properly compiled into the release?<br>

<br>
10. Also, any hints as to how one should approach this sort of problem, debugging hints, etc. are always appreciated.<br>
<br>
<br>
----------------<br>
files<br>
----------------<br>
user@erlang32:~/projects/testing-rebar-01$ cat rebar.config<br>
{sub_dirs, ["apps/myapp", "rel"]}.<br>
user@erlang32:~/projects/testing-rebar-01$ cat rel/reltool.config<br>
{sys, [<br>
       {lib_dirs, ["../apps"]},<br>
       {rel, "mynode", "1",<br>
        [<br>
         myapp,<br>
         kernel,<br>
         stdlib,<br>
         sasl<br>
        ]},<br>
       {rel, "start_clean", "",<br>
        [<br>
         kernel,<br>
         stdlib<br>
        ]},<br>
       {boot_rel, "mynode"},<br>
       {profile, embedded},<br>
       {excl_sys_filters, ["^bin/.*",<br>
                           "^erts.*/bin/(dialyzer|typer)"]},<br>
       {app, sasl, [{incl_cond, include}]}<br>
      ]}.<br>
<br>
{target_dir, "mynode"}.<br>
<br>
{overlay, [<br>
           {mkdir, "log/sasl"},<br>
           {copy, "files/erl", "\{\{erts_vsn\}\}/bin/erl"},<br>
           {copy, "files/nodetool", "\{\{erts_vsn\}\}/bin/nodetool"},<br>
           {copy, "files/mynode", "bin/mynode"},<br>
           {copy, "files/app.config", "etc/app.config"},<br>
           {copy, "files/vm.args", "etc/vm.args"}<br>
          ]}.<br>
<br>
<br>
Thanks,<br><font color="#888888">
<br>
-Todd<br>
_______________________________________________<br>
erlang-questions mailing list<br>
<a href="mailto:erlang-questions@erlang.org" target="_blank">erlang-questions@erlang.org</a><br>
<a href="http://erlang.org/mailman/listinfo/erlang-questions" target="_blank">http://erlang.org/mailman/listinfo/erlang-questions</a><br>
</font></blockquote></div><br>