erlangnitrogen

How to handle a nitrogen application with source control?


As far as I know I am only supposed to put my site directory under version control. (See 1 2).

However, all the tutorials mention that I should start the application via bin/nitrogen console. But where should I get the bin directory from, when I do not put it into my repository? What is the correct way to start the application?

What I tried so far:


Solution

  • The docs definitely need to be updated for this, but there are three approaches you can take here:

    1) As you mentioned putting site under source control is useful if you're doing a full release (make rel_X), since putting the entire erlang installation into git is a bit overkill. Then, when moving the app to another server, you would install Nitrogen, run your make command, and then clone your site directory, replacing the default site directory.

    2) put the whole thing under source control. With a full release, it also means your stuck having a full ERTS in your repo, but it's easier to deal with and you don't have to screw around with copying directories or worring about erlang version incompatibilities, since erlang comes with it (this is basically how we distribute Nitrogen in binary form).

    3) (my preferred approach) make a slim release (make slim_X), which is a minimal release that doesn't come with the full ERTS. Then put the whole directory under source control. Also you can safely add lib/ to your .gitignore file, allowing git to download the deps when needed. I prefer this approach since it packages up everything, including configs in etc, custom made commands, and any other modifications you might make. The main hangup you might get is if you clone your slim repo to a machine that doesn't have the same version of Erlang, but there's a fix for that too: make fix-slim-release.

    I hope that helps clear some things up. The docs will be updated with the upcoming 2.3 release to properly discuss the SCM strategy for Nitrogen.