Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Erlang: how can I automatically start all necessary applications to app?

Tags:

erlang

I have necessary applications in st_db.app file like this:

{application, st_db,
 [
  {description, ""},
  {vsn, "1.0.0"},
  {registered, []},
  {modules, [st_db_app, st_db_sup, st_db]},
  {applications, [
                  kernel,
                  stdlib,
          sasl,
          crypto,
          ibrowse,
          couchbeam
                 ]},
  {mod, { st_db_app, []}},
  {env, []}
 ]}.

I need to start them (crypto, sasl, etc.) automatically to run and debug the main app. The only solution I found is to start erl with such params:

erl -pa ./ebin -pa ./deps/*/ebin -boot start_sasl -s couchbeam -s crypto -s ibrowse 

Is that the only way?

PS: btw couchbeam doesn't starts on node. It just start the couchbeam's supervisor, so I have to run in shell it manually

=PROGRESS REPORT==== 15-Jun-2011::10:22:43 ===
          supervisor: {local,couchbeam_sup}
             started: [{pid,<0.62.0>},
                       {name,couchbeam},
                       {mfargs,{couchbeam,start_link,[]}},
                       {restart_type,permanent},
                       {shutdown,2000},
                       {child_type,worker}]

2> application:start(couchbeam).
ok
3> 
=PROGRESS REPORT==== 15-Jun-2011::10:23:25 ===
          supervisor: {local,couchbeam_sup}
             started: [{pid,<0.69.0>},
                       {name,couchbeam},
                       {mfargs,{couchbeam,start_link,[]}},
                       {restart_type,permanent},
                       {shutdown,2000},
                       {child_type,worker}]

=PROGRESS REPORT==== 15-Jun-2011::10:23:25 ===
         application: couchbeam
          started_at: nonode@nohost

Is there way to fix it?

like image 683
Dmitry Dushkin Avatar asked Feb 03 '23 17:02

Dmitry Dushkin


1 Answers

You can either issue a series of -eval "application:start(coucnbeam)" commands to erl, or do it the proper OTP way and use reltool to generate a new boot file for you.

See info on reltool, also rebar does an excellent job at doing much of the heavy lifting for you so you might want to look into rebar3.

There is also a great chapter, from LYSE, on making releases.

like image 104
Lukas Avatar answered Feb 14 '23 07:02

Lukas