Question

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?

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top