Erlang release names and versions

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Erlang release names and versions

Samuel Elliott
Hi Erlangers,
I'm trying to package up some Erlang projects for distribution,
possibly by creating Releases, and I'm getting quite confused. I'd
like to do it the "correct" way because we may want to use
release_handler to perform upgrades.

Maybe someone can help me out :-)

The documentation for Releases
(http://www.erlang.org/doc/design_principles/release_structure.html)
shows a sample directory structure produced by make_tar, which
includes this part:

releases/A/start.boot
releases/ch_rel-1.rel

Where ch_rel-1 is the name of the release and A is the version of the release.

Question 1: If the release file is placed in releases/ch_rel-1.rel,
then isn't installing a second version of the release (say, "B") going
to overwrite the file? Isn't this a problem? Is the addition of "-1"
to the release name supposed to address this? Shouldn't the release
name appear somewhere in the path?

Question 2: If another release, say "foo", is installed with the same
version (say "A"), isn't it going to overwrite the start.boot file
from release "ch_rel-1"?

Question 3: Should I even be trying to install more than one release
at once? Would I need a completely new Erlang install directory (or at
least, releases directory, by using RELDIR)?

(I have, incidentally, seen somewhere that the placement of the .rel
file directly under releases/ by make_tar is a bug. Is this so? It
certainly doesn't seem to match the structure created by
create_target.)

Thanks in advance for any help,
Sam.


Reply | Threaded
Open this post in threaded view
|

Erlang release names and versions

Michael Truog-2
If you are doing this from scratch it should be much easier to use rebar for building the release:
https://github.com/basho/rebar

Otherwise, most older projects use to use shell scripts combined with erlang source code to build releases, and much of that was custom ad-hoc source code.  So, that is good to avoid.

On 09/12/2011 10:17 PM, Sam Bobroff wrote:

> Hi Erlangers,
> I'm trying to package up some Erlang projects for distribution,
> possibly by creating Releases, and I'm getting quite confused. I'd
> like to do it the "correct" way because we may want to use
> release_handler to perform upgrades.
>
> Maybe someone can help me out :-)
>
> The documentation for Releases
> (http://www.erlang.org/doc/design_principles/release_structure.html)
> shows a sample directory structure produced by make_tar, which
> includes this part:
>
> releases/A/start.boot
> releases/ch_rel-1.rel
>
> Where ch_rel-1 is the name of the release and A is the version of the release.
>
> Question 1: If the release file is placed in releases/ch_rel-1.rel,
> then isn't installing a second version of the release (say, "B") going
> to overwrite the file? Isn't this a problem? Is the addition of "-1"
> to the release name supposed to address this? Shouldn't the release
> name appear somewhere in the path?
>
> Question 2: If another release, say "foo", is installed with the same
> version (say "A"), isn't it going to overwrite the start.boot file
> from release "ch_rel-1"?
>
> Question 3: Should I even be trying to install more than one release
> at once? Would I need a completely new Erlang install directory (or at
> least, releases directory, by using RELDIR)?
>
> (I have, incidentally, seen somewhere that the placement of the .rel
> file directly under releases/ by make_tar is a bug. Is this so? It
> certainly doesn't seem to match the structure created by
> create_target.)
>
> Thanks in advance for any help,
> Sam.
> _______________________________________________
> erlang-questions mailing list
> erlang-questions
> http://erlang.org/mailman/listinfo/erlang-questions
>



Reply | Threaded
Open this post in threaded view
|

Erlang release names and versions

Samuel Elliott
In reply to this post by Samuel Elliott
Did you see this? It may have answers to some of your questions

http://learnyousomeerlang.com/relups

(including if you need to move generated files)

Sam

On Tue, Sep 13, 2011 at 6:17 AM, Sam Bobroff <sam> wrote:

> Hi Erlangers,
> I'm trying to package up some Erlang projects for distribution,
> possibly by creating Releases, and I'm getting quite confused. I'd
> like to do it the "correct" way because we may want to use
> release_handler to perform upgrades.
>
> Maybe someone can help me out :-)
>
> The documentation for Releases
> (http://www.erlang.org/doc/design_principles/release_structure.html)
> shows a sample directory structure produced by make_tar, which
> includes this part:
>
> releases/A/start.boot
> releases/ch_rel-1.rel
>
> Where ch_rel-1 is the name of the release and A is the version of the
> release.
>
> Question 1: If the release file is placed in releases/ch_rel-1.rel,
> then isn't installing a second version of the release (say, "B") going
> to overwrite the file? Isn't this a problem? Is the addition of "-1"
> to the release name supposed to address this? Shouldn't the release
> name appear somewhere in the path?
>
> Question 2: If another release, say "foo", is installed with the same
> version (say "A"), isn't it going to overwrite the start.boot file
> from release "ch_rel-1"?
>
> Question 3: Should I even be trying to install more than one release
> at once? Would I need a completely new Erlang install directory (or at
> least, releases directory, by using RELDIR)?
>
> (I have, incidentally, seen somewhere that the placement of the .rel
> file directly under releases/ by make_tar is a bug. Is this so? It
> certainly doesn't seem to match the structure created by
> create_target.)
>
> Thanks in advance for any help,
> Sam.
> _______________________________________________
> erlang-questions mailing list
> erlang-questions
> http://erlang.org/mailman/listinfo/erlang-questions
>



--
Samuel Elliott
sam
http://lenary.co.uk/
+44 (0)7891 993 664
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20110913/523c0ab1/attachment.html>

Reply | Threaded
Open this post in threaded view
|

Erlang release names and versions

Samuel Elliott
Thanks a lot for the tips but I already knew most of it -- I must
admit that I was attempting to provoke a more "official" answer from
one of the OTP people ;-)

Does anyone from the OTP team wish to comment on my original question?

All I can get so far is: the provided code and documentation is either
wrong or doesn't work so you have to build your own, although some
other people have started doing that.

That's a pretty poor official answer for how to release Erlang
applications, especially when it is strongly tied to code reloading
(one of Erlang's "killer features"... if only anyone could understand
how to use it).

Thanks,
Sam.

On 13 September 2011 21:43, Samuel Elliott <sam> wrote:

> Did you see this? It may have answers to some of your questions
> http://learnyousomeerlang.com/relups
> (including if you need to move generated files)
>
> Sam
>
> On Tue, Sep 13, 2011 at 6:17 AM, Sam Bobroff <sam> wrote:
>>
>> Hi Erlangers,
>> I'm trying to package up some Erlang projects for distribution,
>> possibly by creating Releases, and I'm getting quite confused. I'd
>> like to do it the "correct" way because we may want to use
>> release_handler to perform upgrades.
>>
>> Maybe someone can help me out :-)
>>
>> The documentation for Releases
>> (http://www.erlang.org/doc/design_principles/release_structure.html)
>> shows a sample directory structure produced by make_tar, which
>> includes this part:
>>
>> releases/A/start.boot
>> releases/ch_rel-1.rel
>>
>> Where ch_rel-1 is the name of the release and A is the version of the
>> release.
>>
>> Question 1: If the release file is placed in releases/ch_rel-1.rel,
>> then isn't installing a second version of the release (say, "B") going
>> to overwrite the file? Isn't this a problem? Is the addition of "-1"
>> to the release name supposed to address this? Shouldn't the release
>> name appear somewhere in the path?
>>
>> Question 2: If another release, say "foo", is installed with the same
>> version (say "A"), isn't it going to overwrite the start.boot file
>> from release "ch_rel-1"?
>>
>> Question 3: Should I even be trying to install more than one release
>> at once? Would I need a completely new Erlang install directory (or at
>> least, releases directory, by using RELDIR)?
>>
>> (I have, incidentally, seen somewhere that the placement of the .rel
>> file directly under releases/ by make_tar is a bug. Is this so? It
>> certainly doesn't seem to match the structure created by
>> create_target.)
>>
>> Thanks in advance for any help,
>> Sam.
>> _______________________________________________
>> erlang-questions mailing list
>> erlang-questions
>> http://erlang.org/mailman/listinfo/erlang-questions
>
>
>
> --
> Samuel Elliott
> sam
> http://lenary.co.uk/
> +44 (0)7891 993 664
>
>


Reply | Threaded
Open this post in threaded view
|

Erlang release names and versions

Siri Hansen-3
Hi Sam - sorry for the delay.
This is not yet the "official" answer - it's just to let you know that this
OTP person is indeed looking into the issue with the intention of producing
a good answer really soon ... :)
Regards
/siri


2011/9/21 Sam Bobroff <sam>

> Thanks a lot for the tips but I already knew most of it -- I must
> admit that I was attempting to provoke a more "official" answer from
> one of the OTP people ;-)
>
> Does anyone from the OTP team wish to comment on my original question?
>
> All I can get so far is: the provided code and documentation is either
> wrong or doesn't work so you have to build your own, although some
> other people have started doing that.
>
> That's a pretty poor official answer for how to release Erlang
> applications, especially when it is strongly tied to code reloading
> (one of Erlang's "killer features"... if only anyone could understand
> how to use it).
>
> Thanks,
> Sam.
>
> On 13 September 2011 21:43, Samuel Elliott <sam> wrote:
> > Did you see this? It may have answers to some of your questions
> > http://learnyousomeerlang.com/relups
> > (including if you need to move generated files)
> >
> > Sam
> >
> > On Tue, Sep 13, 2011 at 6:17 AM, Sam Bobroff <sam> wrote:
> >>
> >> Hi Erlangers,
> >> I'm trying to package up some Erlang projects for distribution,
> >> possibly by creating Releases, and I'm getting quite confused. I'd
> >> like to do it the "correct" way because we may want to use
> >> release_handler to perform upgrades.
> >>
> >> Maybe someone can help me out :-)
> >>
> >> The documentation for Releases
> >> (http://www.erlang.org/doc/design_principles/release_structure.html)
> >> shows a sample directory structure produced by make_tar, which
> >> includes this part:
> >>
> >> releases/A/start.boot
> >> releases/ch_rel-1.rel
> >>
> >> Where ch_rel-1 is the name of the release and A is the version of the
> >> release.
> >>
> >> Question 1: If the release file is placed in releases/ch_rel-1.rel,
> >> then isn't installing a second version of the release (say, "B") going
> >> to overwrite the file? Isn't this a problem? Is the addition of "-1"
> >> to the release name supposed to address this? Shouldn't the release
> >> name appear somewhere in the path?
> >>
> >> Question 2: If another release, say "foo", is installed with the same
> >> version (say "A"), isn't it going to overwrite the start.boot file
> >> from release "ch_rel-1"?
> >>
> >> Question 3: Should I even be trying to install more than one release
> >> at once? Would I need a completely new Erlang install directory (or at
> >> least, releases directory, by using RELDIR)?
> >>
> >> (I have, incidentally, seen somewhere that the placement of the .rel
> >> file directly under releases/ by make_tar is a bug. Is this so? It
> >> certainly doesn't seem to match the structure created by
> >> create_target.)
> >>
> >> Thanks in advance for any help,
> >> Sam.
> >> _______________________________________________
> >> erlang-questions mailing list
> >> erlang-questions
> >> http://erlang.org/mailman/listinfo/erlang-questions
> >
> >
> >
> > --
> > Samuel Elliott
> > sam
> > http://lenary.co.uk/
> > +44 (0)7891 993 664
> >
> >
> _______________________________________________
> erlang-questions mailing list
> erlang-questions
> http://erlang.org/mailman/listinfo/erlang-questions
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20110921/3d910d3f/attachment.html>

Reply | Threaded
Open this post in threaded view
|

Erlang release names and versions

Siri Hansen-3
Hi Sam!

After some research I agree there are some strange things here, and it might
be a good idea to do some adjustments...

>> The documentation for Releases
>> (http://www.erlang.org/doc/design_principles/release_structure.html)
>> shows a sample directory structure produced by make_tar, which
>> includes this part:
>>
>> releases/A/start.boot
>> releases/ch_rel-1.rel
>>
>> Where ch_rel-1 is the name of the release and A is the version of the
>> release.

To be specific, ch_rel-1 is really only the name of the release resource
file, and not to be confused with the name of the release, which is stated
inside this file:

{release, {RelName, Vsn}, ....}

I believe that a good recommendation could be to name the release resource
file "RelName-Vsn.rel" (at least with the current handling by make_tar etc).

>> Question 1: If the release file is placed in releases/ch_rel-1.rel,
>> then isn't installing a second version of the release (say, "B") going
>> to overwrite the file? Isn't this a problem? Is the addition of "-1"
>> to the release name supposed to address this? Shouldn't the release
>> name appear somewhere in the path?

There are two situations where the .rel file is placed directly under the
releases directory. First, it is done by systools:make_tar - and second (as
a result of this) it is done by target_system.erl, which is used in the
System Principles User's Guide as an example of how to create the first
target system.

As far as I can see, the reason for make_tar to store the .rel file directly
under releases is that this makes it easier to extract only this file from
the tar before unpacking all files (see release_handler:unpack_release). The
version of the release is not known before this file is extracted - so it
would be difficult to point out the file if it was stored in releases/Vsn
... There are of course other ways to go around this problem, but I guess
this is the explanation for the strange behavior anyway.

If you study release_handler:unpack_release you will also see that it later
moves the .rel file to releases/Vsn... However, the very first release is of
course not unpacked by release_handler:unpack_release, and if you follow the
documentation/example then the .rel file of this release will be stored in
the releases directory. And obviously you are correct - if the .rel file in
the next release has the same name, it will be overwritten when the next
release is unpacked (by release_handler:unpack_release) since it is
extracted to the releases directory first before it is moved.

I can only conclude that (at least) there is a bug in the
documentation/example...

>> Question 2: If another release, say "foo", is installed with the same
>> version (say "A"), isn't it going to overwrite the start.boot file
>> from release "ch_rel-1"?

That would actually not be allowed by the release_handler - in a running
system you can only install a release version once. The release_handler does
not care about the name of the release, it only deals with the version here.
However, you can of course unpack such a release manually and then you would
have a problem.

>> Question 3: Should I even be trying to install more than one release
>> at once? Would I need a completely new Erlang install directory (or at
>> least, releases directory, by using RELDIR)?

Yes, the release_handler is intended for installing multiple releases under
one root. It will work if you make sure that your .rel files have unique
names (and you only have one release packet of a specific version). But I
would also suggest that you move the .rel file of the first installation to
releases/Vsn. This should be done by (your equivalence to)
target_system:install/2.

>> (I have, incidentally, seen somewhere that the placement of the .rel
>> file directly under releases/ by make_tar is a bug. Is this so? It
>> certainly doesn't seem to match the structure created by
>> create_target.)

I agree it is a bit confusing, but given the explanation above regarding
make_tar, I don't think it is a bug that the file is stored under releases
in the tar file. I rather think that the documentation and the
target_system.erl has a bug, and we need to correct that.

(What do you mean by 'create_target'?? Is it reltool:create_target/2?)

I hope this was of some help! Thanks for pointing out this problem. The
documentation and example will be improved in R15B.

Regards
/siri
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20110922/89a6bf4a/attachment.html>