Running node.js on Synology with supervisor
Running 1 node.js app in a screen window works fine for developping and testing but for my Ghost blog i need a more stable solution. One that starts automatically when the Synology reboots for example.
This article Making Ghost run forever explains your options, however, your Synology does not have the easiest option (supervisor) installed. Also not the
/lib/lsb/init-functions that would make your own rc.d script easy to write.
I found that
supervisor is not available as a ipkg package so i tried to build it myself.
First off, i need to get the
setuptools for python installed. Easy enough like so:
wget https://bootstrap.pypa.io/ez_setup.py -O - | python
Next is getting the supervisor code, full explanation of options on the supervisor site. Because i have an internet connection i choose to install it the easy way :)
Don’t forget to create a basic supervisor config (and remember the location because you need to add the ghost section to it). From the supervisor page:
Creating a Configuration File
Once the Supervisor installation has completed, run echo_supervisord_conf. This will print a “sample” Supervisor configuration file to your terminal’s stdout.
Once you see the file echoed to your terminal, reinvoke the command as
echo_supervisord_conf > /etc/supervisord.conf. This won’t work if you do not have root access.
Now we have the basic building blocks installed on the Synology, let’s get supervisor setup.
Oh wait, Synology does not have the Redhat service function, so we can’t start supervisor as a daemon just yet. Fortunately, there is a script i found and customised: