[erlang-questions] relx extended deps

Tue Jan 27 02:15:53 CET 2015

Hi, all.
in order to solve the ranch's problem with ssl during shutdown

I have created the following fix to relx
(do not laugh, it is strongly related to the issue)

it is a proof-of-concept module, which solves the problem in isolation 
of relx.
a concatenation of multiple .app.src files (that represent a 
hypothetical release with its deps)
a linear sequence of applications that satisfies each and every 
individual dep described in the given input.
(OR crash if the given deps contain a loop.)

this tiny module assumes one elegant extension to the .app.src syntax:
the option 'sequence'

adding this option to _your_ .app.src you can instruct relx to arrange 
some of your deps to an arbitrary position in the startup sequence 
(anywhere between deps of deps of deps).

for example:
{application, my_app, [
	{applications, [
	{sequence, [[ssl,ranch]]}	

instructs my dependency resolver to start ssl BEFORE ranch, regardless 
any other circumstances.

{'sequence', Sequences}

Sequences = [ Seq ]
Seq = [ atom() ]

A Seq is a requirement to run some (two or more) application in the 
given order. You may specify multiple independent Seqs.

 From the relx's perspective sequence is not a dep, it actually reads: 
IF the app A will be started as a dep of any other app in our deps-tree 
THEN it should be started before the app B.

Thus, if relx developers accept this fix, then you shall add:
"{sequence, [[ssl,ranch]]}"
to the ranch's .app file and the proper sequence will be ensured,
BUT ranch will not have a redundant dependency.

More information about the erlang-questions mailing list