Alex Rivera | Logout

Erlang workflow

Asked 2011-02-15T16:52:55.320
9

How do you organize your erlang workflow? I'm learning some Erlang now and I'm using Rebar, recompiling, rebuilding and restarting an entire release (I'm trying to keep things OTP'ish) after each edit. I'm pretty sure that there is a smarter way to do this.

Edit
Report

1 Answer

3

In Etorrent, I am using a little trick you may like:

When you have built a development release, you can execute the command make console which has the following definition:

console:
    dev/etorrent-dev/bin/etorrent console \
            -pa ../../apps/etorrent/ebin

basically, it uses the release ebins for most stuff, but overrides the application ebin to be outside at the point where you normally build the software. Now, running a console, you can edit your code, run make (I hit a key combination in Emacs), fix errors, run make again and so on. When you are satisfied with your change, you go into the console (erlang shell) and execute l(ModuleToLoad) at which point the running system gets the new code injected. OTP will automatically pick up the hot-deployed code change and alter the processes. Essentially you only have to restart fairly rarely when working on the code.

Nowadays, we also have tests, so you can execute make test in etorrent to have the test framework run on your newly formed code before injection if you want a bit more guarantee that the new code works.

answered 2011-02-15T20:56:15.240

Your Answer