2

I am building an Erlang/OTP system which consists of a MochiWeb web server, some custom Erlang/OTP applications and a few non-native components, which are the following:

  • a CouchDB database to store both the state of the MochiWeb web server and the persistent data (users, accounts, etc.)
  • a legacy PostgreSQL database to store some other entities (orders, accounts, etc; client's requrement: can not be migrated to CouchDB, the data should be used as is);
  • an Asterisk server to provide phone notifications to the users of the system.

I would like to achieve a high level of uptime and availability and thus I would like to know what is the best way to monitor those non-Erlang/OTP elements of the system. Basically, I would like to have each element of the system to be supervised, monitored and restarted if needed. It is easy achieveable for Erlang/OTP applications, but I don't know how to do that with non-Erlang components.


Should I wrap them as Erlang/OTP applications and include into the OTP supervision tree?

Or should I use some third-party software tools to monitor and supervise those non-Erlang/OTP components of the Erlang/OTP system?

What is the best known practice to do that?

skanatek
  • 5,133
  • 3
  • 47
  • 75

1 Answers1

3

The answer is it depends :P

I have seen both methods used, but I am not too sure if one has advantages over the other. My gut feeling would be to pick the one where you manage the application through a port from within erlang. That way, you have a nice centralized way of knowing if problems crop up, and can fix things easily.

I GIVE CRAP ANSWERS
  • 18,739
  • 3
  • 42
  • 47
  • So, in other words, I wrap every non-OTP piece of software into an OTP app through ports and add that to my OTP supervision tree, right? – skanatek Jul 17 '13 at 06:43
  • 1
    That is one way to go at it yes. Another way is to keep stuff running via, say, `monit` outside of the system. – I GIVE CRAP ANSWERS Jul 17 '13 at 10:01
  • Thanks to the reference to monit! It even seems to have some basic restart strategies that can be implemented via its control file. I doubt though that I would be able to start Django or Asterisk via Erlang port. – skanatek Jul 19 '13 at 12:15