yazz.com
yazz.com

Reputation: 58786

Is there an Erlang command to read BEAM files from a remote repository?

I need to distribute some Erlang code which is closed source to a client. I think the easiest way would be to simply give an Erlang shell command to pull the code from a remote host. The remote host will be an Erlang VM which does not shared the same secret cookie as the client. How can I do this?

For example, if I am in the Erlang shell, I would like something thats lets me do:

load_lib(mysql).
load_lib(postgres).

: and then Erlang would download and install the BEAM files, and would allow me to use the mysql: and postgres: Erlang modules from that point on

Update: 1) I have been suggested to use tarballs, so I guess the procedure in this case would be something like:

Find Erlang lib directory and CD to it
wget tarball to the current directory

Not as nice as gem install, but its the best that Erlang can do

Upvotes: 1

Views: 1280

Answers (2)

I GIVE TERRIBLE ADVICE
I GIVE TERRIBLE ADVICE

Reputation: 9648

You can't really have this done between two untrusted Erlang node. That secret cookie is the only security measure existing between nodes. You will need to roll out your own protocol, even if it's just straight HTTP.

What you could do from that point on is either send a BEAM file over the network, or just send the binary data contained inside one. You can then load the module by calling code:load_file/1 for the BEAM, or code:load_binary/3for the binary data.

This all sounds relatively brittle to me though. A repository, as suggested by Roberto Aloi would likely be the best idea.

Upvotes: 2

Roberto Aloi
Roberto Aloi

Reputation: 30985

Couldn't you simply upload your code to some repository and provide access to the client? You could also provide a script to automatically load the new versions of the code without stopping the live system... Or am I missing something?

Upvotes: 1

Related Questions