20032013Ericsson AB. All Rights Reserved.
The contents of this file are subject to the Erlang Public License,
Version 1.1, (the "License"); you may not use this file except in
compliance with the License. You should have received a copy of the
Erlang Public License along with this software. If not, it can be
retrieved online at http://www.erlang.org/.
Software distributed under the License is distributed on an "AS IS"
basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
the License for the specific language governing rights and limitations
under the License.
Releasesrelease_structure.xml
This chapter should be read in conjuction with rel(4),
systools(3) and script(4).
Release Concept
When we have written one or more applications, we might want to
create a complete system consisting of these applications and a
subset of the Erlang/OTP applications. This is called a
release.
To do this, we create a release resource file which defines which applications
are included in the release.
The release resource file is used to generate
boot scripts and
release packages. A system
which is transfered to and installed at another site is called a
target system. How to use a release package to create a
target system is described in System Principles.
Release Resource File
To define a release, we create a release resource file,
or in short .rel file, where we specify the name and
version of the release, which ERTS version it is based on, and
which applications it consists of:
The file must be named Rel.rel, where Rel is a
unique name.
Name, Vsn and EVsn are strings.
Each Application (atom) and AppVsn (string) is
the name and version of an application included in the release.
Note that the minimal release based on Erlang/OTP consists of
the kernel and stdlib applications, so these
applications must be included in the list.
If the release is to be upgraded, it must also include
the sasl application.
Example: We want to make a release of ch_app from
the Applications
chapter. It has the following .app file:
There are tools in the SASL module systools available to
build and check releases. The functions read the .rel and
.app files and performs syntax and dependency checks.
The function systools:make_script/1,2 is used to generate
a boot script (see System Principles).
1> systools:make_script("ch_rel-1", [local]).
ok
This creates a boot script, both the readable version
ch_rel-1.script and the binary version used by the runtime
system, ch_rel-1.boot. "ch_rel-1" is the name of
the .rel file, minus the extension. local is an
option that means that the directories where the applications are
found are used in the boot script, instead of $ROOT/lib.
($ROOT is the root directory of the installed release.)
This is a useful way to test a generated boot script locally.
When starting Erlang/OTP using the boot script, all applications
from the .rel file are automatically loaded and started:
There is a function systools:make_tar/1,2 which takes
a .rel file as input and creates a zipped tar-file with
the code for the specified applications, a release package.
1> systools:make_script("ch_rel-1").
ok
2> systools:make_tar("ch_rel-1").
ok
The release package by default contains the .app files and
object code for all applications, structured according to
the application directory structure, the binary boot script renamed to
start.boot, and the .rel file.
Note that a new boot script was generated, without
the local option set, before the release package was made.
In the release package, all application directories are placed
under lib. Also, we do not know where the release package
will be installed, so we do not want any hardcoded absolute paths
in the boot script here.
The release resource file mysystem.rel is duplicated in
the tar file. Originally, this file was only stored in
the releases directory in order to make it possible for
the release_handler to extract this file
separately. After unpacking the tar file, release_handler
would automatically copy the file
to releases/FIRST. However, sometimes the tar file is
unpacked without involving the release_handler (e.g. when
unpacking the first target system) and therefore the file is now
instead duplicated in the tar file so no manual copying is
necessary.
If a relup file and/or a system configuration file called
sys.config is found, these files are included in
the release package as well. See
Release Handling.
Options can be set to make the release package include source
code and the ERTS binary as well.
Refer to System Principles for how to install the first target
system, using a release package, and to
Release Handling for
how to install a new release package in an existing system.
Directory Structure
Directory structure for the code installed by the release handler
from a release package:
$ROOT/lib/App1-AVsn1/ebin
/priv
/App2-AVsn2/ebin
/priv
...
/AppN-AVsnN/ebin
/priv
/erts-EVsn/bin
/releases/Vsn
/binlibApplication directories.erts-EVsn/binErlang runtime system executables.releases/Vsn.rel file and boot script start.boot.
If present in the release package, relup and/or sys.config.binTop level Erlang runtime system executables.
Applications are not required to be located under the
$ROOT/lib directory. Accordingly, several installation
directories may exist which contain different parts of a
system. For example, the previous example could be extended as
follows:
The $SECOND_ROOT and $THIRD_ROOT are introduced as
variables in the call to the systools:make_script/2
function.
Disk-Less and/or Read-Only Clients
If a complete system consists of some disk-less and/or
read-only client nodes, a clients directory should be
added to the $ROOT directory. By a read-only node we
mean a node with a read-only file system.
The clients directory should have one sub-directory
per supported client node. The name of each client directory
should be the name of the corresponding client node. As a
minimum, each client directory should contain the bin and
releases sub-directories. These directories are used to
store information about installed releases and to appoint the
current release to the client. Accordingly, the $ROOT
directory contains the following:
This structure should be used if all clients are running
the same type of Erlang machine. If there are clients running
different types of Erlang machines, or on different operating
systems, the clients directory could be divided into one
sub-directory per type of Erlang machine. Alternatively, you
can set up one $ROOT per type of machine. For each
type, some of the directories specified for the $ROOT
directory should be included: