Node-RED on Synology
I was running Node-RED on an android phone for a while, and then I moved it to dedicated Pi. Now that I have Synology capable of running Docker containers, I thought it would be a great idea to move it there. Mainly because it has unlimited space, and I have a good power backup for it.
But unlike other things, I moved to Synology. This wasn't straightforward. I created a local folder under the Synology docker folder to map Node-Red's /data folder. Mapped the ports and started the docker. It kept failing with the error that it couldn't create the folder under /data. It seemed strange since other docker containers were able to do it.
[error] Error: EACCES: permission denied, mkdir '/data/lib'
Finally, I found a way to fixing the permission error. It wasn't by sending --user root to the docker command. Though that seemed like it was working, it was writing files to the internal system and not to /data, and in general, it's terrible to run anything as root.
As per this documentation, we have to set up permissions for /data folder for Node-Red to run correctly. Synology has limited ability to change the permissions on folders using UI. This meant I had to enable the admin account and enable SSH in Synology.
Once I did that, I logged into the Synology from a local machine and changed the chmod of the folder to 777. Then I started the Docker, it started correctly. I then installed all the packages using Node-RED's Palette manager. Then stopped the container. I changed the permissions to 755 as suggested by Node-Red documentation and restarted the container.
# SSH to your synology, assuming user is admin # and synology local url is synology.local # You can also use IP address instead of synology.local ssh email@example.com -o PreferredAuthentications=password # cd docker folder # chmod it sudo chmod 777 nodered_data # Once all the packages are installed, you can make it 755 sudo chmod 755 nodered_data
Now I have a Node-RED running on my Synology without any issues. I feel good :)
You can subscribe to my blog using RSS Feed. But if you are the person who loves getting email, then you can join my readers by signing up.