Synology NAS installatie van Node-Red
1) NodeJS (supported by some models)
Node RED is dependant on Node.js being installed on your Diskstation and you also need to make sure user home service is enabled in the Control Panel under user > advanced > user home. I already had that enabled and Node.js installed, so I went ahead with the Node-Red install.
I needed to SSH into my NAS to install Node-Red. As I was working on a Windows PC I used PuTTY for that, but any equivalent SSH client would do. I also needed to enable SSH on the Synology Diskstation – a setting you will find in the “Terminal & SNMP” link in the Control Panel of DSM. While you are there take a note of the port number, you’ll need that for your SSH client.
Once I had connected to the Diskstation and logged in I could install Node-RED using the command from https://nodered.org/docs/getting-started/installation
Example install on DS213J
sudo npm install -g --unsafe-perm node-red
Once it has run through the installation process you simply type ‘node-red’ to start it up.
Look for the line displayed in the terminal window when you start it up that says [nas-ip-address]:1880 and that is the URL to view the User Interface.
Now I needed to get it to start up automatically at boot. To do this I installed pm2, a process manager for Node.js, by entering:
sudo pm2 npm install -g pm2
And that successfully started Node-RED as a daemon, which meant it carried on running when I logged out of my SSH session.
What I could not do is get the pm2 start-up option to work. This may be due to a quirk of the Synology or it may have been my error but I decided to sidestep the problem by using Synology’s own Task Scheduler. I wrote a simple script and set up the Task Scheduler to run it at boot.