otp - My Erlang project has multiple applications: How should I start them? -
i'm struggling, otp noobie, understand how structure erlang project. far has several applications under app directory managed rebar:
proj_root apps app1 app2 appn rebar.config
i can start app1, say, in shell application:start(app1). no doubt repeat through appn. there preferred or better way? can i, say, write function bundles these starts? if so, put it?
i have several other questions along line, post separately.
many thanks,
lrp
you can indeed start applications manually suggest. can become burdensome if have many applications , there dependencies between them.
automating process quite easy implement recursive function. if try start application while 1 or more dependencies not running, application:start/1
fail , return {error, {not_started, app}}
. function can in of applications or in own.
however, manual (or automated) way proceed not otp way, if can prove useful (typically tests…). if follow otp principles, you supposed create release .rel
file containing applications. otp releases composed of set of applications (yours , system applications depend on), emulator , boot script start applications (and handle dependencies). starting node applications can performed using -boot
flag erl
pointing proper boot script.
this quite complex , rebar can build releases. produce shell scripts start nodes applications using otp boot mechanism.
Comments
Post a Comment