God is a very powerful process monitoring library written in Ruby. This tutorial describes how to setup a basic monitoring configuration file for a NodeJS application, telling God to restart the NodeJS app upon the process being killed (for what ever reason).
To get started, create a god/ directory within your Node app.
In this directory, create a god configuration file
Update the global God configuration file (Refer to previous tutorial on installing God on Ubuntu 12.04) with the location of your Node app config.
sudo vi /etc/god.conf
Great, when you reload God it will start using the configuration, but first we must write the configuration file. Open your nodeapp.god config file for editing. We will start off by creating a basic configuration file that will allow you to:
- Start node
- Stop node
- Restart node