[erlang-questions] Can Erlang application load from within beam without external storage?

Grzegorz Junka list1@REDACTED
Wed May 25 11:05:09 CEST 2016


This is what Erlang releases are for! Albeit they don't produce a single 
binary, they are pretty straightforward to be moved around as a single file.

Have a look at this example:

mkdir test_sc
cd test_sc/
git clone https://github.com/builderl/ex1_simple_cache.git
cd ex1_simple_cache/
gmake get-deps
gmake tgz

This produces a single tgz file in tmp/ folder which contains the Erlang 
VM, erts and all required applications (and nothing more). It can be 
moved to any place since all paths used in it are relative. Once moved 
to the desired host/location you unpack, install and run it:

mkdir myrelease
cd myrelease
tar -xzf ~/path/to/the/release.tgz
./bin/init.esh
./bin/start.esh
to_erl ../sc-1/shell/

It's build with a normal makefile so bundling Rumprun unikernel to it 
should be a piece of cake.

It's possible to create a single binary with all Erlang applications 
using the technique called escriptize 
http://blog.differentpla.net/blog/2015/10/21/rebar-escriptize but for it 
to work the Erlang runtime has to be already installed on the 
destination system.

Grzegorz


On 25/05/2016 07:31, Neeraj Sharma wrote:
> On Wed, May 25, 2016 at 10:45 AM, Sergej Jurečko
> <sergej.jurecko@REDACTED> wrote:
>> This?
>> http://erlang.org/doc/man/code.html#id104826
>>
> Interesting piece of information although I am afraid my requirement
> was not clear enough, so let me provide some additional details.
>
> My intention is to package Erlang VM, application and its dependencies
> (including OTP) into a single blob of binary which can run standalone.
> I am at very early stage to evaluate the possibilities here so things
> may appear vague at this point. Having said that ideally I'd like to
> retain the Erlang shell and given the nature of the build code reload
> is not required. I believe there are some projects like erllvm and
> Hipe but I dont have clear understanding of the same and wanted to
> know existence of any prior work which can be reused. Actually the
> single binary will also include the Rumprun unikernel, which at
> present is limited to Rumprun and Erlang beam VM, while the rest of
> the application (and dependencies) are stored on secondary media.
>
> An alternative path would be to evaluate the feasibility to bundle all
> the apps and dependencies as another blob (probably as zip as given in
> the link at the top) and a wrapper c code unpacks that into ram disk
> recreating the folder structure required by the Erlang VM. Ideally I
> would like to dwell on the first option before evaluating this one.
>
> Thanks,
> -Neeraj
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions
>




More information about the erlang-questions mailing list