Generic setup utility for Erlang-based systems

License: Apache-2.0

Language: Erlang

The setup application

Authors: Ulf Wiger (ulf@wiger.net).

Generic setup utility for Erlang-based systems

Build Status


While Erlang/OTP comes with many wonderful applications, including the Mnesia DBMS, there is no standard or convention for installing a system. Erlang/OTP provides tools for building a boot script, and rules for setting environment variables, etc., and Mnesia offers an API for creating and modifying the database schema.

However, with no convention for when these tools and API functions are called - and by whom - application developers are left having to invent a lot of code and scripts, not to mention meditate over chapters of Erlang/OTP documentation in order to figure out how things fit together.

This utility offers a framework for initializing and configuring a system, with a set of conventions allowing each component to provide callbacks for different steps in the installation procedure.

The callbacks are defined through OTP application environment variables, which can easily be overriden at install time.

The setup_gen utility

The setup_gen utility is a simple tool to generate .rel file and boot script for an Erlang-based system. It fetches configuration options from a .conf file (read using file:script/2). As an example of a very simple build, see examples/gproc.conf':

[{apps, [kernel,

This configuration file simply lists the applications to start from the boot script. The setup_gen script can either be called from within Erlang as:

Eshell V5.8.1  (abort with ^G)
1> setup_gen:run([{conf,"gproc.conf"},{outdir,"."},{name,"gproc"}]).
Options = [{conf,"gproc.conf"},{outdir,"."},{name,"gproc"}]
Paths = []
add path Res = ok
app_vsn(kernel) -> "2.14.1"
app_vsn(stdlib) -> "1.17.1"
app_vsn(sasl) -> ""
app_vsn(gproc) -> "0.01"
Rel: {release,{"gproc","tmp"},
entering directory .
Path = []
make_script() -> ok

...or as an escript:

escript ~/git/setup/ebin/setup_gen.beam gproc gproc.conf .

If the option -install true is given, the setup_gen utility will generate an installation boot script, and install.config file, which can be used to install the system, using a command like:

erl -sys install -boot install

This boot script will run kernel, stdlib and sasl, then load all other applications, and finally run the setup application, which will find and execute any setup hooks.

If the option -setup stop_when_done true is added to the command line, the setup application will automatically shut down all running nodes after running the setup hooks. Otherwise (default), it will hand over control to the shell rather than terminate the Erlang VM.

See setup_gen:run/1 for documentation on all supported options.

Variable expansion

setup extends the functionality of application:get_env/[2,3] by also supporting variable expansion, as well as a function for searching all applications for instances of a given variable. This functionality is described in setup.



Project Statistics

Sourcerank 8
Repository Size 1.15 MB
Stars 55
Forks 46
Watchers 7
Open issues 3
Dependencies 0
Contributors 10
Tags 25
Last updated
Last pushed

Top Contributors See all

Ulf Wiger Tino Breddin Joseph Wayne Norton Dave Smith Kelly McLaughlin Jared Morrow Yury Gargay Chandrashekhar Mullaparthi Randy Barlow bryanhuntesl

Packages Referencing this Repo

Generic setup application for Erlang-based systems
Latest release 2.0.2 - Updated - 55 stars

Recent Tags See all

2.0.2 February 07, 2018
2.0.1 February 07, 2018
2.0.0 December 07, 2017
1.9.0 November 28, 2017
1.8.4 September 15, 2017
1.8.3 September 15, 2017
1.8.2 September 08, 2017
1.8.1 January 31, 2017
1.8.0 June 27, 2016
1.7 February 16, 2016
1.6 January 07, 2016
1.5 May 26, 2015
1.4 November 10, 2014
1.3 April 06, 2014
1.2.9 June 11, 2013

Interesting Forks See all

Generic setup utility for Erlang-based systems
Erlang - Apache-2.0 - Last pushed - 33 stars
Generic setup utility for Erlang-based systems
Erlang - Other - Last pushed - 3 stars - 2 forks
Generic setup utility for Erlang-based systems
Erlang - Apache-2.0 - Last pushed - 3 stars
Generic setup utility for Erlang-based systems
Erlang - MPL-2.0 - Last pushed - 2 stars
Generic setup utility for Erlang-based systems
Erlang - MPL-2.0 - Last pushed - 1 stars - 1 forks

Something wrong with this page? Make a suggestion

Last synced: 2018-08-28 19:38:30 UTC

Login to resync this repository