Andy
Andy

Reputation: 11008

How do you ensure your Rails server running

What is common approach to make sure that Rails server is auto-restarted after a serious crash, or a process kill? How do you deal with hanging processes? I have nginx and thin running on my production server - would you suggest to put something in between them? Or using another server?

Upvotes: 2

Views: 381

Answers (2)

cjm2671
cjm2671

Reputation: 19496

Firstly:

You should identify the cause of a process hang or kill. These are not normal behaviours and indicate a fault somewhere.

Look for:

  • Insufficient memory or high load before a crash - indicates a configuration problem.
  • Versions of nginx that are too new.
  • If you're virtualising, this can cause a number of subtle problems with linux kernels that may cause segfaults. If you're using EC2, use Amazon Linux for your best chance. Ubuntu server is too bleeding edge for this purpose.

In order to do the restarts, I suggest you use monit as this is quick, easy and reliable - it's the normal way to do this.

Lastly, I suggest you set up external monitoring as well using something like Pingdom, as even monit won't catch every type fault, such as hardware failures.

Upvotes: 2

Ludovic
Ludovic

Reputation: 2002

If you only want to monitor an application, I'm always using Nagios with Centreon. You can set email alarming when your rails server is down. You have to setup your NRPE on every machine you want to monitor.

When an error is detected you can run a bash file to kill hanging processes and restart the server automatically. Personally, I never use that because a crash mean something goes wrong. So I do it manually in order to check everything.

Try to look here : http://www.centreon.com/

Upvotes: 0

Related Questions