Erlang/OTP Forums

Author Message

<  Erlang  ~  Deploying embedded Erlang?

jacek99
Posted: Fri Jun 12, 2009 12:51 pm Reply with quote
User Joined: 26 May 2009 Posts: 27 Location: Montreal, Canada
Is it possible to deploy an app with an embedded particular version of the Erlang runtime? (like Java JREs that are distributed with an app).

Or does Erlang always need to be in the standard /usr/lib/erlang folder (i.e. there can only be one version running at a time, you cannot have multiple Erlang apps on different versions of the runtime).
View user's profile Send private message
Mazen
Posted: Sat Jun 13, 2009 2:37 pm Reply with quote
User Joined: 20 Jul 2006 Posts: 164 Location: London
Maybe something like this. Really quick version, I don't have much time Smile This is a minimal system... change it by adding different apps to your boot script.

Copy erts-X and bin directories from your Erlang directory where you installed Erlang
Code:

:~/target> cp -r /usr/local/lib/erlang/erts-5.6.5/ .
:~/target> cp -r /usr/local/lib/erlang/bin/ .


create some directories that are needed; lib is for your applications, pipes/ is where you will connect to Erlang and releases/1.0 is the version of your boot file (it can have any name)
Code:

:~/target> mkdir -p lib log pipes releases/1.0


copy in minimum applications into the lib dir
Code:

:~/target> cp -r /usr/local/lib/erlang/lib/kernel-2.12.5/ lib/
:~/target> cp -r /usr/local/lib/erlang/lib/stdlib-1.15.5 lib/
:~/target> cp -r /usr/local/lib/erlang/lib/sasl-2.1.5.4/ lib/


edit your start scripts;
Code:

In bin/erl:
  Set the ROOTDIR env variable to `pwd`

In bin/start
  Set the ROOTDIR env variable to `pwd`
  Change "-daemon /tmp/" to "-daemon pipes/"

In bin/start_erl
  Add additional Erlang flags after the -config switch and the ${1+"&@"} (E.g. "-sname mynode" etc..)


Create your rel file:
Code:

:~/target> echo -e "{release,{\"My Release\",\"1.0\"},{erts,\"5.6.5\"},\n\t [{kernel,\"2.12.5\"},\n\t  {stdlib,\"1.15.5\"},\n\t  {sasl,\"2.1.5.4\"}]\n}." > releases/1.0/start.rel


Build your boot file:
Code:

:~/target> bin/erl -noshell -eval 'systools:make_script("releases/1.0/start",[no_module_tests])' -s erlang halt


Specify release to boot and create empty config file:
Code:

:~/target> echo "5.6.5 1.0" > releases/start_erl.data
:~/target> echo "[]." > releases/1.0/sys.config



The rest should be a matter of adding more applications, configuration and stuff like that... but this should cover the basics

Also, by specifying the --prefix switch to the configure script when you compile Erlang you can choose where yo install it, E.g. ./configure --prefix=/my/special/dir ...

Hope it helps Very Happy

/Mazen
View user's profile Send private message

Display posts from previous:  

All times are GMT
Page 1 of 1
This forum is locked: you cannot post, reply to, or edit topics.

Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum