在 Erlang(和 Riak)中开发应用程序时的良好实践?

发布于 2024-12-17 02:55:06 字数 337 浏览 1 评论 0原文

我们逐渐熟悉 Erlang/OTP 和 Riak(Core、KV、Pipe 等),尝试依次构建开源分布式应用程序。我们的项目将有很多依赖项:像 erlang_js、protobuffs 等工具,还有我们需要运行的服务,例如 Riak KV。

在 Python/Ruby/Node.js 中,如果模块放置在相对于您的项目的标准子目录中,您可以引用它们,然后将它们打包到版本中。您可以在项目目录中启动 shell、使用模块、进行测试等,如果遵循良好的实践,所有这些都非常容易。

在 Erlang/OTP 中组织开发环境的最佳实践是什么?所有依赖项均可访问(并且可轻松更新到最新版本)、对运行节点的 shell 访问、测试、发布等等?

We are getting familiar with Erlang/OTP and Riak (Core, KV, Pipe, and so on) trying to build an open-source distributed application in turn. Our project is going to have a bunch of dependencies : tools like erlang_js, protobuffs, etc., but also services that we need to have running, such as Riak KV.

In Python/Ruby/Node.js, if modules are placed in a standard subdirectory relative to your project's, you can reference them, and later package them in releases. You can fire up a shell in the project's directory, play with your modules, do tests and so on, all just easily if good practices are followed.

What are the best practices for organizing a development environment in Erlang/OTP, with all dependencies reachable (and easily updatable to newest version), shell access to running nodes, testing, making releases, and so forth?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

黒涩兲箜 2024-12-24 02:55:06

查看 rebar3:用于打包、模板化和管理 Erlang/OTP 应用程序的版本。您将找到有关如何使用它的完整教程。

查看此 OTP 教程< /b> 首先,您可以切换到这个它向您展示了发布以及它们在 Erlang 中的处理方式。在开发项目时,请使用整本书作为参考,因为作者仍​​然是逐步添加您可能需要的更高级的东西。

您可能还想继续阅读Erlang 应用程序 然后查看下面的快速链接:

Erlang打包,流程一
OTP 打包视频作者:芝加哥老板们
Erlang 依赖管理
理查德·琼斯关于使用依赖项打包 Erlang 项目的建议和示例
Maven 工具以及如何在打包 Erlang 中使用它项目

最重要的是,非常认真地对待钢筋。这对于管理具有依赖关系的 Erlang 应用程序非常重要。您可以继续在 Stack Overflow 上发布您的问题,以获得任何帮助。

在我忘记之前,请先查看 Riak 社区 中的大量内容。

此外,查看有关创建目标系统以及如何使用Reltool 处理发布。 erlang 的好处在于,它有多种选择来执行某些操作,只要以这种方式轻松维护应用程序即可。通过目标系统,您将学习如何嵌入 Erlang VM、如何在 Solaris、VxWorks 上运行 Erlang 应用程序,以及如何使用 erlsrv

通常,我们确保当操作系统启动服务器时,我们的应用程序随之启动。迄今为止,在嵌入 Erlang/OTP VM 方面,Solaris 比任何其他操作系统都有更多的定制。您始终可以使用 Escript< 与嵌入式 Erlang VM 进行通信/a> 其中通过 escript 创建一个 erlang 节点,允许连接到嵌入式 VM(因此它们必须共享相同的 cookie),并且嵌入式 VM 必须允许临时创建的节点通过执行进行连接

net_kernel:allow(List_of_nodes)

确保调用此方法以使您的嵌入式虚拟机仅允许来自已知严格指定数量的节点的连接。

Check out rebar3: used for packaging, templating and managing releases of Erlang/OTP applications. You will find there an entire tutorial on how to use it.

Check out this tutorial on OTP first, before you can switch to this one which shows you releases and how they are handled in Erlang. Use this entire book as reference as you develop your project and because the author is still progressively adding more advanced stuff that you may need.

You may also want to keep reading about Erlang Applications and then do check out these quick links below:

Erlang Packaging, Process One
OTP Packaging Video by Chicago Boss Guys
Erlang Dependency Management
Richard Jones Advice and examples on Packaging Erlang Projects with Dependencies
Maven Tool and how it is used in packaging Erlang Projects

Most importantly, take rebar very seriously. It is very important in managing Erlang applications which have dependencies. You can keep posting your questions here on Stack Overflow for any assistance as you progress.

Before I forget, do check out a lot of stuff from the Riak Community.

Also, its important to check out the system documentation on creating target systems and also how to use Reltool to handle releases. The good thing with erlang is that it has several options of how to do something, as long as its easy to maintain your application in that way. With target systems, you will learn how to embed the Erlang VM, how to run Erlang applications on Solaris, VxWorks, and creating Erlang applications as Services on Windows NT using erlsrv.

Normally, we make sure that as an operating system is booting a Server, our application starts with it. Solaris so far has more customizations than any other OS as regards embedding Erlang/OTP VM. You can always communicate with (an) embedded Erlang VM(s) using Escript where by the escript creates a an erlang node which is allowed to connect to the embedded VM (so they have to share same cookie) and the embedded VM must have allowed the temporarily created Node to connect by executing

net_kernel:allow(List_of_nodes)

Make sure to call this method to make your embedded VM allow connections only from an known strictly specified number of Nodes.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文