They are used to create releases (using * .rel to create download scripts). I recommend only starting with the * .app file and the application behavior callback. Regarding getting started with OTP. This is a nice place to develop:
-module(foo). -export([start/0]). start() -> [application:start(A) || A <- [sasl, inets, x, y, etc]].
to run all applications that depend on starting your application with a simple
$ erl -s foo
- If your project will be used as a service or structure for other projects, another advantage is that these Erlang applications can in turn depend on your application or include it. An Erlang application is a device in which you can provide services and even libraries (stdlib is a library, "moving parts", only library modules).
- As an Erlang application, you get an easy way to pass configuration settings to your application. When you pass
-mnesia dir '"/some/path"' to erl, it is accessed by the mnesia application:get_env(mnesia, dir) as application:get_env(mnesia, dir) . If you define an application called foo , you can pass -foo key 'some-Erlang-literal' to erl. The * .app file may contain default values ββin the env section, the * .rel file overrides them, and the command line overrides this. - There are sections in the * .app file that list the modules and registered processes that your application enters. This is used when creating releases to ensure that there are no collisions between applications.
Some additional features of Erlang applications that I know little about:
- Launch Phases. Used for applications that have complex startup tasks, for example, "partially launched" for a while.
- Distributed applications. Used to determine where the application should run in the cluster.
- takeovers. Used to release a machine from a distributed application, for example, when maintenance or updating is required.
In the end, you will begin to want to start your application suite in a more structured way, and that is when the entire / boot - script release becomes more understandable. Or vice versa, you will think that it is unnecessary for you specific needs. Just start with a simple * .app and application callback module. You do not look back.
Christian
source share