是否有 Erlang 命令可以从远程存储库读取 BEAM 文件?
我需要向客户端分发一些封闭源代码的 Erlang 代码。我认为最简单的方法是简单地给出一个 Erlang shell 命令来从远程主机提取代码。远程主机将是一个 Erlang VM,它不与客户端共享相同的秘密 cookie。我该怎么做?
例如,如果我在 Erlang shell 中,我想要一些可以让我做的事情:
load_lib(mysql).
load_lib(postgres).
: 然后 Erlang 将下载并安装 BEAM 文件,并允许我从那时起使用 mysql: 和 postgres: Erlang 模块
更新: 1) 有人建议我使用 tarball,所以我想这种情况下的过程会是这样的:
Find Erlang lib directory and CD to it
wget tarball to the current directory
不像 gem install 那样好,但它是 Erlang 能做的最好的
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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
你实际上无法在两个不受信任的 Erlang 节点之间完成此操作。该秘密 cookie 是节点之间存在的唯一安全措施。您将需要推出自己的协议,即使它只是简单的 HTTP。
从那时起,您可以做的就是通过网络发送 BEAM 文件,或者只发送其中包含的二进制数据。然后,您可以通过调用
code:load_file/1
(对于 BEAM)或code:load_binary/3
(对于二进制数据)来加载模块。不过,这对我来说听起来相对脆弱。 Roberto Aloi 建议的存储库可能是最好的主意。
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, orcode:load_binary/3
for the binary data.This all sounds relatively brittle to me though. A repository, as suggested by Roberto Aloi would likely be the best idea.
您不能简单地将代码上传到某个存储库并提供对客户端的访问吗?
您还可以提供一个脚本来自动加载新版本的代码,而无需停止实时系统......或者我错过了什么?
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?