Erlang Central

OTP Release Handling Tutorial

Revision as of 23:54, 14 June 2007 by LeonardoSimonsen558 (Talk | contribs)


OTP Release Handling Tutorial.


This tutorial attempts to show by example how to build a proper OTP-based system.

A quick way to get started might be to copy this example system, and modify the configuration files. I will try to explain the purpose of each file and suggest how they may be modified.

The Example System

The example system (called "example") runs on two processors (note that the two processors can easily be two Erlang nodes on the same physical machine), and contains two applications:

  • base, which runs on both processors. This program doesn't do much interesting.
  • dist, which runs on only one processor at a time. This program does one interesting thing: smooth takeover of state. This involves start phases, the global name server, and some other exciting concepts.

Basic File Structure


The code is riddled with comments. If you view it with e.g. Emacs using fontification, it may be easier to read.

With this file structure in place, you are ready to support in-service upgrade, but that will be described in a future tutorial.

Compiling the code.

...Nothing to it, really. I didn't bother with make scripts and stuff like that. Go into each src/ directory and type:

Code listing 1.1

erlc -W -o ../ebin *.erl

Building the boot script.

The easiest way to build the boot script is to place yourself in the $DIR/releases/1.0 directory, start an Erlang shell, and type the following:

{{CodeSnippet|Code listing 1.2|
Eshell V5.2  (abort with ^G)