CouchDB as part of the Erlang release

I would like to create and deploy an application in which Django is an interface, YAWS ( appmods ) or Mochiweb / Webmachine as a backend and CouchDB as a data store. In addition, I plan to make extensive use of CouchDB's replication capabilities to provide high resiliency for the entire application.

I tend to think that for this I have to create a single version of OTP that has YAWS and CouchDB as Erlang / OTP applications.

Does this approach seem right? How can I organize YAWS and CouchDB in terms of OTP applications to create a reliable production installation? Are there any recommendations for this?

+7
source share
2 answers

Erlang releases are a good way to batch software, as they include all dependent libraries. Thus, different erlang applications can run different versions of their required libraries without conflict with each other.

A popular way to solve the complex Erlang release process is to have Rebar do it for you. They have a quick start guide to get the right path. I don’t know if you use Rebar to manage your project, but it simplifies the work. It is definitely worth exploring if you are not already using it.

However, the fittings will not include your dependencies right out of the box. To do this, you must modify the reltool.config file and all necessary applications.

The first step is to add a directory in which all your dependencies are located, for example:

{sys, [ ... {lib_dirs, ["../deps"]}, ... }. 

Then add your dependencies as applications for inclusion in the release:

 {sys, [ ... {app, jiffy, [{incl_cond, include}]}, {app, cowboy, [{incl_cond, include}]}, ... }. 

Now, when you run the rebar generate command, your applications should be in the target directory under lib:

 find brawl_server -type d -maxdepth 2 brawl_server brawl_server/bin brawl_server/erts-5.9.1 brawl_server/erts-5.9.1/bin brawl_server/lib brawl_server/lib/brawl_server-1.1 brawl_server/lib/cowboy-0.6.0 brawl_server/lib/jiffy-0.6.1 brawl_server/lib/kernel-2.15.1 brawl_server/lib/sasl-2.2.1 brawl_server/lib/stdlib-1.18.1 brawl_server/log brawl_server/log/sasl brawl_server/releases brawl_server/releases/1 

You also need to make sure that your own OTP application knows that it needs to run the applications on which it depends. If you have a generated rebar project, modify your <appname>.app.src file to include them:

 {application, app, [ ... {applications, [ jiffy, cowboy, kernel, stdlib ]}, ... }. 

You should be able to compile and generate the release and run it with the scripts included, as described in the Rebar release article.

There is an added wrinkle at the moment, because apparently Vanilla CouchDB is not OTP compatible, and you cannot enable it this way. You can use another distribution: rcouch . I have not tried it myself, I hope this works for you.

Further reading:

+4
source

I would recommend creating DEB / RPM / you-name-it package / s. CheckInstall is the easiest solution for this.

-2
source

All Articles