[erlang-questions] Erlang application packaging

Agustin Cautin acautin@REDACTED
Thu Sep 20 18:22:03 CEST 2012


Hello,

This is because the -s parameter calls the function "start" on the
module given as a parameter, so in this case it would be called as
myapp:start(), probably myapp.erl doesn't exist.

The function name can be specified as a parameter so you can call the
one is initializing your app.

Take a look at the erl documentation on the -s parameter.

Or you can just define the function start to call application:start(myapp).

Regards.
Agustin


On Thu, Sep 20, 2012 at 6:05 PM, Jean Parpaillon
<jean.parpaillon@REDACTED> wrote:
> Hi,
>
> Le jeudi 20 septembre 2012 à 17:49 +0200, Ali Sabil a écrit :
>> Ok, sorry :)
>>
> No harm, I was suggesting myself to reread it :)
>
>> Basically in Erlang, the concept of release is pretty close to the
>> concept of Linux distributions, a release allows you to package the
>> erlang runtime and a set of applications together into a distribution.
>> The easiest way to generate releases is probably by using rebar. Here
>> is a small quickstart on how to generate a release using rebar:
>>
>>   mkdir -p product && cd product
>>   wget http://cloud.github.com/downloads/basho/rebar/rebar && chmod u+x rebar
>>   mkdir rel && cd rel
>>   ../rebar create-node nodeid=product
>>   # edit the reltool.config file to remove the non-existing product
>> application from the release
>>   # this is done by removing the product atom right after the sasl
>> atom and the comma separating them
>>   # as well as {app, product, [{incl_cond, include}]} and the comma before it
>>   # this is to have a running release
>>   ../rebar generate
>>   ./product/bin/product console  # this will start a node based on your release
>>
>> The applications you want to include are generally placed in apps/
>> and/or deps/ at the root and you just need to edit the reltool.config
>> file and add
>>   {lib_dirs, ["../apps", "../deps"]}
>> inside the sys section
>>
>> That said you might not really need to use a release to package your
>> application, if you have an erlang runtime available on the target
>> machine you could either turn your application into an escript (the
>> escriptize command in rebar) or use a shell script.
>>
>
> Ok, I think I got the different parts of the release process. Now, if I
> follow a rebar tutorial and try to launch the code:
> - If I do:
> $ erl -pa ebin
> then
>> application:start(myapp).
>
> My application is fine and running
>
> - If I do:
> $ erl -pa ebin -s myapp
> I got the following error:
> {"init terminating in
> do_boot",{undef,[{kernel,start,[],[]},{init,start_it,1,[]},{init,start_em,1,[]}]}}
>
>
> Any hints ?
>
> Thank you again for your time !
>
> Jean
>
>> Hope this helps,
>> Ali
>>
>>
>> On Thu, Sep 20, 2012 at 4:33 PM, Jean Parpaillon
>> <jean.parpaillon@REDACTED> wrote:
>> > Hi Ali
>> > Thank you for your help.
>> > I've begun erlang with this tutorial but I have to admit I am still
>> > confused about the right tool to use. Just in learnyou..., reltool and
>> > systools are presented.
>> > Let's read again this chapter :)
>> >
>> > Regards,
>> > Jean
>> >
>> > Le jeudi 20 septembre 2012 à 16:11 +0200, Ali Sabil a écrit :
>> >> Hi Jean,
>> >>
>> >> I don't know if you have come across this:
>> >> http://learnyousomeerlang.com/release-is-the-word#am-i-an-executable-yet
>> >> but it might be helpful?
>> >>
>> >> Best,
>> >> Ali
>> >>
>> >> On Thu, Sep 20, 2012 at 3:52 PM, Jean Parpaillon
>> >> <jean.parpaillon@REDACTED> wrote:
>> >> > Hi all,
>> >> > I'm Jean Parpaillon, new erlang enthusiast and (soon) programmer. On 7
>> >> > past years, I've workedon distributed systems, specially in HPC and
>> >> > cloud computing. I'm trying to develop an XMPP agent for system
>> >> > management, written in Erlang. This is the introduction, now the
>> >> > question :)
>> >> > What is your preferred packaging/deployment system for erlang ? I have a
>> >> > code running, from erlang shell, and want it to become a real world
>> >> > application the user can install from an archive and launch from its
>> >> > shell, eventually with some parameters.
>> >> >
>> >> > I've read about systools, and how to generated .app, .appup, .rel, .boot
>> >> > and so on. This looks fine but a lot to do by hand. When it comes to
>> >> > update a file, and release the whole stuff, one have to modify plenty of
>> >> > others. Or am I wrong ?
>> >> > I've looked to existing applications or 'helloworld's: some of them
>> >> > using autotools (ejabberd, ...), a lot of others using rebar, sometime a
>> >> > little a bit of both, iirc.
>> >> > rebar has a lot of magic, which makes debugging hard.
>> >> > autotools is not well designed for erlang, but putting some existing m4
>> >> > files here and there seems to fit. At least, I know autotools well. I
>> >> > know how can I generate .app, .rel and so on with autotools, but I don't
>> >> > know what to put in it :/
>> >> > At the end, for launching the application, I've seen many projects not
>> >> > using .boot files, but a shell script with tons of arguments to erl...
>> >> >
>> >> > I'm a little bit confused :( Any help ?
>> >> >
>> >> > Best regards,
>> >> > --
>> >> > Jean Parpaillon
>> >> > Open Source Consultant
>> >> > Phone: +33 6 30 10 92 86
>> >> > im: jean.parpaillon@REDACTED
>> >> > skype: jean.parpaillon
>> >> > linkedin: http://www.linkedin.com/in/jeanparpaillon/en
>> >> >
>> >> >
>> >> > _______________________________________________
>> >> > erlang-questions mailing list
>> >> > erlang-questions@REDACTED
>> >> > http://erlang.org/mailman/listinfo/erlang-questions
>> >> >
>> >
>> > --
>> > Jean Parpaillon
>> > Open Source Consultant
>> > Phone: +33 6 30 10 92 86
>> > im: jean.parpaillon@REDACTED
>> > skype: jean.parpaillon
>> > linkedin: http://www.linkedin.com/in/jeanparpaillon/en
>> >
>
> --
> Jean Parpaillon
> Open Source Consultant
> Phone: +33 6 30 10 92 86
> im: jean.parpaillon@REDACTED
> skype: jean.parpaillon
> linkedin: http://www.linkedin.com/in/jeanparpaillon/en
>
>
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions
>



More information about the erlang-questions mailing list