Christopher Piro | 094823a | 2007-07-18 00:26:12 +0000 | [diff] [blame] | 1 | Much more information on these topics can be found at www.erlware.org |
| 2 | |
| 3 | |
| 4 | Building the tree |
| 5 | ================= |
| 6 | |
| 7 | To build, type make, it should all work from there. |
| 8 | |
| 9 | NOTE** if your system has erlang installed in a directory other than /usr/local/lib/erlang |
| 10 | then you must set the environment variable ERL_RUN_TOP to that directory. For example |
| 11 | if you have erlang installed in /home/jdoe/erlang then you should |
| 12 | export ERL_RUN_TOP=/home/jdoe/erlang |
| 13 | |
| 14 | |
| 15 | Creating a new application |
| 16 | ========================== |
| 17 | |
| 18 | A new application can be created by using the appgen utility in otp/tools/utilities. |
| 19 | This utility will create a basic OTP app framework under the otp/lib directory and |
| 20 | an OTP release under the otp/release directory. |
| 21 | |
| 22 | usage: appgen <appname> <prefix> |
| 23 | |
| 24 | Appname is the name of the application that you would like to create. The prefix is |
| 25 | usually the first letter of each word in the appname. This prefix is to avoid name |
| 26 | clashes between applications included in a release (Erlang does not have packages). |
| 27 | |
| 28 | example usage: appgen my_app ma |
| 29 | |
| 30 | which results in |
| 31 | |
| 32 | otp/lib/my_app & otp/release/my_app_rel |
| 33 | |
| 34 | Running a release |
| 35 | ================= |
| 36 | |
| 37 | Your release should contain all that you need to run your application. If your application |
| 38 | depends on any applications that are supplied outside of this build tree or OTP itself then |
| 39 | they may be added to the <appname>_rel.rel.src file. If the extra applications are present |
| 40 | in this build tree then they will be found by the make process and included in the final |
| 41 | release. |
| 42 | |
| 43 | To run a release there are two options: "local" and installed. The local version can be found |
| 44 | in the otp/release/<appname>_rel/local directory which is added by the make process. This |
| 45 | should be used during development to run your release interactively via an Erlang shell. |
| 46 | To run a release in local mode cd into the "local" directory and run <appname>_rel.sh. |
| 47 | |
| 48 | The second way to run a release is to install it and run it as a daemon. This is used for |
| 49 | applications in a production setting. To do this you need to first run make & make install |
| 50 | from the <appname>_rel directory. This will place a complete production ready versioned |
| 51 | release in the /usr/local/lib/ directory under <appname>_rel. To run an installed release |
| 52 | cd to /usr/local/lib/<appname>_rel/release/<rel_vsn> and run <appname>_rel.sh. |
| 53 | |
| 54 | In the case where you want to create a production ready release on one machine and then deploy it |
| 55 | on multiple identical machines you may create a production tar archive. To do this run |
| 56 | make & make tar from the otp/release/<appname>_rel/ directory. This will create a tar file conataining |
| 57 | the release name and version number in the file name. This tar can be shipped to its destination and |
| 58 | untarred. Within the untarred directory there is a shell script entitled install.sh. Running this |
| 59 | script will install the release by default in /usr/local/lib/<appname>_rel. An optional argument |
| 60 | can be provided that will direct the installation to a different directory. |
| 61 | |
| 62 | Example install.sh /opt/lib |
| 63 | |
| 64 | This will install the release in /opt/lib/<appname>_rel |
| 65 | |
| 66 | |
| 67 | |
| 68 | |